Skip to content

Templates

A template is a stored message with placeholders, written in Liquid, for example Hi {{ firstName }}, your code is {{ code }}. To send one, give its name in template.name when you send a message or a batch, with the values in template.data.

{
"name": "appointment-reminder",
"content": "Hi {{ firstName }}, see you at {{ time }} tomorrow.",
"sampleData": { "firstName": "Sam", "time": "10am" }
}

name is what you send with, and must be unique in your workspace. sampleData holds example values, used for previews.

API reference: POST /v2/templates

POST /v2/templates/{id}/render fills a template with your values and tells you what would be sent: the content, how many characters and parts it uses, its encoding, and whether it is too long to send. Contact fields you leave out (firstName, lastName, company, email, clientReference, phoneE164) are filled with examples. Nothing is sent.

PATCH /v2/templates/{id} changes only the fields you send. Messages already sent are not affected.