> For the complete documentation index, see [llms.txt](https://en-api.decisiontele.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://en-api.decisiontele.com/viber-templates-api-beta.md).

# 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.

{% tabs %}
{% tab title="POST" %}

```
https://web.it-decision.com/v2/api/create-viber-template-api
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Request POST:" %}

```json
Example for trasactional Viber template:
{
    "name":"Custom name",
    "template":"Dear {{John Doe}}, your {{john_doe}} account expires on {{September 18, 2026}}. Please renew your account using the link https://customsite.com/.",
    "callback_url":"https://customsite.com/templates-callback",
    "lang":"en"
}
```

{% endtab %}
{% endtabs %}

### **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: \
\&#xNAN;*Dear Alex* Cossac&#x6B;*, your alex\_*&#x63;ossack *account expires on October 15*, \_2027. Please renew your account using the link <https://customsite.com/._\\>
Here *Alex* Cossack, *alex\_*&#x63;ossack, *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](#localization)

### Response:

{% tabs %}
{% tab title="JSON (POST)" %}

```json
{
    "success": true,
    "message": "Template successfully created",
    "data": {
        "example": "Dear John Doe, your john_doe account expires on September 18, 2026. Please renew your account using the link https://customsite.com/.",
        "template_text": "Dear {{var1}}, your {{var2}} account expires on {{var3}}. Please renew your account using the link https://customsite.com/.",
        "name": "Custom Name",
        "lang": "en",
        "status_template": "Pending Approval",
        "template_id": "36568982-d84c-42ce-9c72-8caf62cd8b05",
        "created_at": "2026-06-10 06:58:00",
        "id": 46
    }
}
```

{% endtab %}
{% endtabs %}

### **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:

{% tabs %}
{% tab title="JSON (POST)" %}

```json
{
    "template_id": "0aac888f-2ee2-4112-9659-1755a951966a",
    "status_template": "Approved"
}
```

{% endtab %}
{% endtabs %}

**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**

{% tabs %}
{% tab title="POST" %}

```
 https://web.it-decision.com/v2/api/get-viber-template-api
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Request POST:" %}

```json
{
    "id":4291235
}
```

{% endtab %}
{% endtabs %}

### Parameters

**id:**

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

{% tabs %}
{% tab title="Response JSON:" %}

```json
{
    "success": true,
    "message": "Template received successfully",
    "data": {
        "id": 4291235,
        "template_id": "36568982-d84c-42ce-9c72-8caf62cd8b05",
        "name": "Custom Name",
        "template_text": "Dear {{var1}}, your {{var2}} account expires on {{var3}}. Please renew your account using the link https://customsite.com/.",
        "example": "Dear John Doe, your john_doe account expires on September 18, 2026. Please renew your account using the link https://customsite.com/.",
        "status_template": "Approved",
        "created_at": "2026-06-10 06:58:00",
        "lang": "en"
    }
}
```

{% endtab %}
{% endtabs %}

### 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**&#x20;

| 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                 |
