Viber Template API (OTP / Transactional)
Use the Viber Template API to create OTP or transactional templates and retrieve templates created for your Viber-enabled bot.
Endpoint details
| Field | Value |
|---|---|
| Endpoint URL | https://apis.rmlconnect.net/viber-reports/api/v2/viber_templates |
| Content-Type | application/json |
| Authentication Required | Yes |
Authentication
Pass a valid access token in the Authorization header.
Request headers
| Header | Value | Description |
|---|---|---|
| Content-Type | application/json | Specifies the media type of the request body. |
| Authorization | Bearer <your-auth-token> | Replace with your valid token from the login API. |
Template operations
Create Template
Create templates for OTP and transactional use cases.
Get Templates
Fetch all templates created for your account.
API examples
Create Template
Create a template for OTP or transactional use cases.
Method
POSTRequest parameters
| Field | Type | Required | Description |
|---|---|---|---|
| template_name | string | Yes | Name of template. Max length: 64. Allowed: letters, digits, and spaces. Special characters are not allowed. |
| template_syntax | string | Yes | Max length: 875 characters. Must start and end with static text, not a variable. |
| locale | string | Yes | Template language code, for example en, ru, or fr. |
| message_type | string | Yes | Category. Use OTP or Transaction. |
| parameters | string | Yes | List of dynamic parameters, or variables, used within the template text. Maximum: 5. |
| examples | string | Yes | List of example values for the declared parameters. Used for template moderation. Maximum: 5. |
Request body
{
"template_name": "demo akshay13",
"template_syntax": "Hi This is {{name}} From {{country}}, Nice to meet you.",
"locale": "en",
"message_type": "transaction",
"parameters": {
"name": "string",
"country": "string"
},
"examples": {
"name": "Akshay",
"country": "India"
}
}Response
{
"message": "Template created successfully",
"operator_template_id": "2f4bede1-d474-4fec-8d55-5f43f9388f44",
"pre_approved": false,
"status": "success",
"template_id": "2fa3bc1c-8429-4289-9283-9f8624989726"
}Error responses
| HTTP Status | Description | Example |
|---|---|---|
| 401 Unauthorized | Invalid or missing authentication token. | {"status": "error", "description": "Authentication failed"} |
| 403 Forbidden | Access denied or token expired. | {"status": "error", "description": "Token expired"} |
| 500 Internal Server Error | Something went wrong on the server. | {"status": "error", "description": "Internal server error"} |
Get Templates
Fetch all templates created for your account.
Method
GETRequest body
GET request — no request body required.
Response
[
{
"message_type": "transaction",
"template_id": "ddf06e1c-24b6-46cd-96c3-e42fe90c47ad",
"template_name": "testtransc",
"template_status": "APPROVED"
},
{
"message_type": "otp",
"template_id": "d038efc7-03c2-4ea3-8255-9fa6c2ea5b16",
"template_name": "testopt7",
"template_status": "APPROVED"
},
{
"message_type": "otp",
"template_id": "4e0389bd-3564-4209-9a7c-9b6b5c91c093",
"template_name": "test sri",
"template_status": "APPROVED"
}
]Error responses
| HTTP Status | Description | Example |
|---|---|---|
| 401 Unauthorized | Invalid or missing authentication token. | {"status": "error", "description": "Authentication failed"} |
| 403 Forbidden | Access denied or token expired. | {"status": "error", "description": "Token expired"} |
| 500 Internal Server Error | Something went wrong on the server. | {"status": "error", "description": "Internal server error"} |
Updated 11 days ago
Did this page help you?