All docs

Templates

Create reusable message templates with dynamic variables.

Templates let you create reusable messages with dynamic variables using Handlebars syntax.

Create a Template

POST /v1/templates

Create a new message template.

{
  "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 /v1/templates

List all templates for your account.

Filter by type:

GET https://api.senderz.com/v1/templates?type=otp

Template Channels

  • imessage — Template only for iMessage delivery
  • sms — Template only for SMS delivery
  • both — Works with both channels (recommended)