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 {{1}}, your order {{2}} has been confirmed."
      }
    ],
    "params": [
      { "type": "TEXT", "name": "1", "example": "John" },
      { "type": "TEXT", "name": "2", "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": "[email protected]",
  "category": "TRANSACTIONAL",
  "status": "PENDING",
  "params": [
    { "type": "TEXT", "name": "{{1}}", "example": "John" },
    { "type": "TEXT", "name": "{{2}}", "example": "ORD-12345" }
  ],
  "body": [
    { "language": "en", "template": "Hello {{1}}, your order {{2}} 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.

    Senders page showing the sender list with the Create a Template button.
  3. Select the template type: Transactional template or OTP template.

    Template type selection showing Transactional template and OTP template options.
  4. In the Design tab, enter the message content (maximum 875 characters).

    Design tab where you enter the transactional template message content.
  5. In the Parameters tab, create the parameters (maximum 5). Separate consecutive parameters with at least 3 non-whitespace, non-punctuation characters.

    Parameters tab showing the list of created parameters.
  6. Insert parameters into the message body using the curly brace icon.

    Curly brace icon used to insert parameters into the message body.
  7. Select the required parameter from the list.

    Parameter selection list showing available parameters.
  8. Select Register Template. The confirmation screen displays the Template ID.

    Template registration confirmation screen showing the generated Template ID.
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 {{1}}, your order {{2}} has been confirmed." }
  ],
  "params": [
    { "type": "TEXT", "name": "{{1}}", "example": "John" },
    { "type": "TEXT", "name": "{{2}}", "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.

    Senders page showing the View Templates button for a sender.
  3. View the template ID, status, and creation date for each submitted template.

    Templates list showing template ID, status, and creation date.
  4. To view the template text, select the expand icon next to the template.

    Expanded template rows showing the submitted template text.


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: {{1}} becomes "1", {{orderNum}} becomes "orderNum".

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, {{1}} becomes "1")

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": {
            "1": "John",
            "2": "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.

    Web interface navigation showing the Broadcast menu option.
  2. Select Create Broadcast.

    Broadcast page with the Create Broadcast button in the upper right corner.
  3. Select Viber as the channel. To switch channels, select the channel name.

    Channel selection showing Viber selected as the broadcast channel.
  4. Add recipients by profile name, phone number, tag, or segment. Select the sender.

    Recipients and sender selection fields in the broadcast setup.
  5. Under Content, select the content area.

    Content section of the broadcast setup.
  6. From the Message Content list, select Template.

    Message Content list with Template option selected.
  7. Enter the Template ID. The system displays the template content and required parameters.

    Template ID field showing the template content and parameters after entry.
  8. Enter a value for each parameter. To insert attributes from an uploaded file or the People module, select the curly brace icon.

    Parameter value fields with the curly brace icon for inserting attributes.
  9. Select Done Designing.

    Done Designing button in the lower right corner of the content editor.
  10. Select Continue to Preview.

    Continue to Preview button for reviewing the broadcast setup.
  11. Review the broadcast setup, then select Launch.

    Launch button to send the broadcast.


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: {{1}} becomes "1", {{orderNum}} becomes "orderNum".
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