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

Viber templates API (beta)

DecisionTelecom Viber API allows you to send and receive Viber business messages to and from any country in the world via API. Each message is identified by a unique random ID, so users can always check the status of a message using given endpoint.

The Viber templates 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/v2/api/create-template-api');
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);

Create transactional Viber template

A Transactional Template is a standardized, pre-approved message format for notifications (e.g., order confirmations, shipping updates). It consists of: Fixed Text: Static content that remains constant. Placeholders (Variables): Dynamic fields replaced with recipient-specific data at the time of sending.

Use this request to submit a new template. After creation, the template enters moderation queue. You must await the Approved status before use.

Exceptions:

  • Max template length (excluding curly braces {{}}) - 1000 characters

  • The number of Placeholders (Variables) cannot be more than 8

  • The number of characters in a Placeholder (Variable) is no more than 125

  • Placeholders (Variables) CANNOT BE at the beginning of the text or at the end of the text

  • Placeholders (Variables) CANNOT BE URLs or links.

Parameters

name: Mandatory, template name - cannot be more than 100 characters

template: Mandatory. Max template length (excluding curly braces {{}}) - 1000 characters. A message with example phrases in {{...}} structures that will differ when subsequently sent as transactional messages. When forming a transactional message, these phrases will be used for sending in accordance with the new transactional message types 1701 and 1702. For example, the transactional message sent for the template from the example above would be: Dear Alex Cossack, your alex_cossack account expires on October 15, 2027. Please renew your account using the link https://customsite.com/. Here Alex Cossack, alex_cossack, October 15, 2027 are phrases that can vary in transactional messages of this template.

callback_url: Mandatory. The callback URL to which template approval statuses will be sent.

lang: Mandatory. Template language code (e.g., en, uk, fr). Locales list

Response:

Values:

success: true/false

message: message about success or failure of template creation

data: Object with information about the created template. data.id: Internal ID of the template in the database. data.name: Name of the template. data.template_id: Unique template identifier for your Viber account. data.template_text: Template text with Placeholders (Variables) names. data.example: Generated example message. data.status_template: Current status of the template - Pending Approval, Created, Approved, Rejected. data.created_at: (datetime) Date the template was created. data.lang: Template language.

Receiving statuses at the specified callback_url:

template_id: ID received in the API response when creating the template.

status_template: state of template , can be: Pending Approval, Created, Approved, Rejected.

Get Viber template data

Parameters

id:

The Internal ID of the template whose status you want to get

Values

success: true/false

message: message about success or failure of get template

data: Object with information about the created template. data.id: Internal ID of the template in the database. data.name: Name of the template. data.template_id: Unique template identifier for your Viber account. data.template_text: Template text with Placeholders (Variables) names. data.example: Generated example message. data.status_template: Current status of the template - Pending Approval, Created, Approved, Rejected. data.created_at: (datetime) Date the template was created. data.lang: Template language.

Localization

Language
Code (lang)

Arabic

ar

Armenian

hy

Belarusian

be

Bosnian

bs

Bulgarian

bg

Burmese

my

Chinese (Simplified)

zh-Hans

Chinese (Traditional)

zh-Hant

Croatian

hr

Czech

cs

Danish

da

Dutch

nl

English

en

Finnish

fi

French

fr_FR

Georgian

ka

German

de

Greek

el

Hebrew

he

Hungarian

hu

Indonesian

id

Italian

it

Japanese

ja

Nepali

ne

Norwegian

no

Persian

fa

Polish

pl

Portuguese (Brazil)

pt_BR

Portuguese (Portugal)

pt_PT

Romanian

ro

Russian

ru

Serbian

sr

Slovak

sk

Slovenian

sl

Spanish

es_ES

Swedish

sv

Thai

th

Turkish

tr

Ukrainian

uk

Vietnamese

vi

Errors

Name
Too Many Requests

message

Rate limit exceeded

code

0

status

429

Name
Empty parameter or parameter validation error

message

Invalid Parameter: <param>

code

1

status

400

param:

callback_url is not url

callback_url url wrong scheme

Name
Internal server error

message

Error for template registration on Viber side: <Viber side error>

code

1

status

400

Name
Message Template error

message

Viber Business Account is not configured. Please contact your manager for clarification.

code

7

status

400

Name
Authorization error

message

Unauthorized access

code

6

status

401

Last updated