Skip to main content
POST
/
v1
/
templates
Create Template
curl --request POST \
  --url https://api.zavu.dev/v1/templates \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "<string>",
  "category": "<string>",
  "body": "<string>",
  "channels": [
    {}
  ],
  "variables": [
    {}
  ],
  "whatsapp": {
    "whatsapp.templateName": "<string>",
    "whatsapp.namespace": "<string>"
  }
}'
{
  "id": "tpl_abc123",
  "name": "order_confirmation",
  "category": "transactional",
  "body": "Hi {{name}}, your order #{{orderId}} has been confirmed!",
  "variables": ["name", "orderId"],
  "channels": ["sms", "whatsapp"],
  "createdAt": "2024-01-15T10:00:00.000Z",
  "updatedAt": "2024-01-15T10:00:00.000Z"
}
Create a reusable message template with variable placeholders.

Request

name
string
required
Unique template name (e.g., order_confirmation)
category
string
required
Template category: transactional, marketing, or alert
body
string
required
Template content with {{variable}} placeholders
channels
array
Supported channels: ["sms", "whatsapp"]. Defaults to both.
variables
array
List of variable names. Auto-detected from body if not provided.
whatsapp
object
WhatsApp-specific configuration for pre-approved templates

Response

{
  "id": "tpl_abc123",
  "name": "order_confirmation",
  "category": "transactional",
  "body": "Hi {{name}}, your order #{{orderId}} has been confirmed!",
  "variables": ["name", "orderId"],
  "channels": ["sms", "whatsapp"],
  "createdAt": "2024-01-15T10:00:00.000Z",
  "updatedAt": "2024-01-15T10:00:00.000Z"
}

Example

curl -X POST https://api.zavu.dev/v1/templates \
  -H "Authorization: Bearer zv_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "order_confirmation",
    "category": "transactional",
    "body": "Hi {{name}}, your order #{{orderId}} has been confirmed!"
  }'

Variable Syntax

Use double curly braces for variables:
Hi {{name}}, your order #{{orderId}} has been confirmed!
Variables are automatically extracted from the template body. When sending a message with this template, provide the values in the data object:
{
  "templateId": "tpl_abc123",
  "data": {
    "name": "John",
    "orderId": "12345"
  }
}