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

FieldValue
Endpoint URLhttps://apis.rmlconnect.net/viber-reports/api/v2/viber_templates
Content-Typeapplication/json
Authentication RequiredYes

Authentication

Pass a valid access token in the Authorization header.

Request headers

HeaderValueDescription
Content-Typeapplication/jsonSpecifies the media type of the request body.
AuthorizationBearer <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

POST

Request parameters

FieldTypeRequiredDescription
template_namestringYesName of template. Max length: 64. Allowed: letters, digits, and spaces. Special characters are not allowed.
template_syntaxstringYesMax length: 875 characters. Must start and end with static text, not a variable.
localestringYesTemplate language code, for example en, ru, or fr.
message_typestringYesCategory. Use OTP or Transaction.
parametersstringYesList of dynamic parameters, or variables, used within the template text. Maximum: 5.
examplesstringYesList 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 StatusDescriptionExample
401 UnauthorizedInvalid or missing authentication token.{"status": "error", "description": "Authentication failed"}
403 ForbiddenAccess denied or token expired.{"status": "error", "description": "Token expired"}
500 Internal Server ErrorSomething went wrong on the server.{"status": "error", "description": "Internal server error"}
Get Templates

Fetch all templates created for your account.

Method

GET

Request 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 StatusDescriptionExample
401 UnauthorizedInvalid or missing authentication token.{"status": "error", "description": "Authentication failed"}
403 ForbiddenAccess denied or token expired.{"status": "error", "description": "Token expired"}
500 Internal Server ErrorSomething went wrong on the server.{"status": "error", "description": "Internal server error"}


Did this page help you?