Templates Overview
Templates define the structure and content of your messages. Create templates once and reuse them across multiple campaigns.
What is a Template?
A template is a reusable message definition that includes:
- Content - The message text with optional placeholders
- Type - The message format (text, image, button, carousel, etc.)
- Channel - Viber or SMS
- Configuration - Additional settings like images, buttons, or survey options
Template Types
Viber Templates
Viber supports 8 message types:
| Type | Value | Description |
|---|---|---|
| SimpleText | 1 | Plain text message |
| ImageOnly | 2 | Image without text |
| ButtonPlusText | 3 | Text with a button |
| ImagePlusText | 4 | Image with text and button |
| Carousel | 5 | Swipeable cards (2-5 items) |
| Survey | 6 | Interactive poll (2-5 options) |
| Video | 7 | Video message |
| File | 8 | File attachment |
See Viber Templates for detailed documentation.
SMS Templates
SMS templates support plain text only with placeholders.
See SMS Templates for documentation.
Creating a Template
Basic Request
curl -X POST https://api.transformify.mk/api/v1/templates/viber \
-H "X-API-Key: your-api-key" \
-H "Content-Type: application/json" \
-d '{
"name": "Welcome Message",
"description": "Sent to new customers",
"messageType": 1,
"templateContent": "Hello {{name}}! Welcome to our service.",
"viberServiceId": 12345
}'
Response
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Welcome Message",
"description": "Sent to new customers",
"messageType": 1,
"channelType": "Viber",
"templateContent": "Hello {{name}}! Welcome to our service.",
"typeSpecificConfig": null,
"viberServiceId": 12345,
"smsFallbackEnabled": false,
"smsFallbackTemplateContent": null,
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-15T10:30:00Z"
}
Template Properties
| Property | Required | Description |
|---|---|---|
| name | Yes | Unique name for the template |
| description | No | Optional description |
| messageType | Yes | Type of message (1-8 for Viber) |
| templateContent | Yes | Message text with placeholders |
| viberServiceId | Yes* | Viber service ID (*Viber only) |
| typeSpecificConfig | Depends | Additional config based on type |
Managing Templates
List Templates
curl -X GET "https://api.transformify.mk/api/v1/templates?page=1&pageSize=20" \
-H "X-API-Key: your-api-key"
Response:
{
"templates": [
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Welcome Message",
"description": "Sent to new customers",
"messageType": 1,
"channelType": "Viber",
"templateContent": "Hello {{name}}! Welcome to our service.",
"smsFallbackEnabled": false,
"smsFallbackTemplateContent": null,
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-15T10:30:00Z"
}
],
"totalCount": 1,
"page": 1,
"pageSize": 20,
"totalPages": 1
}
Get Template by ID
curl -X GET "https://api.transformify.mk/api/v1/templates/{id}" \
-H "X-API-Key: your-api-key"
Update Template
curl -X PUT "https://api.transformify.mk/api/v1/templates/{id}" \
-H "X-API-Key: your-api-key" \
-H "Content-Type: application/json" \
-d '{
"name": "Updated Welcome Message",
"templateContent": "Hi {{name}}! Welcome aboard.",
"messageType": 1,
"viberServiceId": 12345
}'
Delete Template
curl -X DELETE "https://api.transformify.mk/api/v1/templates/{id}" \
-H "X-API-Key: your-api-key"
Viber Service ID
To send Viber messages, you need a Viber Service ID. This represents your registered Viber business account.
Get your available Viber services:
curl -X GET "https://api.transformify.mk/api/v1/viber-services" \
-H "X-API-Key: your-api-key"
Response:
[
{ "id": 12345, "brandName": "My Brand" },
{ "id": 12346, "brandName": "Another Brand" }
]
Best Practices
- Use descriptive names - Make templates easy to identify
- Add descriptions - Document the purpose of each template
- Test before production - Verify templates work correctly
- Version control - Keep track of template changes
- Reuse templates - Create generic templates with placeholders