Getting Started with Verification Templates
Templates are predefined and approved messages used to send Verifications. An account can have multiple templates associated with it to accommodate various scenarios like user authentication, account validation, password resets, and more!
In this guide, we'll explain the capabilities of the available template types and how to use them with your Verify Service.
Verify offers three different types of templates to support your use cases. To see more details, click on the template type to jump to that section.
- Verify Default Template is used automatically if no actions are taken to use a pre-approved or custom template.
- Pre-approved Templates have a variety of message body options and are available for immediate use to all Verify customers.
- Custom Templates have message bodies that are provided by the customer and are available on a case-by-case basis.
Verify Default template
The Verify Default template is used automatically if no actions are taken to use a pre-approved or custom template.
The message body in English is currently: Your {Service Friendly Name} verification code is: {code}
. Message bodies are subject to change, as they are continuously optimized to maximize clarity and OTP conversion, while minimizing message segment cost across languages.
How to Use | No action required. The Verify Default template is used automatically if a specific template is not selected when creating a new Verification and your Verify Service does not have a default pre-approved or custom template set. |
Feature Maturity | GA (General Availability) - all customers can use this feature without restriction. |
Channel Support | SMS, Voice, and WhatsApp channels can all send the Verify Default template. |
Language Support | See Verify Supported Languages page. |
Special Features |
|
Pre-approved templates
Pre-approved templates offer a variety of message body options beyond the Verify Default template, and are available for immediate use to all Verify customers.
There are three variables that can be used in pre-approved templates.
{{friendly_name}}
: Friendly name of your Verification Service{{code}}
: 4-10 digit one-time passcode{{ttl}}
: Expiration time of the one-time passcode in minutes
How to Use | You can select a pre-approved template to use for an individual Verification by or make it the default for every Verification sent through a Verify Service. |
Feature Maturity | Public Beta - We're actively looking for early-adopter customers to try it out and give us feedback. |
Channel Support |
SMS and Voice channels have the ability to send pre-approved templates. Before you select a template, check to make sure it’s supported by your preferred channel. Checking what channels a template supports via Twilio Console
Checking what channels a template supports via API
If you select a channel that the template does not support, or your Account does not have this feature enabled, the Verification will fallback to the Verify Default template for the selected channel. |
Language Support | See Verify Supported Languages page. |
Custom templates
Custom templates have a unique message body that is provided by the template requester and are available on a case-by-case basis.
Read this support article for more information on how to request a custom template if our other templates do not suit your business needs.
How to Use | Once a custom template has been approved, created, and added to your Account, you can select a custom template for an individual Verification or make it the default for every Verification sent through a Verify Service. |
Feature Maturity | Public Beta - We're actively looking for early-adopter customers to try it out and give us feedback. |
Channel Support |
SMS and Voice. If you select a channel that the template does not support, the Verification will fallback to the Verify Default template for the selected channel. |
Language Support | See Verify Supported Languages page. |
Special Features |
Custom templates can be used to support SMS domain-bound codes with the WebOTP API.
|
How to set a template for an individual Verification
You can choose a specific pre-approved or custom template for an individual Verification sent using the Verify API:
- View available templates using the Get a List of Available Templates endpoint.
- Identify the
TemplateSid
of the template you want to use, it will be in the formatHJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
. - Create a new Verification using the Start a New Verification endpoint with the desired
TemplateSid
.
How to set a default template for a Verification Service
You can select a specific pre-approved or custom template as the default for a Service that will be used for all SMS and Voice verifications (unless you explicitly override it). This can be done using either Twilio Console or the Verify API
Setting a Service-level default template via Twilio Console
- Navigate to Twilio Console > Verify > Services page and select your Verify Service.
- On the Settings page under the General tab, select your desired Message body under the Template configuration heading.
- Save the Service setting changes.
Setting a Service-level default template via API
- View available templates using the Get a List of Available Templates endpoint.
- Identify the
TemplateSid
of the template you want to use, it will be in the formatHJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
.
Use the Create or Update a Service endpoint with the desired DefaultTemplateSid
.
Template override priority
The message template used for a Verification is defined with the following priority order, from first to last priority:
- A
TemplateSid
provided in the create Verification request. - A
DefaultTemplateSid
set for the Verify Service. - The Verify Default template.
Need some help?
We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd by visiting Twilio's Stack Overflow Collective or browsing the Twilio tag on Stack Overflow.