Create a reusable message template with variable placeholders.
Request
Unique template name (e.g., order_confirmation)
Template category: transactional, marketing, or alert
Template content with {{variable}} placeholders
Supported channels: ["sms", "whatsapp"]. Defaults to both.
List of variable names. Auto-detected from body if not provided.
WhatsApp-specific configuration for pre-approved templates
WhatsApp Business API template name
WhatsApp Business API namespace
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"
}
}