Template Variables Validations
Validation rules
Validation rules for variables used in Viber OTP templates.
Supported variable types
Variables in OTP templates are validated as one of two types:
| Type | Description | Max length |
|---|---|---|
| Text | Letters, digits, spaces, and special characters | 50 characters |
| Number | A single numeric value (integer) | 50 digits |
Validation rules by type
Text
| Rule | Details |
|---|---|
| Content | Letters, digits, spaces, and special characters are allowed. |
| Length | Maximum 50 characters. |
| Links | Not allowed. Do not include URLs or clickable links in text variables. |
Examples — valid
MyAppVerification codeAcme Bank (Support)You requested a password reset
Examples — invalid
https://example.com/verify— links are not allowed- A string longer than 50 characters — exceeds maximum length
Number
| Rule | Details |
|---|---|
| Content | A single numeric value only (no decimals unless the template expects them; for validity time, use integers). |
| Spaces | No spaces before or after the number. |
| Length | Maximum 50 digits. |
Examples — valid
123456(e.g. PIN)5,10,15(e.g. validity in minutes)
Examples — invalid
5— spaces before or after5 minutes— non-numeric text1.5— only use if the template explicitly supports decimals (for OTP validity, use integers)
Which parameters are Text vs Number?
Use the type that matches the template variable. From the templates inventory:
| API parameter (camelCase) | Type | Used in templates |
|---|---|---|
pin | Text | All (typically digits, but can include letters if your flow allows) |
businessPlatformName | Text | 3, 6, 9 |
pinType | Text | 5, 7 |
businessPlatformActionName | Text | 8 |
codeReason | Text | 9 |
codeValidityTime | Number | 4, 5, 6 (minutes) |
Ensure codeValidityTime is sent as a number (e.g. 5, 1), not a string (e.g. "5" may or may not be accepted depending on the API).
Quick checklist
Before sending an OTP request:
- Text parameters: No URLs or links; length ≤ 50 characters.
- Number parameters: Single numeric value, no leading/trailing spaces;
codeValidityTimein minutes for templates 4, 5, and 6. - Template ID: Use the correct template ID for your chosen template (for template 6, use
6c929cef-29b4-4349-bc9d-2a07bdbb6e43). - Required parameters: All variables required by the chosen template are present and non-empty.
Updated 8 days ago
