Skip to content

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

  1. Sign a contract.
  2. Gain access to the functionality.
  3. Set up a webhook.
  4. 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.

X-Viber-Auth-Token: 445da6az1s345z78-dazcczb2542zv51a-e0vc5fva17480im9

Webhooks

Setting a Webhook

Resource URL

https://api.counterbat.com/pa/set_webhook

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.

{
   "url": ""
}

Send Message

The send_message API allows accounts to send messages to Viber users who subscribe to the account.

Resource URL

https://api.counterbat.com/pa/send_message

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

https://api.counterbat.com/pa/send_message

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

https://api.counterbat.com/pa/broadcast_message

Get Account Info

The get_account_info request will fetch the account’s details as registered.

Resource URL

https://api.counterbat.com/pa/get_account_info

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

https://api.counterbat.com/pa/get_user_details

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

https://api.counterbat.com/pa/get_online

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.