Use Viber message templates
Viber message templates allow you to send pre-approved transactional notifications and one-time passwords (OTP) to end users at scale.
Template management endpoints (/viber/1/senders/{sender}/templates) are in Early Access. Your account must have the viber-bm:manage scope enabled before you can use these endpoints. Contact your Infobip account manager to enable the scope.
Create and register a Viber message template
You can create and register a Viber message template using the web interface or the Viber Business Messages API.
To ensure template approval, follow the constraints listed in Template body constraints and the compliance guidelines.
Message templates over the web interface
To create and register a Viber message template in the web interface:
- Log in and go to Channels and Numbers > Channels > Viber for Business.
- Select the Senders tab.
- Select the sender, then select Create a Template.
- Select the template category: Transactional or OTP.
- In the Design tab, enter the message content and insert parameters using the curly brace icon.
- Select Register Template and save the generated Template ID.
To view submitted templates, select View Templates for the sender on the Senders tab.
For detailed steps with screenshots, see Create and send templates.
Message templates over the API
Using the Viber Business Messages API, you can create, retrieve, send, and delete your templates.
| Method | Path | Success | Description |
|---|---|---|---|
| POST | /viber/1/senders/{sender}/templates | 201 Created | Register a new transactional or OTP template for your sender. |
| GET | /viber/1/senders/{sender}/templates/{templateId} | 200 OK | Retrieve a template and its approval status. |
| POST | /viber/2/messages | 200 OK | Send an approved template to one or more recipients. |
| DELETE | /viber/1/senders/{sender}/templates/{templateId} | 204 No Content | Permanently remove a template. |
All endpoints accept the following authentication methods: API key header (Authorization: App {api-key}), API key query parameter, HTTP Basic, or OAuth 2.0. For details, see API authentication.
For full endpoint specifications, see the Viber Business Messages API reference (opens in a new tab).
Template categories
There are two message template categories available, depending on your use case.
Transactional
Send non-OTP notifications such as order confirmations, delivery updates, and appointment reminders. Transactional templates support up to 5 named parameters for personalization.
For step-by-step instructions, see Transactional templates.
OTP
Send one-time passwords and verification codes for authentication flows. OTP templates must include a parameter named {{pin}} in the template body.
For step-by-step instructions, see Create and send templates.
Template body constraints
The following table describes the constraints that apply to all template categories.
| Constraint | Value |
|---|---|
| Maximum body length | 875 characters |
| Maximum parameters | 5 |
| Separator rule | At least 3 non-whitespace, non-punctuation characters must appear between any two consecutive placeholders. Short prepositions such as "at", "to", or "on" (2 characters) cause rejection. |
| Ending rule | At least 3 non-punctuation characters must follow the last placeholder. Currency symbols and punctuation alone are not sufficient. |
| Per-variable character limit | Each placeholder value must not exceed 25 characters at send time. |
| Last word restriction | The last word of the template body cannot be a placeholder. |
| OTP required parameter | OTP templates must include a parameter named {{pin}}. |
Template statuses
After creation, templates go through an approval process. The following statuses indicate where a template is in that process.
| Status | Meaning | Action |
|---|---|---|
| PENDING | Awaiting review | Wait and poll again. Send only after the status changes to APPROVED. |
| APPROVED | Passed review and ready to use | Proceed to send. |
| DECLINED | Did not pass review | Review the template text against the compliance guidelines and create a revised template. |
Approval typically completes within seconds but can take up to 24 hours. Common decline reasons include the last word being a placeholder or the content containing promotional material.
Supported languages
Templates support 40 languages. Specify the language code when creating a template.