Message Templates
Learn how to use Message Templates when calling the Mobile Text Alerts API
Last updated
Learn how to use Message Templates when calling the Mobile Text Alerts API
Last updated
Pre-set message templates allow you to create a message once and then have it on hand to send at any time. You can create and send message templates in the platform, mobile app and the API.
Templates can be sent in a message by sending a POST
request to the /send
endpoint. All requests to this endpoint must contain both recipient and content information. When using a message template, the templateId
will be used as the content.
Required request fields:
Choose recipient(s): (Must be one of the following)
subscriberIds: number[]
- List of subscriber IDs of recipients. Messages can be sent to specific subscribers, with each subscriber assigned a unique subscriberId
.
subscribers: (number | string)[]
- List of recipient phone numbers or email addresses. A new subscriber will be created for new recipients that are not already subscribers on your account.
allSubscribers: boolean
- Flag to indicate send message to all subscribers if true
. When allSubscribers
is set to true
, no other recipient fields should be specified. Default value is false
.
groups: number[]
- List of group IDs of recipients. Messages can be sent to specific groups, with each group assigned a unique groupId
.
threadId: number
- Messages can be sent in reply to a thread, with each thread assigned a unique threadId
.
Content:
templateId: number
- Messages can be saved as pre-set message templates for reuse with saved controlled templates on your account assigned a templateId
.
Other fields:
linkId: number
- if a message contains a linkId
then this field is required. Links can be created with the .
When sending or scheduling a message, the /send
endpoint will compose the message body using the provided templateId
for a controlled template and, if required by the template, a provided linkId
. Links can be created with the /shortlinks
endpoint.
You can call GET /templates
to see all the available templates on your account:
To see the details on a specific template, you will need the {id}
of the template. Then call GET /templates/{id}
:
To make changes to a specific template, you will need the {id}
of the template. Then call PATCH /templates/{id}
with the body containing the new template data, message
is required.
Example request:
To remove a specific template, you will need the {id}
of the template, then call DELETE /templates/{id}
When creating a new template, the message
field is required to hold the content of the message.
Example request:
If your account is configured for template-only message sending, please use the Controlled Template endpoints below to view available templates:
Used when a reference can be null
isMMS
will default to false and a SMS template will be created unless an attachment
is provided. If name
is not provided, up to the first 32 characters of the message will be used as the name.
isMMS
will default to false and a SMS template will be created unless an attachment
is provided. If name
is not provided, up to the first 32 characters of the message will be used as the name.
Required Fields: message
Defaults:
isMMS
will default to false and a regular sms template will be created unless an attachment
is provided. If name
is not provided, up to the first 32 characters of the message will be used as the name.
undefined
The first item in the array must be the first item type and the second must be the second item type.