Using Templates to Send Personalized Messages


In this post we are going to discuss how to take advantage of using templates for your SMS messages. Templates are the way to go when composing custom text messages for your users or clients, in scenarios where there is a basic piece of text that you would like to send to a bunch of them, but some parts of it should be replaced with specific information for each destination.

Templates are stored in your PortaText account and are available for use in campaigns, single, and group messages, and of course they can be combined with any variables that you store with your contacts.

We briefly discussed them in a previous post and now we are going to dig a bit more into them.

When to Use Them

You should be using Templates when there are specific scenarios where you would like to automatically send pre-defined communications to your clients, perhaps from your CRM. These are different from the one-shot messages that are usually written by an agent or operator (for example when answering inquiries). Let’s see a few examples.

Order Confirmation

A common use case is a customer placing an online order and receiving a confirmation messages afterwards:

Hello {{first_name}}, thank you for your business! Your order has been shipped and your tracking code is {{tracking_code}}

Debt Collection

A friendly reminder of outstanding invoices could be sent a few days before the due date:

Dear {{first_name}}, this is a friendly reminder of your pending payment of ${{amount}}, call us at 1800xxxzzzz for more information


For the IT crowd it is useful to have alerts like:

Hey guys, we got the error {{error_message}} for the app {{app_name}} triggered by {{username}}

Self Service

These are probably the most fun use cases that we handle here at PortaText, because they enhance the overall customer service and customer experience, and their use is truly limitless. One very basic example is a customer checking its account balance by sending an SMS with a specific keyword (for example “check balance”), and getting in response a message like:

Your current account balance is: ${{balance}}

The text between brackets are variable names, or placeholders (see below) and will be replaced by the correct value right before the message is sent.

How Templates Work

Templates are accessible through our REST API, your user panel, and of course through our Open Source SDKs. As you could see in the previous section they are nothing more than a simple text with specific placeholders for variables.

The values for these variables can be specified at the moment of sending the message or when creating a campaign, and can also come out of your contacts. For example, let’s go back to one of our previous examples:

Dear {{first_name}}, this is a friendly reminder of your pending payment of ${{amount}}, call us at 1800xxxzzzz for more information

Clearly it should not be necessary to send the customer’s first name with every message we send, so the variable first_name can be set directly in the contact. On the other hand, the variable amount will depend on different factors and will change over time (versus the first name of the customer, which will really rarely change), so we can specify it when sending the message or when creating a campaign via a CSV file.

The rule of thumb to know what’s the correct place to save a variable value is: If the variable will rarely change, store it with your contacts (that can also be imported and exported with your CRM once integrated to use the PortaText API). On the other hand, if the variable only makes sense for a specific type of communication, use it when sending the message or creating a campaign.

Where to Find the Documentation

The full documentation to the use of templates can be found in our REST API documentation, and of course you can get in touch with us if you have any questions.


Templates are a very powerful way of sending automated text messages to your clients with a touch of personalization, and provide the most flexible way to integrate SMS in your current customer lifecycle or purchase workflow. By integrating your CRM with the REST API you will be able to keep interacting with your clients even outside of your office hours.

— The PortaText Team.