Viber for Business

Our business messaging API supports sending and receiving Viber for Business messages.

Being able to send Viber messages requires requesting access via the Channels portal. Without onboarding with Viber via the portal, you can not make use of this part of the API. Please be aware that Viber needs to verify the legitimacy of your business and your rationale for usage.

Fact Sheet

FeatureSupportRemarks
delivery notificationyesOccurs when your message is delivered to the Viber platform. Delivery notifications are sent to the status report webhooks.
text messagesyesThe maximum length of a message is 1000 characters.
Text formatting like bold, italics, monospace and strikethrough text are supported (see below).
mediayesMedia URL attributes should end in the proper file extension. Only one media file is allowed per message; when sending multiple files, each file will be sent in its own message. When the linked media doesn't exist/can't be found, the message will not be sent at all.
media: imagesyesMaximum file size for an uploaded image is 200 MB.
Supported formats: png, jpeg, jpg, gif.
media: audiono
media: videoyesMaximum file size for an uploaded video file is 200 MB.
Maximum duration of the video can be up to 10 minutes.
Supported formats: mp4.
Server which host the video must include 'Content-Length' in response header.
media: documentyesMaximum file size for an uploaded file is 200 MB.
Supported formats: doc(x), xls(x), csv, pdf.
suggestion as buttonyesOnly 1 button is possible
rich cardyesOnly 1 button is possible
templatesyesPredefined OTP templates, configurable with own variables.
carouselyesNumber of items from 2 to 5. Each item can have a image with expected formatspng, jpeg, jpg. Each item have two buttons ( one of them optional)
listyesNumber of items from 2 to 5

Sending messages

Viber is one of the few channels which uses telephone numbers as recipients. This allows SMS to be used as a fallback delivery channel if the recipient doesn't have the Viber app installed on their mobile device.

Please note that when defining fallback text, it is affected by the maximum size limitations of SMS as described in the section on SMS multipart messaging.

Text formatting

Viber allows the usage of formatting text following markdown guidelines:

FormatMarkdownText to be sentMessage appearance
BoldOne asterisk at each end of
the text: *
*This text will be bold*This text will be bold
ItalicsOne underscore at each end
of the text: _
_This text will be in italics_This text will be in italics
MonospaceThree backticks at each end
of the text: ```
```This text will be in monospace```This text will be in monospace
StrikethroughOne tilde at each end of the
text: ~
~This text will have a
strikethrough~
This text will have a strikethrough

URL requirements

Viber enquires the following requirements that apply to using (image) URLs

  • Only use secured HTTPS links
  • Make sure that image URLs are not protected by a captcha
  • Make sure the image URLs include file extensions (.mp4, .png, .jpeg)
  • Links to one of the following apps are not allowed
    • Facebook
    • Instagram
    • Line
    • Signal
    • Telegram
    • WhatsApp

Text

The example below will send a simple text-only Viber message.

{
    "messages": {
        "msg": [
            {
                "from": "Your Sender",
                "to": [
                    {
                        "number": "Phone number recipient"
                    }
                ],
                "allowedChannels": [
                    "Viber"
                ],
                "body": {
                    "type": "auto",
                    "content": ""
                },
                "richContent": {
                    "conversation": [
                        {
                            "text": "Be part of it."
                        }
                    ]
                }
            }
        ]
    }
}

Media

The following media types are supported:

Media typeSupported formatsMimetypeSupported size maximum
Imagepng, jpeg, gifimage/png, image/jpeg, image/gif200MB
Videomp4video/mp4200MB
Documentdoc(x), xls(x), csv, txt, pdfapplication/msword, application/vnd.ms-excel, text/csv, text/plain, application/pdf200MB

Direct message with text and image

In the example below we send a simple rich content message that contains both text and an image.

{
  "messages": {
    "msg": [
      {
        "from": "Your sender",
        "to": [
          {
            "number": "Phone number"
          }
        ],
        "allowedChannels": [
          "Viber", "SMS"
        ],
        "body": {
          "type": "auto",
          "content": "SMS fallback Text"
        },
        "richContent": {
          "conversation": [
            {
              "text": "CM.com - Be part of it.",
              "media": {
                "mediaUri": "https://www.cm.com/cdn/cm/cm.png",
                "mimeType": "image/png",
                "mediaName": "cm.png"
              }
            }
          ]
        }
      }
    ]
  }
}

Direct message with text and video

In the example below we send a simple rich content message that contains both text and a video.

{
  "messages": {
    "msg": [
      {
        "from": "Your sender",
        "to": [
          {
            "number": "Phone number"
          }
        ],
        "allowedChannels": [
          "Viber", "SMS"
        ],
        "body": {
          "type": "auto",
          "content": "SMS fallback Text"
        },
        "richContent": {
          "conversation": [
            {
              "text": "CM.com - Be part of it.",
              "media": {
                "mediaUri": "your-video-url.mp4",
                "mimeType": "video/mp4",
                "mediaName": "your-video.mp4"
              }
            }
          ]
        }
      }
    ]
  }
}

Direct message with document

In the example below we send a simple rich content message that contains a document.

{
  "messages": {
    "msg": [
      {
        "from": "Your sender",
        "to": [
          {
            "number": "Phone number"
          }
        ],
        "allowedChannels": [
          "Viber", "SMS"
        ],
        "body": {
          "type": "auto",
          "content": "SMS fallback Text"
        },
        "richContent": {
          "conversation": [
            {
              "text": "CM.com - Be part of it.",
              "media": {
                "mediaUri": "your-document.pdf",
                "mimeType": "application/pdf",
                "mediaName": "your-document.pdf"
              }
            }
          ]
        }
      }
    ]
  }
}

Suggestion

Suggestions provide a way to present a button in your message the user can press to perform an action. Only 1 button per message is supported.

The following actions are supported by Viber as rich card buttons.

ActionRemarks
OpenURLMaximum length of label is 30 characters, url required.
DialMaximum length of label is 30 characters, phone number required.

The following restrictions apply for a suggestion:

FieldRequiredRemarks
labelYesMaximum length is 30 characters.
urlOnly for OpenURLMust be a valid URL
phoneNumberOnly for DialMust be a valid phone number

Message with open url action

In the example below, we send a simple rich content message that contains elements that Viber will display as an open URL action.

{
  "messages": {
    "msg": [
      {
        "from": "Your sender",
        "to": [
          {
            "number": "Phone number"
          }
        ],
        "allowedChannels": [
          "Viber", "SMS"
        ],
        "body": {
          "type": "auto",
          "content": "SMS fallback Text"
        },
        "richContent": {
          "conversation": [
            {
              "text": "CM.com - Be part of it.",
              "suggestions": [
                {
                  "action": "OPENURL",
                  "label": "Visit CM.com",
                  "url": "https://www.cm.com/",
                  "postbackdata": "WEBSITE"
                }
              ]
            }
          ]
        }
      }
    ]
  }
}

Message with dial action

In the example below, we send a simple rich content message that contains elements that Viber will display as an dial action.

{
  "messages": {
    "msg": [
      {
        "from": "Your sender",
        "to": [
          {
            "number": "Phone number"
          }
        ],
        "allowedChannels": [
          "Viber", "SMS"
        ],
        "body": {
          "type": "auto",
          "content": "SMS fallback Text"
        },
        "richContent": {
          "conversation": [
            {
              "text": "CM.com - Be part of it.",
              "suggestions": [
                {
                  "action": "DIAL",
                  "label": "Call us",
                  "dial": {
                  	"phoneNumber": "0031612345678"
                  },
                  "postbackdata": "DIAL"
                }
              ]
            }
          ]
        }
      }
    ]
  }
}

Rich card

Rich cards offer a way for you to offer a richer in-conversation experience than standard text messages by integrating buttons, images and more alongside text in a single message. Rich cards can be used for many purposes, such as displaying product information or asking the message recipient to choose from a pre-determined set of options.

The following restrictions apply for using a rich card:

FieldRequiredRemarks
headerYesDisplayed as the title. Maximum length is 30 characters.
textNoDisplayed as the subtitle. Maximum length is 900 characters.
mediaUriNoThe URL of the image to display.
suggestionsNoSuggestions as buttons. Maximum of 1 button per card.

The following actions are supported by Viber as rich card buttons.

ActionRemarks
OpenURLMaximum length of label is 30 characters, url required.
DialMaximum length of label is 30 characters, phone number required.

In the example below we send a rich content message that contains rich card properties. The rich card is composed of a title, a subtitle, a media image and a suggestion.

{
  "messages": {
    "msg": [
      {
        "from": "Your sender",
        "to": [
          {
            "number": "Phone number"
          }
        ],
        "allowedChannels": [
          "Viber", "SMS"
        ],
        "body": {
          "type": "auto",
          "content": "SMS fallback Text"
        },
        "richContent": {
          "conversation": [
            {
              "header": "We are CM.com!",
              "text": "Visit our website or start a chat with one of our employee's!",
              "media": {
                "mediaUri": "https://www.cm.com/cdn/cm/cm.png",
                "mimeType": "image/png",
                "mediaName": "cm.png"
              },
              "suggestions": [
                {
                  "action": "OPENURL",
                  "label": "Visit our website!",
                  "url": "https://www.cm.com",
                  "postbackdata": "WEBSITE"
                }
              ]
            }
          ]
        }
      }
    ]
  }
}

Carousel

Carousel messages offer a way for you to send a single message featuring text and multiple customizable sections (items), each showcasing different products or services along with dedicated media and call-to-action.

The following restrictions apply for using a rich card:

FieldRequiredRemarks
textYesMessage text. Up to 1000 characters. Recommended length is 200 characters.
itemsYesFrom 2 to 5 items.
items titleYesItem title text. From 2 to 38 characters.
mediaUriYesThe URL of the image to display. One per item.
suggestionsYesMaximum 2 suggestions per item. One of them optional.

The following actions are supported by Viber as rich card buttons.

ActionRemarks
OpenURLMaximum length of label is 30 characters, url required.
DialMaximum length of label is 30 characters, phone number required.

The following restrictions apply for suggestions

FieldRequiredRemarks
labelYesMaximum length is 10 characters. Optional suggestion maximum 12 characters.
urlOnly for OpenURLMust be a valid URL

In the example below we send a rich content message that contains a carousel with two items. Each item is composed of a title, a media image and a two suggestions.

{
    "messages": {
        "msg": [
            {
                "from": "",
                "to": [
                    {
                        "number": ""
                    }
                ],
                "body": {
                    "content": ""
                },
                "allowedChannels": [
                    "Viber"
                ],
                "richContent": {
                    "conversation": [
                        {
                            "carousel": {
                                "cards": [
                                    {
                                        "text": "Visit our website or start a chat!",
                                        "media": {
                                            "mediaUri": "your-image.png"
                                        },
                                        "suggestions": [
                                            {
                                                "action": "OpenUrl",
                                                "label": "CM.com",
                                                "url": "https://cm.com"
                                            }
                                        ]
                                    },
                                    {
                                        "text": "Channels we support!",
                                        "media": {
                                            "mediaUri": "your-image.png"
                                        },
                                        "suggestions": [
                                            {
                                                "action": "OpenUrl",
                                                "label": "WhatsApp",
                                                "url": "https://www.cm.com/whatsapp/"
                                            },
                                            {
                                                "action": "OpenUrl",
                                                "label": "Viber",
                                                "url": "https://www.cm.com/viber"
                                            }
                                        ]
                                    }
                                ]
                            }
                        }
                    ]
                }
            }
        ]
    }
}

List

List messages offer a way to present users with a question and 2-5 answers from which they can select one. Once a user selects an item, it will be highlighted as selected, and the corresponding item text will be sent from the user to you as a reply. After making a selection, the user is able to change it. If the selection is changed, an additional message will be sent on the user's behalf to you.

List messages supports text formatting and emojis. Links are not supported.

FieldRequiredRemarks
textYesMessage text. Up to 85 UTF-8 character.
suggestionsYesNumber of items, between 2 and 5.

For each suggestion item, the following restrictions apply:

FieldRequiredRemark
labelYesUp to 50 UTF-8 characters per item
actionYesAlways needs to be "Reply"

In the example below we send a list message that contains two items.

{
    "messages": {
        "msg": [
            {
                "from": "",
                "to": [
                    {
                        "number": ""
                    }
                ],
                "body": {
                    "content": ""
                },
                "allowedChannels": [
                    "Viber"
                ],
                "richContent": {
                    "conversation": [
                        {
                            "text": "What's your favorite channel?"
                        }
                    ],
                    "suggestions": [
                        {
                            "action": "Reply",
                            "label": "Viber"
                        },
                        {
                            "action": "Reply",
                            "label": "WhatsApp"
                        }
                    ]
                }
            }
        ]
    }
}

Templates (OTP)

Templates are predefined messages stored on Viber side which allows you to define specific values upon sending the message. Templates are used for sending one time password (OTP) messages.

The following template types are supported by Viber:

TemplateTemplate ID
Basic OTP0aac888f-2ee2-4112-9659-1755a951966a
Basic OTP valid for 5 minc2cdc028-a48b-4187-bbaf-3aaa137b6e23
OTP with business/platformc33cccaf-735f-4d62-8383-a76bf4999e2d
Basic OTP with code validity timebed0942f-e07e-4879-834b-29cc4cf3ec35
OTP with code type & validity time60d67b38-b9fb-444a-80e6-754447e010c6
OTP with details on OTP action/platform210ee8a9-1ed5-43cd-96e4-65bba311ab40
OTP with business/platform name & validity time6c929cef-29b4-4349-bc9d-2a07bdbb6e43
OTP with type of code82ba31a3-db42-4e87-82e8-33fa92b9e5ed
.OTP with business/platform name & code reasonbe56d97b-2a33-4c89-ac5f-f555a2c827d9

The following restrictions apply for using (OTP) templates:

FieldRequiredRemarks
templateIdYesOne of the given template ids.
templateLanguageYesDefault: en (English)
templateParamsYesSee examples below for the required params per template type.

Basic OTP

In the example below we send a basic OTP template:

{
    "messages": {
        "msg": [
            {
                "from": "",
                "to": [
                    {
                        "number": ""
                    }
                ],
                "body": {
                    "content": ""
                },
                "allowedChannels": [
                    "Viber"
                ],
                "richContent": {
                    "conversation": [
                        {
                            "template": {
                                "viber": {
                                    "template_id": "0aac888f-2ee2-4112-9659-1755a951966a",
                                    "template_language": "en",
                                    "template_params": {
                                        "pin": "[pin]"
                                    }
                                }
                            }
                        }
                    ]
                }
            }
        ]
    }
}

Basic OTP valid for 5 minutes

In the example below we send a basic OTP template that's valid for 5 minutes:

{
    "messages": {
        "msg": [
            {
                "from": "",
                "to": [
                    {
                        "number": ""
                    }
                ],
                "body": {
                    "content": ""
                },
                "allowedChannels": [
                    "Viber"
                ],
                "richContent": {
                    "conversation": [
                        {
                            "template": {
                                "viber": {
                                    "template_id": "c2cdc028-a48b-4187-bbaf-3aaa137b6e23",
                                    "template_language": "en",
                                    "template_params": {
                                        "pin": "[pin]"
                                    }
                                }
                            }
                        }
                    ]
                }
            }
        ]
    }
}

OTP with business/platform name

In the example below we send a OTP template with a business/platform name:

{
    "messages": {
        "msg": [
            {
                "from": "",
                "to": [
                    {
                        "number": ""
                    }
                ],
                "body": {
                    "content": ""
                },
                "allowedChannels": [
                    "Viber"
                ],
                "richContent": {
                    "conversation": [
                        {
                            "template": {
                                "viber": {
                                    "template_id": "c33cccaf-735f-4d62-8383-a76bf4999e2d",
                                    "template_language": "en",
                                    "template_params": {
                                        "pin": "[pin]",
                                        "business_platform_name": "[business_platform_name]"
                                    }
                                }
                            }
                        }
                    ]
                }
            }
        ]
    }
}

Basic OTP with code validity time

In the example below we send a basic OTP template with a given validity time:

{
    "messages": {
        "msg": [
            {
                "from": "",
                "to": [
                    {
                        "number": ""
                    }
                ],
                "body": {
                    "content": ""
                },
                "allowedChannels": [
                    "Viber"
                ],
                "richContent": {
                    "conversation": [
                        {
                            "template": {
                                "viber": {
                                    "template_id": "bed0942f-e07e-4879-834b-29cc4cf3ec35",
                                    "template_language": "en",
                                    "template_params": {
                                        "pin": "[pin]",
                                        "code_validity_time": 2
                                    }
                                }
                            }
                        }
                    ]
                }
            }
        ]
    }
}

OTP with code type & validity time

In the example below we send a OTP template with a given validity time and pin type:

{
    "messages": {
        "msg": [
            {
                "from": "",
                "to": [
                    {
                        "number": ""
                    }
                ],
                "body": {
                    "content": ""
                },
                "allowedChannels": [
                    "Viber"
                ],
                "richContent": {
                    "conversation": [
                        {
                            "template": {
                                "viber": {
                                    "template_id": "60d67b38-b9fb-444a-80e6-754447e010c6",
                                    "template_language": "en",
                                    "template_params": {
                                        "pin": "[pin]",
                                        "code_validity_time": 2,
                                        "pin_type": "[pin_type]"
                                    }
                                }
                            }
                        }
                    ]
                }
            }
        ]
    }
}

OTP with business/platform name & validity time

In the example below we send a OTP template with a given validity time and business platform name:

{
    "messages": {
        "msg": [
            {
                "from": "",
                "to": [
                    {
                        "number": ""
                    }
                ],
                "body": {
                    "content": ""
                },
                "allowedChannels": [
                    "Viber"
                ],
                "richContent": {
                    "conversation": [
                        {
                            "template": {
                                "viber": {
                                    "template_id": "6c929cef-29b4-4349-bc9d-2a07bdbb6e43",
                                    "template_language": "en",
                                    "template_params": {
                                        "pin": "[pin]",
                                        "business_platform_name": "[business_platform_name]",
                                        "code_validity_time": 2
                                    }
                                }
                            }
                        }
                    ]
                }
            }
        ]
    }
}

OTP with type of code

In the example below we send a OTP template with a given pin/code type:

{
    "messages": {
        "msg": [
            {
                "from": "",
                "to": [
                    {
                        "number": ""
                    }
                ],
                "body": {
                    "content": ""
                },
                "allowedChannels": [
                    "Viber"
                ],
                "richContent": {
                    "conversation": [
                        {
                            "template": {
                                "viber": {
                                    "template_id": "82ba31a3-db42-4e87-82e8-33fa92b9e5ed",
                                    "template_language": "en",
                                    "template_params": {
                                        "pin": "[pin]",
                                        "pin_type": "[pin_type]"
                                    }
                                }
                            }
                        }
                    ]
                }
            }
        ]
    }
}

OTP with details on OTP action/platform

In the example below we send a OTP template with a given business/platform action:

{
    "messages": {
        "msg": [
            {
                "from": "",
                "to": [
                    {
                        "number": ""
                    }
                ],
                "body": {
                    "content": ""
                },
                "allowedChannels": [
                    "Viber"
                ],
                "richContent": {
                    "conversation": [
                        {
                            "template": {
                                "viber": {
                                    "template_id": "210ee8a9-1ed5-43cd-96e4-65bba311ab40",
                                    "template_language": "en",
                                    "template_params": {
                                        "pin": "[pin]",
                                        "business_platform_action_name": "[business_platform_action_name]"
                                    }
                                }
                            }
                        }
                    ]
                }
            }
        ]
    }
}

OTP with business/platform name & code reason

In the example below we send a OTP template with a given reason and business/platform name:

{
    "messages": {
        "msg": [
            {
                "from": "",
                "to": [
                    {
                        "number": ""
                    }
                ],
                "body": {
                    "content": ""
                },
                "allowedChannels": [
                    "Viber"
                ],
                "richContent": {
                    "conversation": [
                        {
                            "template": {
                                "viber": {
                                    "template_id": "be56d97b-2a33-4c89-ac5f-f555a2c827d9",
                                    "template_language": "en",
                                    "template_params": {
                                        "pin": "[pin]",
                                        "business_platform_name": "[business_platform_name]",
                                        "code_reason": "[code_reason]"
                                    }
                                }
                            }
                        }
                    ]
                }
            }
        ]
    }
}