Viber
All about connecting the bot to Viber
Last updated
All about connecting the bot to Viber
Last updated
The maximum length for a text message is 1000 symbols
First of all, you need to visit the page https://partners.viber.com/account and authorize your account.
Then you need to create a public account for your bot. You need to choose the photo and fill out the form.
Account name - the bot’s name; it can be changed later Uri - bot’s login; it’s used for creating links Category - here you can indicate your area of activity (e.g. local business) Subcategory - e.g. car business Language - what language does your bot speak? Account description - the bot’s description will be visible to all subscribers Website, Email, Location - pretty self-explanatory
Right above the map there’s a tab “The account contains adult content” (it’s in a red box in the screenshot above), you shouldn’t mark it, otherwise every user will get a warning before the bot’s launch.
You need to agree to comply with the Terms of Service and then press “Create”. If everything’s been filled out correctly then you’ll get the bot’s token, you’ll need it for the next step.
The bot’s ready. Now what’s left is to transfer its data to Salebot. To do this, move into the section “Messengers and chats” and choose Viber.
After pressing Done the bot will be connected to Salebot and you’ll get a notification on your phone from Viber asking you to click it for accessing the account.
The link to the created bot can be seen right after connecting
Because of Viber’s restrictions you can’t find the bot through the search bar, but only through the button. Internal links aren’t understood by browsers and apps so if you need to share the bot you can use our minilandings or pass the link through a shortener like https://tinyurl.com/
Viber supports only 6 cards in a carousel but it lets you use colored buttons
The format of used pictures are JPEG and PNG Maximum size of the file is 500 KB
Let’s take as an example a carousel with 4 cards. To create cards you need to find the field “Calculator” and paste this into it:
p =[{"title":"TITLE 1", "description":"DESCRIPTION", "image": "LINK TO IMAGE 1", "buttons":[{"text":"TEXT FOR BUTTON 1","color":"#4BB34B"}]}, {"title":"TITLE 1", "description": "DESCRIPTION", "image":"LINK TO IMAGE 1", "buttons":[{"text":"TEXT FOR BUTTON 1"}]}, {"title":"TITLE 2", "description": "DESCRIPTION", "image": "LINK TO IMAGE 2", "buttons":[{"text":"TEXT FOR BUTTON 2", "url":"LINK"}]}, {"title":"TITLE 3", "description": "DESCRIPTION", "image": "LINK TO IMAGE 3", "buttons":[{"text":"TEXT FOR BUTTON 3"}]}] r = send_carousel(p, '')
The first thing you type in is the array with the title, the description, the image and the buttons in the variable p (which you can name differently) and then you use it in the method send_carousel(p, “)
To build the command you can use this sheet; you can just copy the finished text in the ‘O’ column.
To make the button a certain color, you should add to the array buttons an additional parameter “color”:#”DAF7A6”. The color is set as a 6-digit code and starts with the #. To select the color you can use sites such as https://htmlcolorcodes.com/
You can add links to the carousel’s buttons using the parameter url, then when the user presses the button it takes them to the url and gets the chosen link as a message.
You can also add a parameter payload which isn’t visible to the user but lets you analyze the user’s choice.
[{"title":"TITLE 1", "description":DESCRIPTION", "image":"LINK TO IMAGE 1", buttons":[{"text":"BUTTON TEXT 1", "color":"#4BB34B", "payload":"1"}]}]
In the case when you use buttons with the same text the parameter payload is very helpful.
There are a couple of nuances of bot building in Viber which you have to know. This knowledge will save you a lot of time and will let you use Viber to its fullest possibilities.
By the initial request, Viber lets bots to message only once before the user answers.
This means that as soon the person moves from the link to the bot, they automatically get the first message. In this message you need to ask the user to either press a button or to message something. Otherwise every other message the user just won’t receive. After the user texts the bot you can message them an unlimited amount of texts.
Such a text is set in the project’s settings in Salebot:
The buttons in text aren’t sent when opening up the bot, you need to ONLY send keyboard ones. After the user’s first move you then can work without limitations.
An example of how that first message looks like after following the link:
You need to follow these steps every time you test the first message
To do this, you need to:
Delete the dialogue from the “Clients” tab in the editor;
Delete the chat and unsubscribe from the bot in the messenger
After that you will get the first message again when opening up the bot.
If you saw a red text in the “Clients” tab in the dialogue with a client, saying there’s an error, or maybe saying “failed with status:6” it might mean of on these three things:
the person unsubscribed from getting your messages (i.e. blocked the bot in their Viber account)
you sent two or more messages at once when the user hasn’t responded yet. You need to build your chain of messages in a way that lets the user answer first, or you can use the “Response to the user's first message” tab in settings and paste there such a message that lets the user respond to it or press a button.
there are text buttons in the first message. The first message can only have keyboard buttons.
The block with #{none} is essential - it helps to activate the bot and it doesn’t waste the limitation of only 1 message in Viber
The block is followed by the use of the variable client_type which holds the internal numerical value of the messenger (for Viber it’s client_type=2)
To ensure that the move to the needed block happens automatically you need to set the timer for 0 seconds.
The settings of the arrow that lets in people coming from Viber look like this: