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

TypeBehavior
otpHigh-priority delivery queue. Short messages.
alertNormal priority. Notifications and updates.
marketingNormal 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 delivery
  • sms — Template only for SMS delivery
  • both — Works with both channels (recommended)