Templates

Sometimes it's more convenient to separate the content of a message from the API call to send it, such as when this is changed often or a non-technical team is responsible for the content. To do this, you can use our Templates feature.

Setting up a template

To setup a template, simple call the templates service template create method. You can also use this service to do any other template maintenance you need to do, such as update or list templates.

Using your templates

You can use your templates by adding the templateId field to your Omnichannel API call instead of specifying bodies or message parts directly. See the example call below:

🚧

Templates or content but not both!

You cannot use the templateId field as well as the body or messageParts fields in a Omnichannel API call. You must choose one or the other.

{
  "templateId": "promotion_message",
  "to": {
    "phoneNumber": "44123123123"
  },
  "channelOptions": {
    "sms": {
      "from": "YourCompany"
    }
  },
  "rules": [
    "sms"
  ],
  "metadata": {"data": "My important data"}
}