Templates
Create reusable message templates with dynamic variables.
Templates let you create reusable messages with dynamic variables using Handlebars syntax.
Create a Template
POST https://api.senderz.com/v1/templates
{
"name": "otp_verify",
"channel": "both",
"type": "otp",
"body": "Your {{app_name}} verification code is {{code}}. Valid for {{minutes}} minutes."
}
Template Types
| Type | Behavior |
|---|---|
otp | High-priority delivery queue. Short messages. |
alert | Normal priority. Notifications and updates. |
marketing | Normal priority. Respects quiet hours and opt-outs. |
Using Variables
Variables use double curly braces: {{variable_name}}
When sending with a template, pass the variables in the data object:
{
"to": "+15551234567",
"template": "otp_verify",
"data": {
"app_name": "MyApp",
"code": "4821",
"minutes": "10"
}
}
Result: “Your MyApp verification code is 4821. Valid for 10 minutes.”
If a required variable is missing, the API returns 400 MISSING_TEMPLATE_VAR.
List Templates
GET https://api.senderz.com/v1/templates
Filter by type:
GET https://api.senderz.com/v1/templates?type=otp
Template Channels
imessage— Template only for iMessage deliverysms— Template only for SMS deliveryboth— Works with both channels (recommended)