Menu

Expand
Rate this page:

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.

See special restrictions for sending SMS to Singapore or Canada.

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
  • Transactional PSD2/SCA compliant message format: Enable the PSD2 compliant message format for the Verify Default template by navigating to Twilio Console > Verify > Services page and selecting your Service. On the Settings page under the General tab and turning on Transactional PSD2 compliant message.
  • “Do not share” warning message addendum: Add a “Do not share” addendum to the Verify Default template by navigating to Twilio Console > Verify > Services page and selecting your Service. On the Settings page under the General tab and turning on “Do not share” warning message.

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

  • Navigate to Twilio Console > Verify > Services page and select your Verify Service.
  • On the Settings page under the General tab, select a Message body under the Template configuration heading.
  • Check the Message preview section for the SMS and/or Call icons. The presence of these icons indicates that the selected template is supported by that channel.

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.

123456 is your Example code.

@example.com #123456

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:

Loading Code Sample...
        
        

        Set a Template for an Individual Verification

        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

        Use the Create or Update a Service endpoint with the desired DefaultTemplateSid.

        Loading Code Sample...
              
              

              Create a Verification Service with a Default Template

              Loading Code Sample...
                    
                    

                    Update a Verification Service to Use a Default Template

                    Template override priority

                    The message template used for a Verification is defined with the following priority order, from first to last priority:

                    1. A TemplateSid provided in the create Verification request.
                    2. A DefaultTemplateSid set for the Verify Service.
                    3. The Verify Default template.
                    Rate this page:

                    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.

                    Loading Code Sample...
                          
                          
                          

                          Thank you for your feedback!

                          Please select the reason(s) for your feedback. The additional information you provide helps us improve our documentation:

                          Sending your feedback...
                          🎉 Thank you for your feedback!
                          Something went wrong. Please try again.

                          Thanks for your feedback!

                          thanks-feedback-gif