Skip to main content

Sending Viber Messages over API

API reference for sending Viber messages through the 8x8 Messaging Apps API. This page covers the endpoint, request envelope, response format, validation, error codes, and rate limits. For promotional message payloads with screenshots, see the Promotional Message API Library. For template create and send payloads, see the Transactional Message API Library. For a quick-start guide with curl examples, see Getting Started.

๐Ÿšง Availability

Template creation and template send are rolling out. Listing and deleting templates are not yet available. Contact your account manager to confirm availability on your account before you build against this page.


Endpointโ€‹

All Viber sends use the same messages endpoint, whether free-form or template:

Endpoint:

POST https://chatapps.8x8.com/api/v1/subaccounts/{subAccountId}/messages
Authorization: Bearer {apiKey}
Content-Type: application/json

Path Parameters:

  • {subAccountId}: Your messaging subaccount ID. Must be a dedicated messaging subaccount, not an existing SMS subaccount

Replace the base URL if your account is provisioned in a different platform region. Sending to the wrong region fails authentication.

Platform regionBase URL
Asia (default)https://chatapps.8x8.com
Europehttps://chatapps.8x8.uk
North Americahttps://chatapps.us.8x8.com
Indonesiahttps://chatapps.8x8.id

For more detail, see Platform Deployment Regions.


Request Structureโ€‹

Every send request shares the same outer envelope. The content object changes by message type; the outer fields stay the same.

{
"user": {
"msisdn": "<RECIPIENT_PHONE>"
},
"type": "<MESSAGE_TYPE>",
"content": {
},
"channels": [
{ "channel": "Viber", "channelId": "<CHANNEL_ID>" }
]
}

Key Fields:

  • user.msisdn: Recipient phone number in E.164 format, for example "+6512345678"
  • type: The message type. Confirmed values: "text" for free-form text, "template" for template sends
  • content: Message body. Structure varies by type; see the Promotional Message API Library and Transactional Message API Library
  • channels: Array identifying the Viber channel. Required for template sends. The confirmed free-form text example does not include it; it may be optional when the subaccount maps to a single channel

Response:

A successful send returns:

{
"state": "queued"
}

The message enters the delivery pipeline. Track its progress through Webhooks and Delivery Receipts.


Template Management APIโ€‹

Create a Templateโ€‹

Template creation uses the shared Messaging Apps templates endpoint. The channel type is derived from {channelId}, so the same path serves WhatsApp and Viber.

Endpoint:

POST https://chatapps.8x8.com/api/v1/accounts/{accountId}/channels/{channelId}/templates
Authorization: Bearer {apiKey}
Content-Type: application/json

Path Parameters:

  • {accountId}: Your 8x8 account ID
  • {channelId}: The Viber channel to register the template against

For the full request body and example payloads, see the Transactional Message API Library.

Response Codes:

200 OK with an empty body. The template is stored with status Pending and enters Viber's moderation queue.

StatusCause
200Accepted and queued for moderation
400Validation failure, including an invalid template name or a body that breaks the structural rules
409A template with this name and language already exists on the channel
401 / 403Missing or insufficient credentials. Creation requires an admin role
500Unexpected error. The template is not stored

๐Ÿ“˜

A 200 means Viber accepted the submission, not that the template is usable. Wait for the approval event before sending. See Template Status Events.

Template Status Eventsโ€‹

Viber moderates within 24 hours and notifies 8x8, which forwards the result to your webhook. You do not poll.

The event carries the template name you chose, not Viber's internal identifier.

ResultTemplate status becomes
Created and queuedPending
ApprovedApproved
RejectedDeclined

A Declined template cannot be sent. Correct the wording, then create a replacement. See Templates Cannot Be Edited.

For the webhook payload shape and configuration, see Webhooks and Delivery Receipts.


Validation Before Sendโ€‹

8x8 checks the request against the stored template before calling Viber. These failures come back immediately as a synchronous error rather than as a Viber error code in a delivery receipt:

  • The template name does not resolve on this channel
  • The template is not Approved
  • The template has been deleted
  • Supplied parameters do not match the template's declared placeholders
  • An OTP template was sent without a pin value

Error Codesโ€‹

Template-related failures that pass 8x8 validation but fail at Viber surface in your delivery receipt using 8x8 error codes. The Viber code each one maps to is shown for reference when comparing against Viber's own documentation.

8x8 CodeReasonMeaningViber Code
2020Template ID not foundThe template does not exist, was deleted, or does not belong to this service38
2021Template validation failedSupplied parameters did not pass Viber's validation39
2006TimeoutViber server timeout. Viber also returns this when an OTP template is sent without a pin value7

๐Ÿšง

Code 2006 has two meanings. A genuine timeout and a missing OTP pin produce the same code. 8x8 rejects a missing pin before the send to avoid this ambiguity, but a Viber-side timeout still surfaces as 2006.

Any non-success response from Viber triggers SMS fallback if you configured it, regardless of which code came back. The fallback body is content.fallbackText.

๐Ÿ“˜ Error Code Reference

For the complete list of all Viber error codes and their meanings, see Delivery Error Codes.


Rate Limitsโ€‹

OperationLimit
Create template50 per second
Approval timeUp to 24 hours
Templates per Viber Service ID2,000, counting every status

Not Yet Availableโ€‹

OperationStatus
List templatesIn development. Until then, track your registered names and their statuses on your side
Delete a templateIn development. Deleting at Viber is permanent
Retrieve a single templateNot planned as a public endpoint
Update a templateNot possible. Viber templates are immutable. See Templates Cannot Be Edited

Next Stepsโ€‹

If you want toRead
Send your first message with working curl examplesGetting Started
See all promotional message formats with screenshots and payloadsPromotional Message API Library
See template create and send payloadsTransactional Message API Library
Handle delivery receipts and inbound messagesWebhooks and Delivery Receipts
Look up a specific error codeDelivery Error Codes
Understand how traffic is ratedBilling