Skip to main content

Broadcast Messaging

POST https://chatapi.viber.com/pa/broadcast_message

This endpoint allows you to send a broadcast message to all your subscribers. You can use any message type that is supported by the API, including text, picture, video, file, location, contact, sticker, URL and rich media messages. To learn more about the message types, see Message Data Model.

Pay attention

The following limitations apply to broadcast messages:

  • You can send a brodcast message to a maximum of 300 subscriber per request.
  • You are limited to 500 requests per 10 seconds.
  • The maximum size of the message is 30kb.

Request

Headers


Content-Type: application/json
Authorization: X-Viber-Auth-Token: YOUR_AUTHENTICATION_TOKEN

Parameters


NameTypeDescriptionNotes
typestringThe type of the message.Required. one of the available message types. See full list here
sender.namestringThe name of the bot.Required. Max 28 characters.
sender.avatarstringThe avatar of the bot.Optional. the avatar size should not exceed 100KB. The recommended dimensions for the avatar are 720x720.
tracking_datastringAllow the bot to track messages and user’s replies. The tracking_data value sent with the message will be returned with the user's reply.Optional Max 4000 characters
min_api_versionintegerThe minimum API version that the message is supported in.Optional Default value is 1.
broadcast_listarray of stringsThe list of subscribers ids.Max 300 ids
Additional fileds based on the message type
Example
curl -X POST https://chatapi.viber.com/pa/broadcast_message -H "X-Viber-Auth-Token: YOUR_AUTHENTICATION_TOKEN" -d '{"type":"text","text":"Hello World","sender":{"name":"Viber Bot","avatar":"http://avatar.example.com"},"broadcast_list":["jc9HsWTZ2Yf2NkRZ8KcNug==","fd4HsWT33Yf1BkRZ8KcBsk=="]}'

Response

Attributes


NameTypeDescriptionNotes
statusintegerThe status of the request.0 for success. In case of failure - appropriate failure status number. See common errors for more information
status_messagestringThe status message of the request.Success: ok. Failure: invalidUrl, invalidAuthToken, badData, missingData and failure. See common errors for more information
message_tokenintegerUnique id of the message
chat_hostnamestringThe name of ther server that host your botfor internal use
billing_statusstringAn indication of how this message is categorized for billing purposes, allowing you to know if it was charged or not, or whether it counts toward. Read more about bots billing hereAn integer between 0 and 5. See the table in billing statuses section below for more information
Example
{
"status": 0,
"status_message": "ok",
"message_token": 1234567890,
"chat_hostname": "chatapi.viber.com",
"billing_status": 0
}

Billing Statuses


ValueNameDescription
0freeDefault for all cases other than the ones listed below: chat extension, reply to open conversation, etc.
1inSessionNonBillableBot1:1 message/keyboard sent in a session from a non-billable bot
2inSessionForBillableBot1:1 message/keyboard sent in a session from a billable bot
3outOfSessionFreeMessageNonBillableBotFree out of session 1:1 message/keyboard sent by a non-billable bot
4outOfSessionFreeMessageForBillableBotFree out of session 1:1 message/keyboard sent by a billable bot
5outOfSessionBilledMessageCharged out of session 1:1 message/keyboard sent by a billable bot