# Template messages

The Viber Business Messages channel allows you to send template messages. The following template types are supported:

- [Text templates](#text-templates) – custom-defined
- [OTP templates](#otp-templates) – custom-defined or predefined by Viber


To create a custom template, please contact your Sinch Account Manager. API and UI tools for custom template provisioning will be available in the future.

The request payload is exactly the same for all template types. Note the following:

- When sending a template, you must populate the [`channel_template` property of the `template_message` object](/docs/conversation/api-reference/conversation/messages/messages_sendmessage#messages/messages_sendmessage/t=request&path=message&oneof=5/template_message/channel_template).
- When sending a template, you must populate the [`template_id` property](/docs/conversation/api-reference/conversation/messages/messages_sendmessage#messages/messages_sendmessage/t=request&path=message&oneof=5/template_message/channel_template/property%20name*/template_id). You may also populate the [`language_code` property](/docs/conversation/api-reference/conversation/messages/messages_sendmessage#messages/messages_sendmessage/t=request&path=message&oneof=5/template_message/channel_template/property%20name*/language_code). Finally, you must provide the values for the [`parameters` property](/docs/conversation/api-reference/conversation/messages/messages_sendmessage#messages/messages_sendmessage/t=request&path=message&oneof=5/template_message/channel_template/property%20name*/parameters).
- Template messages can be sent to any device associated with an end-user or just their primary device. See [Viber Business Messages channel properties](/docs/conversation/channel-support/viberbm/properties) for more details.


Below is an example of sending a predefined OTP template message:

```json
{
  "message": {
    "template_message": {
      "channel_template": {
        "VIBERBM": {
          "template_id": "0aac888f-2ee2-4112-9659-1755a951966a",
          "language_code": "en",
          "parameters": {
            "pin": "1234"
          }
        }
      }
    }
  },
  "channel_properties": {
    "VIBERBM_TEMPLATE_MESSAGE_DEVICES": "ALL"
  }
}
```

Each template can be localized to multiple languages. The following languages are supported:

| Language | Code |
|  --- | --- |
| English | `en` |
| Arabic | `ar` |
| Bulgarian | `bg` |
| Croatian | `hr` |
| Czech | `cs` |
| Danish | `da` |
| German | `de` |
| Greek | `el` |
| Spanish | `es` |
| Finnish | `fi` |
| French | `fr` |
| Hebrew | `he` |
| Burmese | `my` |
| Hungarian | `hu` |
| Indonesian | `id` |
| Italian | `it` |
| Norwegian | `no` |
| Dutch | `nl` |
| Polish | `pl` |
| Portuguese (Portugal) | `pt` |
| Portuguese (Brazil) | `br` |
| Romanian | `ro` |
| Russian | `ru` |
| Slovak | `sk` |
| Serbian | `sr` |
| Swedish | `sv` |
| Thai | `th` |
| Turkish | `tr` |
| Ukrainian | `uk` |
| Vietnamese | `vi` |
| Persian | `fa` |
| Belarusian | `be` |


## Text templates

Text templates are a special type of template message that can be used to send non-promotional text notifications to users.

The rendered message:

![Text Template Message](/assets/viberbm_text_template_message.4b296ee4c00a117661caffad3a6268950860ecb7a30afec7f03818da81350248.c734a361.png)

## OTP templates

OTP templates are a special type of template message that can be used to send one-time passwords to users. Both custom-defined and predefined OTP templates have the same special layout and mandatory `pin` parameter.

The rendered message:

![OTP Template Message](/assets/viberbm_otp_template_message.d8f01b8a90064d74a8e417575b625dc95c9583769966fd2fecca54ab5baa296b.c734a361.png)

### Predefined OTP templates

The Viber Business Messages channel supports a number a predefined OTP templates. Each of these templates can be referenced by a corresponding unique ID. The supported templates are listed below, and more details can be found in their corresponding sub-sections:

- [Basic OTP](#basic-otp)
- [Basic OTP (valid for 5 minutes)](#basic-otp-valid-for-5-minutes)
- [Basic OTP (valid for a custome amount of time)](#basic-otp-with-code-validity-time)
- [OTP with custom code type](#otp-with-type-of-code-type)
- [OTP with custom code type and validity time](#otp-with-code-type--validity-time)
- [OTP with business/platform name included](#otp-with-businessplatform-name)
- [OTP with business/platform name included and custom validity time](#otp-with-businessplatform-name--validity-time)
- [OTP with details on OTP action/platform](#otp-with-details-on-otp-actionplatform)
- [OTP with business/platform name and code reason included](#otp-with-businessplatform-name--code-reason)


#### Basic OTP

**Template ID:** `0aac888f-2ee2-4112-9659-1755a951966a`

> Your code is {{pin}}.Please don't share your code with ANYONE. We'll never call or message you and ask for it.

| Parameter | Value type |
|  --- | --- |
| `pin` | text |


#### Basic OTP valid for 5 minutes

**Template ID:** `c2cdc028-a48b-4187-bbaf-3aaa137b6e23`

> Your code is {{pin}}. It's valid for 5 minutes.Please don't share your code with ANYONE. We'll never call or message you and ask for it.

| Parameter | Value type |
|  --- | --- |
| `pin` | text |


#### Basic OTP with code validity time

**Template ID:** `bed0942f-e07e-4879-834b-29cc4cf3ec35`

> Your code is {{pin}}. It's valid for {{code_validity_time}} minutes.Please don't share your code with ANYONE. We'll never call or message you and ask for it.

| Parameter | Value type |
|  --- | --- |
| `pin` | text |
| `code_validity_time` | number |


#### OTP with type of code type

**Template ID:** `82ba31a3-db42-4e87-82e8-33fa92b9e5ed`

> Your {{pin_type}} code is {{pin}}.Please don't share your code with ANYONE. We'll never call or message you and ask for it.

| Parameter | Value type |
|  --- | --- |
| `pin_type` | text |
| `pin` | text |


#### OTP with code type & validity time

**Template ID:** `60d67b38-b9fb-444a-80e6-754447e010c6`

> Your {{pin_type}} code is {{pin}}. It's valid for {{code_validity_time}} minutes.Please don't share your code with ANYONE. We'll never call or message you and ask for it.

| Parameter | Value type |
|  --- | --- |
| `pin_type` | text |
| `pin` | text |
| `code_validity_time` | number |


#### OTP with business/platform name

**Template ID:** `c33cccaf-735f-4d62-8383-a76bf4999e2d`

> {{business_platform_name}}: Your code is {{pin}}.Please don't share your code with ANYONE. We'll never call or message you and ask for it.

| Parameter | Value type |
|  --- | --- |
| `business_platform_name` | text |
| `pin` | text |


#### OTP with business/platform name & validity time

**Template ID:** `6c929cef-29b4-4349-bc9d-2a07bdbb6e43`

> Your {{business_platform_name}} code is {{pin}}. It's valid for {{code_validity_time}} hours.Please don't share your code with ANYONE. We'll never call or message you and ask for it.

| Parameter | Value type |
|  --- | --- |
| `business_platform_name` | text |
| `pin` | text |
| `code_validity_time` | number |


#### OTP with details on OTP action/platform

**Template ID:** `210ee8a9-1ed5-43cd-96e4-65bba311ab40`

> Your one-time password for {{business_platform_action_name}} is {{pin}}.Please don't share your code with ANYONE. We'll never call or message you and ask for it.

| Parameter | Value type |
|  --- | --- |
| `business_platform_action_name` | text |
| `pin` | text |


#### OTP with business/platform name & code reason

**Template ID:** `be56d97b-2a33-4c89-ac5f-f555a2c827d9`

> {{business_platform_name}}: Your code is {{pin}}. You got this code because {{code_reason}}.Please don't share your code with ANYONE. We'll never call or message you and ask for it.

| Parameter | Value type |
|  --- | --- |
| `pin` | text |
| `business_platform_name` | text |
| `code_reason` | text |