Skip to contentSkip to navigationSkip to topbar
Rate this page:
On 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 four 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.
  • WhatsApp Authentication Templates are used to send your OTP messages via WhatsApp.
(information)

Info


Verify Default template

verify-default-template page anchor

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(link takes you to an external page) across languages.

How to Use: Feature Maturity

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.:

GA (General Availability) - all customers can use this feature without restriction.

How to Use: Channel Support

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.:

SMS, Voice, and WhatsApp channels can all send the Verify Default template.

How to Use: Language Support

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.:

See Verify Supported Languages page.

How to Use: Special Features

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.:


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: Feature Maturity

You can :

Public Beta - We're actively looking for early-adopter customers to try it out and give us feedback.

How to Use: Channel Support

You can :

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(link takes you to an external page) 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.

How to Use: Language Support

You can :

See Verify Supported Languages page.


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(link takes you to an external page) for more information on how to request a custom template if our other templates do not suit your business needs.

How to UseOnce 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 MaturityPublic Beta - We're actively looking for early-adopter customers to try it out and give us feedback.
Channel SupportSMS 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 SupportSee Verify Supported Languages page.
Special FeaturesCustom templates can be used to support SMS domain-bound codes(link takes you to an external page) with the WebOTP API(link takes you to an external page). 123456 is your Example code. @example.com #123456

How to set a template for an individual Verification

how-to-set-a-template-for-an-individual-verification page anchor

You can choose a specific pre-approved or custom template for an individual Verification sent using the Verify API:


WhatsApp Authentication Templates

whatsapp-authentication-templates page anchor

Effective March 1, 2024, all Verify WhatsApp OTP messages will switch to being sent via Copy Code Authentication Templates(link takes you to an external page) that are pre-defined by Meta, instead of Verify Default Templates.

How to UseVerify will auto-create Copy Code Authentication templates in 71 languages once you've brought your own WhatsApp Sender in the WhatsApp Settings for your Verify Service. Click on the ' verify_auto_created' template under Console > Messaging > Content Template Builder(link takes you to an external page) to confirm WhatsApp approval status = Approved before issuing OTP messages via WhatsApp. Verify WhatsApp currently does not support the security disclaimer and expiration warning optional parameters for the Copy Code Authentication Templates.
Feature MaturityPublic Beta - We're actively migrating customers to bring their own WhatsApp Senders to continue using Twilio Verify WhatsApp.
Channel SupportYour WhatsApp Authentication Templates will appear in Console > Messaging > Content Template Builder(link takes you to an external page). The English language template will be used as the default if the locale parameter value does not exist. Since Verify has auto-created these authentication templates on your behalf, please do NOT duplicate or delete any existing template named ' verify_auto_created'. Contact support(link takes you to an external page) if you would like to discuss making any changes. If you attempt to send an OTP message via Verify WhatsApp verification to India, we will fall-back to using SMS as the selected channel.
Language SupportSee Verify Supported Languages page.

Set a Template for an Individual Verification

set-a-template-for-an-individual-verification page anchor
curl

_10
curl -X POST https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Verifications \
_10
--data-urlencode "To=+15017122661" \
_10
--data-urlencode "Channel=sms" \
_10
--data-urlencode "TemplateSid=HJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" \
_10
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN

Output

_30
{
_30
"sid": "VEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_30
"service_sid": "VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_30
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_30
"to": "+15017122661",
_30
"channel": "sms",
_30
"status": "pending",
_30
"valid": false,
_30
"date_created": "2015-07-30T20:00:00Z",
_30
"date_updated": "2015-07-30T20:00:00Z",
_30
"lookup": {
_30
"carrier": {
_30
"error_code": null,
_30
"name": "Carrier Name",
_30
"mobile_country_code": "310",
_30
"mobile_network_code": "150",
_30
"type": "mobile"
_30
}
_30
},
_30
"amount": null,
_30
"payee": null,
_30
"send_code_attempts": [
_30
{
_30
"time": "2015-07-30T20:00:00Z",
_30
"channel": "SMS",
_30
"channel_id": null
_30
}
_30
],
_30
"url": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Verifications/VEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_30
}


How to set a default template for a Verification Service

how-to-set-a-default-template-for-a-verification-service page anchor

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

Setting a Service-level default template via API

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

Create a Verification Service with a Default Template.

create-a-verification-service-with-a-default-template page anchor
curl

_10
curl -X POST https://verify.twilio.com/v2/Services \
_10
--data-urlencode "FriendlyName=My Verify Service" \
_10
--data-urlencode "DefaultTemplateSid=HJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" \
_10
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN

Output

_36
{
_36
"sid": "VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_36
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_36
"friendly_name": "My Verify Service",
_36
"code_length": 4,
_36
"lookup_enabled": false,
_36
"psd2_enabled": false,
_36
"skip_sms_to_landlines": false,
_36
"dtmf_input_required": false,
_36
"tts_name": "name",
_36
"do_not_share_warning_enabled": false,
_36
"custom_code_enabled": true,
_36
"push": {
_36
"include_date": true,
_36
"apn_credential_sid": "CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_36
"fcm_credential_sid": null
_36
},
_36
"totp": {
_36
"issuer": "test-issuer",
_36
"time_step": 30,
_36
"code_length": 3,
_36
"skew": 2
_36
},
_36
"date_created": "2015-07-30T20:00:00Z",
_36
"date_updated": "2015-07-30T20:00:00Z",
_36
"url": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_36
"links": {
_36
"verification_checks": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/VerificationCheck",
_36
"verifications": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Verifications",
_36
"rate_limits": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/RateLimits",
_36
"messaging_configurations": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/MessagingConfigurations",
_36
"entities": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Entities",
_36
"webhooks": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Webhooks",
_36
"access_tokens": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AccessTokens"
_36
}
_36
}

Update a Verification Service to Use a Default Template.

update-a-verification-service-to-use-a-default-template page anchor
curl

_10
curl -X POST https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX \
_10
--data-urlencode "DefaultTemplateSid=HJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" \
_10
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN

Output

_36
{
_36
"sid": "VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_36
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_36
"friendly_name": "name",
_36
"code_length": 7,
_36
"lookup_enabled": false,
_36
"psd2_enabled": false,
_36
"skip_sms_to_landlines": false,
_36
"dtmf_input_required": false,
_36
"tts_name": "name",
_36
"do_not_share_warning_enabled": false,
_36
"custom_code_enabled": true,
_36
"push": {
_36
"include_date": true,
_36
"apn_credential_sid": null,
_36
"fcm_credential_sid": "CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_36
},
_36
"totp": {
_36
"issuer": "test-issuer",
_36
"time_step": 30,
_36
"code_length": 3,
_36
"skew": 2
_36
},
_36
"date_created": "2015-07-30T20:00:00Z",
_36
"date_updated": "2015-07-30T20:00:00Z",
_36
"url": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_36
"links": {
_36
"verification_checks": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/VerificationCheck",
_36
"verifications": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Verifications",
_36
"rate_limits": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/RateLimits",
_36
"messaging_configurations": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/MessagingConfigurations",
_36
"entities": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Entities",
_36
"webhooks": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Webhooks",
_36
"access_tokens": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AccessTokens"
_36
}
_36
}


Template override priority

template-override-priority page anchor

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: