Viber
Viber Business Messages
Message types and templates
Create and send templates

Create and send templates

Copy as markdown

|

View as Markdown

Viber Business Messages transactional and OTP templates allow you to send pre-approved notifications and verification codes to end users through Viber. Use the Infobip API or the web interface to create templates, check approval status, send template messages, and delete templates that are no longer needed.

Transactional templates are for notifications such as order confirmations, delivery updates, and appointment reminders. OTP templates are for authentication flows, verification codes, and any scenario that requires delivering a single-use PIN to the end user.

Before you begin, verify the following:

  • Your account has the viber-bm:manage scope enabled. Contact your Infobip account manager to enable the scope.
  • You have an approved Viber sender. To register a sender, see Get started with Viber Business Messages.

For template body constraints, supported languages, and approval statuses, see Viber message templates.



Create a template

To create a transactional or OTP template, send a POST request to the template registration endpoint (opens in a new tab):

POST /viber/1/senders/{sender}/templates

Replace {sender} with your approved Viber sender name.

Rate limit: 25 requests per second.


Create a transactional template

curl -X POST "https://{baseUrl}/viber/1/senders/{sender}/templates" \
  -H "Authorization: App {api-key}" \
  -H "Content-Type: application/json" \
  -d '{
    "category": "TRANSACTIONAL",
    "body": [
      {
        "language": "en",
        "template": "Hello {{firstname}}, your order {{orderno}} has been confirmed."
      }
    ],
    "params": [
      { "type": "TEXT", "name": "firstname", "example": "John" },
      { "type": "TEXT", "name": "orderno", "example": "ORD-12345" }
    ]
  }'

Create an OTP template

IMPORTANT

OTP templates must include a parameter named {{pin}} in the template body. Templates without this parameter are rejected during creation.

curl -X POST "https://{baseUrl}/viber/1/senders/{sender}/templates" \
  -H "Authorization: App {api-key}" \
  -H "Content-Type: application/json" \
  -d '{
    "category": "OTP",
    "body": [
      {
        "language": "en",
        "template": "Your verification code is {{pin}}. Valid for 5 minutes."
      }
    ],
    "params": [
      { "type": "TEXT", "name": "pin", "example": "123456" }
    ]
  }'

A successful request returns 201 Created with the template details:

{
  "templateId": "a1b2c3d4-0000-0000-0000-000000000000",
  "version": "1",
  "sender": "YourSender",
  "createdAt": 1677628800000,
  "creator": "jane.doe@example.com",
  "category": "TRANSACTIONAL",
  "status": "PENDING",
  "params": [
    { "type": "TEXT", "name": "firstname", "example": "John" },
    { "type": "TEXT", "name": "orderno", "example": "ORD-12345" }
  ],
  "body": [
    { "language": "en", "template": "Hello {{firstname}}, your order {{orderno}} has been confirmed." }
  ]
}
IMPORTANT

Save the templateId from the response. You need it to check approval status, send the template, and delete the template.


Create a template using the web interface

You can also create templates using the Infobip web interface. This method does not support language selection. To specify a language other than the default, use the API.

  1. In the web interface, go to Channels and Numbers > Channels > Viber for Business > Senders.

  2. Select the sender you want to create a template for, then select Create a Template.

    Infobip web interface Viber Business Messages Senders page with the Create a Template button next to an approved sender.
  3. Select the template type: Transactional template or OTP template.

    Viber Template Registration screen with OTP template and Transactional template category options.
  4. In the Design tab, enter the message content (maximum 875 characters).

    Viber transactional template Design tab with message content editor and mobile preview.
  5. In the Parameters tab, create the parameters (maximum 5). Separate consecutive parameters with at least 3 non-whitespace, non-punctuation characters.

    Viber transactional template Parameters tab with parameter name and example value fields.
  6. Insert parameters into the message body using the curly brace icon.

    Viber template Design tab showing the curly brace icon for inserting dynamic parameters into the message body.
  7. Select the required parameter from the list.

    Viber template parameter selection dropdown showing available parameters to insert into the message.
  8. Select Register Template. The confirmation screen displays the Template ID.

    Viber template registration confirmation showing the generated Template ID, category, and status.
