Email Templates
Create reusable email templates with variable substitution.
Create a Template
bash
curl -X POST https://api-dispatch.techtranslab.com/api/v1/templates \
-H "Authorization: Bearer your-jwt" \
-H "Content-Type: application/json" \
-d '{
"name": "Welcome Email",
"subject": "Welcome, {{name}}!",
"html": "<h1>Hello {{name}}</h1><p>Click <a href=\"{{action_url}}\">here</a> to get started.</p>"
}'Template Variables
Use syntax in subject and body. Variables are replaced at send time.
json
{
"template_id": "tmpl_abc123",
"variables": {
"name": "Alice",
"action_url": "https://example.com/confirm",
"company": "Acme Inc"
}
}Preview
Preview a template with sample data before sending:
bash
curl -X POST https://api-dispatch.techtranslab.com/api/v1/templates/preview \
-H "Authorization: Bearer your-jwt" \
-d '{
"template_id": "tmpl_abc123",
"variables": { "name": "Test User" }
}'A/B Testing
Create experiments to test different template variations:
bash
curl -X POST https://api-dispatch.techtranslab.com/api/v1/experiments \
-H "Authorization: Bearer your-jwt" \
-d '{
"name": "Subject Line Test",
"template_a_id": "tmpl_abc",
"template_b_id": "tmpl_def",
"split_ratio": 50
}'View experiment statistics:
bash
curl https://api-dispatch.techtranslab.com/api/v1/experiments/{id}/stats \
-H "Authorization: Bearer your-jwt"