For the complete documentation index, see llms.txt. This page is also available as Markdown.

VIBER + SMS API

DecisionTelecom Viber + SMS API allows you to send and receive Viber business messages to and from any country in the world via API, and if Viber message is not delivered to a client, it will be resend and delivered as regular SMS message. Each message is identified by a unique random ID, so users can always check the status of a message using given endpoint.

The Viber + SMS API uses HTTPS with access key that is used as the API authorization. Request and response payloads are formatted as JSON using UTF-8 encoding.

API Authorization - Base64 access key.

Please contact your account manager to get an API key.

Auth

Basic Auth

Example:

$userHashKey = 'User Hash Key provided by your account manager';
$ch = curl_init('https://web.it-decision.com/v1/api/send-viber');
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, "$userHashKey");
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($requestParams)); // 
$requestParams - raquest array with correct data 
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); 
$result = curl_exec($ch); 
curl_close($ch);

Send Viber message

Parameters

source_addr:

<= 20 chars - from whom the message

destination_addr:

<= 20 chars - to whom the message

message_type (Type of message sent):

225 only text (promotional messages)

108 text+image+button (promotional messages)

text:

<= 1000 chars - text of Viber message

text_sms:

<= 70 chars for UCS-2 (16-bit) and <= 160 chars for Latin - alternative SMS text if Viber message is not delivered (only for transactional messages)

image (Correct URL with image for promotional message with button caption and button action):

jpg or jpeg (mime type is image/jpeg), maximum resolution 400x400 pixels

png (mime type is image/png), maximum resolution 400x400 pixels

button_caption:

<= 30 chars - button caption

button_action:

Correct URL for transition when you press the button

source_type (Message sending procedure):

promotion message (the message can contain only text or text, an image, and a button) - 1

callback_url:

Correct URL for message status callback

validity_period:

TTL (Time to live) allows the sender to limit the life time of a message. In case the message did not get the status "delivered" before the time ended, the message will not be charged and will not be delivered to the user. In case no TTL was provided (no "ttl" parameter) Viber will try to deliver the message for up to 1 day.

promotional message - min TTL 40 seconds max TTL 21600 seconds (6 hours)

Response:

Values:

message_id:

Sent message ID

Receive Viber message

Parameters

message_id:

The ID of the message whose status you want to get (for the last 5 days)

Values

message_id:

The ID of the message whose status you want to get (for the last 5 days)

status:

Current Viber message status

sms_message_id:

SMS message ID (if available, the status of an SMS message can be obtained using the SMS API)

Viber messages statuses

sent
0

delivered

1

error

2

rejected

3

undelivered

4

pending

5

unknown

20

Errors

Name
Too Many Requests

messege

Rate limit exceeded

code

0

status

429

Name
Invalid Parameter: [param_name]

messege

Empty parameter or parameter validation error

code

1

status

400

Name
Internal server error

messege

The server encountered an unexpected condition which prevented it from fulfilling the request

code

2

status

500

Name
Topup balance is required

messege

User balance is empty

code

3

status

402

Viber + SMS example

Last updated