NOTE

The web interface does not support language selection. To specify a language, use the API. Save the Template ID from the confirmation screen.



Confirm template approval

After you create a template, it enters PENDING status while it is reviewed for compliance. Approval can complete within seconds but can take up to 24 hours. Send the template only after it reaches APPROVED status.

For information about what causes templates to be declined, see Compliance guidelines.

Send a GET request to check the status:

curl -X GET "https://{baseUrl}/viber/1/senders/{sender}/templates/{templateId}" \
  -H "Authorization: App {api-key}"

An approved template returns:

{
  "templateId": "a1b2c3d4-0000-0000-0000-000000000000",
  "category": "TRANSACTIONAL",
  "status": "APPROVED",
  "body": [
    { "language": "en", "template": "Hello {{firstname}}, your order {{orderno}} has been confirmed." }
  ],
  "params": [
    { "type": "TEXT", "name": "firstname", "example": "John" },
    { "type": "TEXT", "name": "orderno", "example": "ORD-12345" }
  ]
}

The following table describes the possible template statuses.

StatusMeaningCan send?
PENDINGAwaiting reviewNo
APPROVEDReady to useYes
DECLINEDDid not pass review. Create a new template.No
NOTE

If the status is DECLINED, review your template text against the compliance guidelines and create a revised template. Common causes: the last word is a placeholder, or the content contains promotional material.


Check approval in the web interface

  1. In the web interface, go to Channels and Numbers > Channels > Viber for Business > Senders.

  2. Select View Templates for the sender you want to check.

    Infobip Viber Business Messages Senders page with the View Templates button highlighted next to a sender.
  3. View the template ID, status, and creation date for each submitted template.

    Viber transactional templates list showing Template ID, approval status, and creation date for each submitted template.
  4. To view the template text, select the expand icon next to the template.

    Expanded Viber template rows showing the submitted template text with highlighted placeholder parameters.


Send a template message

After the template reaches APPROVED status, send a message using the template to one or more recipients. Use the POST /viber/2/messages endpoint and set content.type to "TEMPLATE".

For the full endpoint specification, see the Viber Business Messages API reference (opens in a new tab).

When building the parameters object, strip the double curly braces from the placeholder name to form the key: {{firstname}} becomes "firstname", {{orderno}} becomes "orderno".

The following table describes the content object fields.

FieldTypeRequiredDescription
typestringYesMust be "TEMPLATE"
templateIdstringYesThe ID returned when the template was created
languagestringYesISO language code from the supported languages list
parametersobjectYesKey-value pairs where each key is the placeholder name without curly braces (for example, {{firstname}} becomes "firstname")

Send a transactional template message

curl -X POST "https://{baseUrl}/viber/2/messages" \
  -H "Authorization: App {api-key}" \
  -H "Content-Type: application/json" \
  -d '{
    "messages": [
      {
        "sender": "{sender}",
        "destinations": [ { "to": "385981234568" } ],
        "content": {
          "type": "TEMPLATE",
          "templateId": "a1b2c3d4-0000-0000-0000-000000000000",
          "language": "en",
          "parameters": {
            "firstname": "John",
            "orderno": "ORD-12345"
          }
        }
      }
    ]
  }'

Send an OTP template message

For OTP templates, the parameters object must contain the key "pin" (without curly braces) mapped to the actual one-time password value.

curl -X POST "https://{baseUrl}/viber/2/messages" \
  -H "Authorization: App {api-key}" \
  -H "Content-Type: application/json" \
  -d '{
    "messages": [
      {
        "sender": "{sender}",
        "destinations": [ { "to": "385981234568" } ],
        "content": {
          "type": "TEMPLATE",
          "templateId": "b2c3d4e5-0000-0000-0000-000000000001",
          "language": "en",
          "parameters": { "pin": "847291" }
        }
      }
    ]
  }'
NOTE

Broadcast is intended for testing OTP templates. In production, send OTP messages programmatically through the API in response to user-initiated authentication events.


Send a template message using Broadcast

  1. In the web interface, go to Broadcast.

    Infobip web interface side navigation with the Broadcast menu option highlighted.
  2. Select Create Broadcast.

    Infobip Broadcast page showing existing broadcasts and the Create Broadcast button.
  3. Select Viber as the channel. To switch channels, select the channel name.

    Broadcast channel selector with Viber selected, showing Recipients, Sender, and Content fields.
  4. Add recipients by profile name, phone number, tag, or segment. Select the sender.

    Viber broadcast setup with recipients added by profile name and segment, and sender selected.
  5. Under Content, select the content area.

    Viber broadcast Content section with the Select to create content placeholder.
  6. From the Message Content list, select Template.

    Viber broadcast Message Content type selector with Text, Image, Video, File, List, Carousel, and Template options.
  7. Choose the template you want to use from the list of Approved Templates.

    Select a Viber template screen listing approved transactional and OTP templates by Template ID, Category, and Use button.
  8. Enter values for the required Parameters. To insert Attributes (from an uploaded Excel file or the Infobip People module), select the curly brace icon in the parameter field.

    Viber broadcast template Parameters tab with FirstName, Amount, and MerchantName fields and curly brace icon for inserting People attributes.
  9. When you are satisfied with the parameter values, select Done Designing.

    Viber broadcast template editor with parameter values filled in and the Done Designing button highlighted.
  10. When you are done updating the required settings, select Continue to Preview.

    Viber broadcast setup showing recipients, sender, populated template content preview, and the Continue to Preview button.
  11. Review the broadcast setup, then select Launch.

    Viber broadcast preview page showing broadcast summary, recipient count, deliverable destinations, and the Launch button.


Delete a template (API only)

Delete a template when it is no longer needed. Template deletion is available only through the API. The web interface does not support template deletion.

To delete a template, send a DELETE request:

Rate limit: 10 requests per minute.

curl -X DELETE "https://{baseUrl}/viber/1/senders/{sender}/templates/{templateId}" \
  -H "Authorization: App {api-key}"

A successful deletion returns 204 No Content with no response body.

IMPORTANT

Deleted templates cannot be recovered. Use a unique template ID for each new template.



Troubleshooting

The following table describes common errors and how to resolve them. For additional information about Viber message delivery, see Reports and insights.

IssueCauseResolution
401 UnauthorizedMissing or incorrect API key, or the viber-bm:manage scope is not enabledVerify the API key in the web interface under Developers > API keys. Confirm the viber-bm:manage scope is active with your account manager.
403 ForbiddenSender is not registered, or the API key does not have permission for that senderConfirm the sender under Channels and Numbers > Viber for Business > Senders.
Template status stays PENDINGApproval is asynchronous and can take up to 24 hoursPoll the GET endpoint at intervals. If the template remains PENDING after 24 hours, contact Infobip Support.
Template status is DECLINEDTemplate text did not meet Viber guidelines. Common causes: the last word is a placeholder, or the content contains promotional material.Review the compliance guidelines and create a revised template.
400 Bad Request when sendingThe templateId does not exist, the template is not APPROVED, or the language value is incorrectConfirm template status with the GET endpoint before sending.
Parameters not resolving in the sent messageParameter keys in the parameters object do not match the placeholder namesStrip curly braces to form the key: {{firstname}} becomes "firstname", {{orderno}} becomes "orderno".
400 Bad Request on OTP template creationThe {{pin}} parameter is missing from the template bodyOTP templates require a parameter named {{pin}}. Add it to the template body and retry.
OTP not delivered to recipientThe "pin" key in the parameters object does not match the placeholder name, or the template is not APPROVEDConfirm that the parameters object uses "pin" (without curly braces) as the key. Verify the template status is APPROVED before sending.

For API authentication details, see API authentication.








Need assistance

Explore Infobip Tutorials

Encountering issues

Contact our support

What's new? Check out

Release Notes

Unsure about a term? See

Glossary
Service status

Copyright @ 2006-2026 Infobip ltd.

Service Terms & ConditionsPrivacy policyTerms of use