Skip to content

/templates

Templates are reusable message formats with variable substitution. Create templates in the dashboard or via the API, then reference them when sending notifications.

GET https://api.smooven.io/v1/templates

GET https://api.smooven.io/v1/templates/{template_id}

POST https://api.smooven.io/v1/templates

PUT https://api.smooven.io/v1/templates/{template_id}

DELETE https://api.smooven.io/v1/templates/{template_id}


POST /v1/templates
{
"name": "order_confirmation",
"channel": "email",
"subject": "Order {{order_id}} confirmed",
"html": "<h1>Thanks, {{customer_name}}!</h1><p>Your order {{order_id}} for {{total}} has been confirmed.</p>",
"text": "Thanks, {{customer_name}}! Your order {{order_id}} for {{total}} has been confirmed."
}

Use double curly braces for variable substitution: {{variable_name}}. Variables are replaced at send time with values from the variables object in the notification request.

POST /v1/agent/notify
{
"channel": "email",
"to": "customer@example.com",
"email": {
"from": "orders@yourdomain.com",
"template_id": "tmpl_order_confirmation",
"variables": {
"customer_name": "Sarah",
"order_id": "ORD-5678",
"total": "$99.00"
}
}
}

A single template can define content for multiple channels. Smooven uses the version matching the selected delivery channel:

POST /v1/templates
{
"name": "appointment_reminder",
"variants": {
"sms": {
"message": "Reminder: {{appointment_type}} at {{time}} tomorrow. Reply CANCEL to reschedule."
},
"email": {
"subject": "Appointment reminder: {{appointment_type}}",
"html": "<h1>Your {{appointment_type}} is tomorrow</h1><p>Time: {{time}}</p><p>Location: {{location}}</p>"
},
"push": {
"title": "Appointment tomorrow",
"body": "{{appointment_type}} at {{time}}"
}
}
}