Viber 6.5 introduced a new Viber API, which third parties can use to send and receive messages between a Public Account (run by a big brand or company)or bot account (collectively known as “account”) and a Viber user.
Viber Public Accounts and bots contain two communications channels:
When creating a new account you will receive a token which is used for all communication with the Viber Back End. In order to enable communication between the Viber Back End and the account, the account must call the set web hook request with the token providing the account’s URL for receiving the web hook. There is also an optional parameter (v6.5.1 and up) to define which events it will receive (such as delivered and seen notifications when clients receive and read messages). Once the set web hook request is received by the Viber Back End, it will validate the URL and send a response.
All communication between accounts and Viber users can only be initialized by the Viber user starting a new conversation to the account (opt–in) (in both cases the user will be subscribed to the account). When a Viber user subscribes to the Public Account/ bot, the account will receive the following information about the user:
Once a Viber user subscribes to a Public Account (and not a bot account), the Public Account can send messages to the Viber user freely (not only in response to a message from the user). Viber users can unsubscribe at any time from the Public Account, which will immediately block any further communication from the Public Account to the user. All messages will include a unique message token and timestamp created by the Viber Back End and will be synchronized between all users’ devices. Messages sent to the Public Account/ bot will also include the user’s Viber name and avatar.
SHA256and uses the account token as the key and the callback
JSONdata as the value.
seenstatus in their privacy settings, then Viber will not send message status updates for seen by the user from the user to the account.
ACKwith a message token. If the user has multiple devices (primary and secondary) using the same Viber account, each of the devices will send an
ACKfor that message token. As a result of this logic, Public Accounts/ bots can receive more than one delivered or
seenstatus update. For a specific user, Viber saves a message for up to 14 days or until the message is considered delivered to the user.
200HTTP response code to the message sent to it. Viber Back End Viber API servers implement a limited retry mechanism to try to resend the message while the account service’s server is offline, but if the account service server is offline for a continuous amount of time, the message will not be delivered to the account.