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.

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 with a fallback to SMS.

{
  "messages": {
    "authentication": {
      "producttoken": "Your product token"
    },
    "msg": [
      {
        "from": "Your sender",
        "to": [
          {
            "number": "Phone number"
          }
        ],
        "allowedChannels": [
          "Viber", "SMS"
        ],
        "body": {
          "type": "auto",
          "content": "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": {
    "authentication": {
      "producttoken": "Your product token"
    },
    "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": {
    "authentication": {
      "producttoken": "Your product token"
    },
    "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": {
    "authentication": {
      "producttoken": "Your product token"
    },
    "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": {
    "authentication": {
      "producttoken": "Your product token"
    },
    "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": {
    "authentication": {
      "producttoken": "Your product token"
    },
    "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": {
    "authentication": {
      "producttoken": "Your product token"
    },
    "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"
                }
              ]
            }
          ]
        }
      }
    ]
  }
}