Send Personalized Texts Using Templates
Templates can save time and effort when the same message format is required. Furthermore, your customers will receive personalized messages even when you’ve applied templates. All you have to do is use the embed tags into the template text.
Get all templates
To get all templates, use:
GET /api/v2/templates
with the parameters:
Name | Required? | Example | Description |
---|---|---|---|
page | No | 3 |
Fetch the specified results page. The default is 1. |
limit | No | 25 |
The number of results per page. The default is 10. |
You will receive the standard paginated response:
Parameter | Example | Description |
---|---|---|
page | 3 |
The current fetched page. |
limit | 25 |
The number of results per page. |
pageCount | 150 |
The total number of pages. |
resources | Array of template resources | See next section for template resource format details. |
Get a specific template
To get a single template, use:
GET /api/v2/templates/{id}
where id is a template ID. Note, this command has no parameters.
The response format you will receive is:
Parameter | Example | Description |
---|---|---|
id | 519 |
Template ID. |
lastModified | 2014-09-11T08:12:01+0000 |
Time when template was last modified. |
name | Appointment reminder |
Template name. |
content | Hello {First name}! |
Template text. May contain the tags listed below. |
Custom fields list (Merge tags)
All tags should be inputted inside curly braces (e.g.,
{First name}
for
First name).
Tag | Description |
---|---|
First name | Contact first name. |
Last name | Contact last name. |
Company name | Contact company. |
Phone | Contact phone number. |
Email. | |
Custom fields | Contact custom field values. |
Create a new template
There are times when creating a new template makes sense (such as when targeting specific clients or improving your business strategies). You can create new SMS templates for marketing purposes or SMS templates for business campaigns.
To create a new template, use:
POST /api/v2/templates
with the following parameters:
Name | Required? | Examples | Description |
---|---|---|---|
name | Yes |
Appointment reminder
|
Template name. |
content | Yes |
Hello {First name}!
|
Template text. May contain tags listed above. |
If successful, you will receive the standard link response:
Parameter | Example | Description |
---|---|---|
id | 519 |
ID of the new template. |
href | /api/v2/templates/519 |
Link to the new template. |
Edit a template
To modify a template name or its content, use:
PUT /api/v2/templates/{id}
where id is the template ID, with the following parameters:
Name | Required? | Example | Description |
---|---|---|---|
name | Yes | Appointment reminder |
Template name. |
content | Yes | Hello {First name}! |
Template text. May contain tags listed above. |
If successful, you will receive the standard link response:
Parameter | Example | Description |
---|---|---|
id | 519 |
Id of modified template. |
href | /api/v2/templates/519 |
Link to template. |
Delete a template
To delete a template, use:
DELETE /api/v2/templates/{id}
where id is the template ID. Note, this command has no parameters. If successful, this command will return the standard delete response (204 No Content), otherwise you will receive the standard error response.
The next step
Now you have learned how to create and manage SMS templates, please also check the Messages: Send section to learn how to send personalized text messages using these templates.