Skip to main content

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:

TypeValueDescription
SimpleText1Plain text message
ImageOnly2Image without text
ButtonPlusText3Text with a button
ImagePlusText4Image with text and button
Carousel5Swipeable cards (2-5 items)
Survey6Interactive poll (2-5 options)
Video7Video message
File8File 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

PropertyRequiredDescription
nameYesUnique name for the template
descriptionNoOptional description
messageTypeYesType of message (1-8 for Viber)
templateContentYesMessage text with placeholders
viberServiceIdYes*Viber service ID (*Viber only)
typeSpecificConfigDependsAdditional 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

  1. Use descriptive names - Make templates easy to identify
  2. Add descriptions - Document the purpose of each template
  3. Test before production - Verify templates work correctly
  4. Version control - Keep track of template changes
  5. Reuse templates - Create generic templates with placeholders