CTRLK

Shared components

Use Viber message templates

|

View as Markdown

Viber message templates allow you to send pre-approved transactional notifications and one-time passwords (OTP) to end users at scale.

IMPORTANT

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.

NOTE

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:

  1. Log in and go to Channels and Numbers > Channels > Viber for Business.
  2. Select the Senders tab.
  3. Select the sender, then select Create a Template.
  4. Select the template category: Transactional or OTP.
  5. In the Design tab, enter the message content and insert parameters using the curly brace icon.
  6. 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.

MethodPathSuccessDescription
POST/viber/1/senders/{sender}/templates201 CreatedRegister a new transactional or OTP template for your sender.
GET/viber/1/senders/{sender}/templates/{templateId}200 OKRetrieve a template and its approval status.
POST/viber/2/messages200 OKSend an approved template to one or more recipients.
DELETE/viber/1/senders/{sender}/templates/{templateId}204 No ContentPermanently 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.



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 8 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 {{pin}} placeholder 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.

ConstraintValue
Maximum total length1000 characters, including all parameter values.
Maximum parameters8
Variables at the startThe template body must begin with at least one non-placeholder character.
Variables back-to-backConsecutive placeholders must be separated by at least one space. Example: {{firstName}} {{lastName}} is allowed.
Variables at the end

Non-OTP templates cannot end with a placeholder. Add a space after the final placeholder, followed by at least one non-space character.

  • Hi {{firstName}} . is allowed. A space separates the placeholder from the period.
  • Hi {{firstName}} is not allowed. The template ends with a placeholder.
  • Hi {{firstName}}. is not allowed. No space separates the placeholder from the period.
NOTE

Add the space before the punctuation mark, not only after the placeholder. Without the space, Viber treats the punctuation mark as part of the placeholder value, which puts a placeholder at the end of the template and causes template creation to fail. This rule does not apply to OTP templates, which can end with the {{pin}} placeholder.

Per-parameter value lengthEach parameter value must not exceed 125 characters.
OTP parametersOTP templates must include a placeholder named {{pin}} and are allowed to end with that same placeholder. Example: Your verification code is {{pin}} is allowed.


Template statuses

After creation, templates go through an approval process. The following statuses indicate where a template is in that process.

StatusMeaningAction
PENDINGAwaiting reviewWait and poll again. Send only after the status changes to APPROVED.
APPROVEDPassed review and ready to useProceed to send.
DECLINEDDid not pass reviewReview the template text against the compliance guidelines and create a revised template.
NOTE

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.