# Viber Business Messages channel message support The Viber Business Messages channel of the Conversation API supports a wide variety of message types. ## Sending Messages Some rich messages are natively supported by VIBERBM channel while others must be transcoded. The following sections demonstrate the mapping between the Conversation API generic message format and the way VIBERBM renders the messages on mobile devices. ### Text Messages The Viber Business Messages channel natively supports text messages. The maximum length of a text message is 1000 characters. Longer content will be truncated. Texts can be formatted with markdown. | Format | Markdown | String to be sent | Appearance on message | | --- | --- | --- | --- | | Bold | One asterisk at each end of the text: * | *This text will be bold* | **This text will be bold** | | Italics | One underscore at each end of the text: _ | _This text will be in italics_ | *This text will be in italics* | | Monospace | Three backticks at each end of the text: ![backtick](/assets/single_backtick.9eb2c097aeafe53e27b924cf8a4ef521233c5b416848d1c6bc62f6558ab173a6.c734a361.png)![backtick](/assets/single_backtick.9eb2c097aeafe53e27b924cf8a4ef521233c5b416848d1c6bc62f6558ab173a6.c734a361.png)![backtick](/assets/single_backtick.9eb2c097aeafe53e27b924cf8a4ef521233c5b416848d1c6bc62f6558ab173a6.c734a361.png) | ![backtick](/assets/single_backtick.9eb2c097aeafe53e27b924cf8a4ef521233c5b416848d1c6bc62f6558ab173a6.c734a361.png)![backtick](/assets/single_backtick.9eb2c097aeafe53e27b924cf8a4ef521233c5b416848d1c6bc62f6558ab173a6.c734a361.png)![backtick](/assets/single_backtick.9eb2c097aeafe53e27b924cf8a4ef521233c5b416848d1c6bc62f6558ab173a6.c734a361.png)This text will be in monospace![backtick](/assets/single_backtick.9eb2c097aeafe53e27b924cf8a4ef521233c5b416848d1c6bc62f6558ab173a6.c734a361.png)![backtick](/assets/single_backtick.9eb2c097aeafe53e27b924cf8a4ef521233c5b416848d1c6bc62f6558ab173a6.c734a361.png)![backtick](/assets/single_backtick.9eb2c097aeafe53e27b924cf8a4ef521233c5b416848d1c6bc62f6558ab173a6.c734a361.png) | `This text will be in monospace` | | Strikethrough | One tilde at each end of the text: ~ | ~This text will have a strikethrough~ | This text will have a strikethrough | The following image gives an example of a text message: ![Text Message](/assets/viberbm_text_message.06bc76efb06b859a82500e506f213c103432f21f8c7a311efe0d093a5aa16217.c734a361.png) The code to send a text message for this channel doesn't differ from the generic message and can be viewed [here](/docs/conversation/message-types/text-message). ### Media Messages Viber Business Messages supports media messages natively. Supported image types: - .jpg - .jpeg - .png Supported document types: - .doc - .docx - .rtf - .dot - .dotx - .odt - .odf - .fodt - .txt - .info - .pdf - .xps - .pdax - .eps - .xls - .xlsx - .ods - .fods - .csv - .xlsm - .xltx Documents and media sent using media messages must be less than 200MB in size. When sending a video media message, the following additional requirements apply: - The thumbnail_url must be set. See the [media message schema](/docs/conversation/message-types/media-message#media-message-schema) for more information. - The thumbnail URL can be a maximum of 1000 characters. - The HTTP server that provides the video needs to set `Content-Length` in the HEAD response. - The video duration must be less than 600 seconds. The following image gives an example of a media message. ![Image Media Message](/assets/viberbm_media_message.ae152221fe44635cba83658f7ebcceef99706af3ffbfaedd3a37027a099ddc47.c734a361.png) The code to send a media message for this channel doesn't differ from the generic message and can be viewed [here](/docs/conversation/message-types/media-message). ### Choice Messages Viber Business Messages channel provides native support for single choice (URL, Call, or Location) choice messages. The title of the choice has a maximum length of 30 characters, longer content will be truncated. The following image gives an example of a choice message. ![URL Choice Message](/assets/viberbm_choice_message.b26688997a633e7265ebd82d815cdcfa246e239d0ce4ea90cfa545bf8f8892bf.c734a361.png) The code to send a choice message for this channel doesn't differ from the generic message and can be viewed [here](/docs/conversation/message-types/choice-message). ### Card Messages Viber Business Messages supports natively Card messages with one URL, Call, or Location choice. The media message in the Card should point to an image. The title of the choice in the Card message has a maximum length of 30 characters, longer content will be truncated. The following image gives an example of a card message. ![Card Message](/assets/viberbm_card_message.10da108e67bdc670b4f6e758ed44adbbe4895ec93fd0c10b08ca889c41006880.c734a361.png) The code to send a card message for this channel doesn't differ from the generic message and can be viewed [here](/docs/conversation/message-types/card-message). ### Carousel Messages Viber Business Messagers doesn't support natively Carousel messages and so they're transcoded and sent as text messages by Conversation API. The following image gives an example of a carousel message. ![Carousel Message](/assets/viberbm_carousel_message.cf1bf60352a5e0f9aec41f5cdbfda209f3a92b8f18f7f47eba04a96cf85e01db.c734a361.png) The code to send a carousel message for this channel doesn't differ from the generic message and can be viewed [here](/docs/conversation/message-types/carousel-message). ### Location Messages Viber Business Messages channel doesn't natively support location messages and so they're transcoded and sent as text messages by Conversation API. The following image gives an example of a location message. ![Location Message](/assets/viberbm_location_message.68d7bc973d83fb362d5545b08a90fc44e82e6aea34b8a53da0cf355d436d0d18.c734a361.png) The code to send a location message for this channel doesn't differ from the generic message and can be viewed [here](/docs/conversation/message-types/location-message). ## Receiving Messages VIBERBM supports contact initiated messages and choice responses. Note: Please note that the media URLs included in the contact messages are valid for 7 days. After that the media is deleted from Conversation API storage. Conversation API POST to `MESSAGE_INBOUND` webhook for text message: ```json { "app_id": "01E3S8B6YCMRNR0GGM94H80ACX", "accepted_time": "2020-04-24T08:02:50.184581Z", "message": { "id": "01E6NKBV63YG6K01ENEW7S1N80", "direction": "TO_APP", "contact_message": { "text_message": { "text": "Hi from contact" } }, "channel_identity": { "channel": "VIBERBM", "identity": "46712312312", "app_id": "" }, "conversation_id": "01E6K4A8PGZ6MV0GD3C7M901MZ", "contact_id": "01E6K4A8N3NANZ05VM0FS80EHD", "metadata": "", "accept_time": "2020-04-24T08:02:50.179021Z" } } ``` Conversation API POST to `MESSAGE_INBOUND` webhook for choice response message: ```json { "app_id": "01E3S8B6YCMRNR0GGM94H80ACX", "accepted_time": "2020-04-24T08:02:50.184581Z", "message": { "id": "01E6NKBV63YG6K01ENEW7S1N80", "direction": "TO_APP", "contact_message": { "choice_response_message": { "message_id": "01EKJ2SWHGDMYA0F0F1PQJ09WQ", "postback_data": "postback" } }, "channel_identity": { "channel": "VIBERBM", "identity": "46712312312", "app_id": "" }, "conversation_id": "01E6K4A8PGZ6MV0GD3C7M901MZ", "contact_id": "01E6K4A8N3NANZ05VM0FS80EHD", "metadata": "", "accept_time": "2020-04-24T08:02:50.179021Z" } } ``` Conversation API POST to `MESSAGE_INBOUND` webhook for media response message: ```json { "app_id": "01E3S8B6YCMRNR0GGM94H80ACX", "accepted_time": "2020-10-01T12:10:55.073703Z", "event_time": "2020-10-01T12:10:53.991Z", "project_id": "c36f3d3d-1513-4edd-ae42-11995557ff61", "message": { "id": "01E6NKBV63YG6K01ENEW7S1N80", "direction": "TO_APP", "contact_message": { "media_message": { "url": "https://1vxc0v12qhrm1e72gq1mmxkf-wpengine.netdna-ssl.com/wp-content/uploads/2019/05/Sinch-logo-Events.png" } }, "channel_identity": { "channel": "VIBERBM", "identity": "46712312312", "app_id": "" }, "conversation_id": "01E6K4A8PGZ6MV0GD3C7M901MZ", "contact_id": "01E6K4A8N3NANZ05VM0FS80EHD", "metadata": "", "accept_time": "2020-04-24T08:02:50.179021Z" } } ``` ## Receiving Delivery Receipts Messages sent on VIBERBM channel have three statuses: DELIVERED, READ and FAILED. Below is an example for DELIVERED receipt - READ and FAILED differ by the `status` and `reason` only. Conversation API POST to `MESSAGE_DELIVERY` webhook: ```json { "app_id": "01E3S8B6YCMRNR0GGM94H80ACX", "accepted_time": "2020-04-23T09:55:04.766Z", "message_delivery_report": { "message_id": "01E6K7CMXY3KHH0AGCTY6D04F2", "conversation_id": "01E6JY5HMCADX31SANQ0YE0CH6", "status": "DELIVERED", "channel": "VIBERBM", "reason": "", "metadata": "" } } ``` ## Receiving User Opt-In/Out Viber users can at any time opt-in or opt-out of receiving messages by given VIBERBM account. ### Opt-In Conversation API POST to `OPT_IN` webhook: ```json { "app_id": "01EB37HMH1M6SV18ASNS3G135H", "accepted_time": "2021-06-08T07:54:03.165316Z", "event_time": "2021-06-08T07:54:02.112Z", "project_id": "c36f3d3d-1513-4edd-ae42-11995557ff61", "opt_in_notification": { "contact_id": "01EKA07N79THJ20WSN6AS30TMW", "channel": "VIBERBM", "identity": "123456789", "status": "OPT_IN_SUCCEEDED", "request_id": "01F7N9TEH11X7B15XQ6VBR04G7" } } ``` ### Opt-Out Conversation API POST to `OPT_OUT` webhook: ```json { "app_id": "01EB37HMH1M6SV18ASNS3G135H", "accepted_time": "2021-06-08T07:54:03.165316Z", "event_time": "2021-06-08T07:54:02.112Z", "project_id": "c36f3d3d-1513-4edd-ae42-11995557ff61", "opt_out_notification": { "contact_id": "01EKA07N79THJ20WSN6AS30TMW", "channel": "VIBERBM", "identity": "123456789", "status": "OPT_OUT_SUCCEEDED", "request_id": "01F7N9TEH11X7B15XQ6VBR04G7" } } ```