Counterbat API: Viber Bot Billing Sessions
Billing Counter Capabilities
The Counterbat API allows you to monitor session data in real-time and leverage the Cascade API to send additional messages into a service session or an already paid Viber Bot session.
How to Connect the Billing Counter Service
- Sign a contract.
- Gain access to the functionality.
- Set up a webhook.
- Use the panel and the capabilities of the Cascade API.
Viber REST API (Counterbat Edition)
The following is a complete Viber REST API reference. Note that the endpoint https://chatapi.viber.com is replaced by https://api.counterbat.com/ for use with the Counterbat functionality.
Get Started
To implement the API, you will need: 1. An Active Viber account on a platform that supports bots (iOS/Android). 2. Active bot. 3. Account authentication token. 4. Set-up account webhook.
Authentication token
Each API request must include an HTTP Header called X-Viber-Auth-Token containing the account’s authentication token.
Webhooks
Setting a Webhook
Resource URL
Post data
{
"url": "https://my.host.com",
"event_types": [
"delivered",
"seen",
"failed",
"subscribed",
"unsubscribed",
"conversation_started"
],
"send_name": true,
"send_photo": true
}
Removing your webhook
To disable the webhook, post a set_webhook request with an empty URL string.
Send Message
The send_message API allows accounts to send messages to Viber users who subscribe to the account.
Resource URL
Response example
{
"status": 0,
"status_message": "ok",
"message_token": 5741311803571721087,
"chat_hostname": "SN-CHAT-05_",
"billing_status": 1
}
Keyboards
The API allows sending a custom keyboard using the send_message API to supply the user with a set of predefined replies or actions.
Resource URL
Broadcast Message
The broadcast_message API allows accounts to send messages to multiple Viber users who subscribe to the account. Maximum list length is 300 receivers.
Resource URL
Get Account Info
The get_account_info request will fetch the account’s details as registered.
Resource URL
Get User Details
The get_user_details request will fetch the details of a specific Viber user based on their unique user ID.
Resource URL
Get Online
The get_online request will fetch the online status of a given subscribed account members (up to 100 user ids per request).
Resource URL
Callbacks
Viber offers callbacks for events such as subscribed, unsubscribed, conversation_started, delivered, seen, failed, and message. The callback will be posted to the URL provided during the set_webhook call.