Docs / Templates

Notification Templates

Define once, render everywhere. Templates adapt to each channel automatically — HTML for email, plain text for SMS, rich cards for push.

Template Structure

payment-received.yaml
id: payment-received
name: Payment Received
category: transactions

channels:
  email:
    subject: "You received {{amount}} from {{sender}}"
    body: "templates/payment-received.html"
  sms:
    body: "{{sender}} sent you {{amount}}. Ref: {{ref}}"
  push:
    title: "Payment received"
    body: "{{amount}} from {{sender}}"
    action_url: "/transactions/{{transaction_id}}"
  whatsapp:
    template_name: "payment_notify"
    params: [amount, sender, ref]

variables:
  amount: { type: string, required: true }
  sender: { type: string, required: true }
  ref: { type: string, required: true }
  transaction_id: { type: string }

Key Concepts

Variables

Handlebars-style interpolation ({{var}}). Type-checked at send time. Missing required variables return 400.

Localization

Add locale variants: payment-received.fr.yaml. Dispatch picks the right one based on user preference or Accept-Language.

Channel Adaptation

Each channel block is independent. Email gets HTML, SMS gets 160-char text, push gets title + body. One template ID triggers all.

Version Control

Templates are YAML files. Store them in git. Push changes via API or CI/CD. Rollback = git revert.

Template API

GET/v1/templates
GET/v1/templates/:id
POST/v1/templates
PUT/v1/templates/:id
DELETE/v1/templates/:id
POST/v1/templates/:id/preview