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.
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: 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 minutesHow 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
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 :
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 |
You can choose a specific pre-approved or custom template for an individual Verification sent using the Verify API:
TemplateSid
of the template you want to use, it will be in the format HJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
.TemplateSid
.Effective March 1, 2024, all Verify WhatsApp OTP messages will switch to being sent via Copy Code Authentication Templates that are pre-defined by Meta, instead of Verify Default Templates.
How to Use | Verify 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 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 Maturity | Public Beta - We're actively migrating customers to bring their own WhatsApp Senders to continue using Twilio Verify WhatsApp. |
Channel Support | Your WhatsApp Authentication Templates will appear in Console > Messaging > Content Template Builder. 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 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 Support | See Verify Supported Languages page. |
1curl -X POST https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Verifications \2--data-urlencode "To=+15017122661" \3--data-urlencode "Channel=sms" \4--data-urlencode "TemplateSid=HJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" \5-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
1{2"sid": "VEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",3"service_sid": "VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",4"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",5"to": "+15017122661",6"channel": "sms",7"status": "pending",8"valid": false,9"date_created": "2015-07-30T20:00:00Z",10"date_updated": "2015-07-30T20:00:00Z",11"lookup": {12"carrier": {13"error_code": null,14"name": "Carrier Name",15"mobile_country_code": "310",16"mobile_network_code": "150",17"type": "mobile"18}19},20"amount": null,21"payee": null,22"send_code_attempts": [23{24"time": "2015-07-30T20:00:00Z",25"channel": "SMS",26"channel_id": null27}28],29"url": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Verifications/VEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"30}
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
TemplateSid
of the template you want to use, it will be in the format HJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
.Use the Create or Update a Service endpoint with the desired DefaultTemplateSid
.
1curl -X POST https://verify.twilio.com/v2/Services \2--data-urlencode "FriendlyName=My Verify Service" \3--data-urlencode "DefaultTemplateSid=HJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" \4-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
1{2"sid": "VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",3"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",4"friendly_name": "My Verify Service",5"code_length": 4,6"lookup_enabled": false,7"psd2_enabled": false,8"skip_sms_to_landlines": false,9"dtmf_input_required": false,10"tts_name": "name",11"do_not_share_warning_enabled": false,12"custom_code_enabled": true,13"push": {14"include_date": true,15"apn_credential_sid": "CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",16"fcm_credential_sid": null17},18"totp": {19"issuer": "test-issuer",20"time_step": 30,21"code_length": 3,22"skew": 223},24"date_created": "2015-07-30T20:00:00Z",25"date_updated": "2015-07-30T20:00:00Z",26"url": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",27"links": {28"verification_checks": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/VerificationCheck",29"verifications": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Verifications",30"rate_limits": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/RateLimits",31"messaging_configurations": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/MessagingConfigurations",32"entities": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Entities",33"webhooks": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Webhooks",34"access_tokens": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AccessTokens"35}36}
1curl -X POST https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX \2--data-urlencode "DefaultTemplateSid=HJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" \3-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
1{2"sid": "VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",3"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",4"friendly_name": "name",5"code_length": 7,6"lookup_enabled": false,7"psd2_enabled": false,8"skip_sms_to_landlines": false,9"dtmf_input_required": false,10"tts_name": "name",11"do_not_share_warning_enabled": false,12"custom_code_enabled": true,13"push": {14"include_date": true,15"apn_credential_sid": null,16"fcm_credential_sid": "CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"17},18"totp": {19"issuer": "test-issuer",20"time_step": 30,21"code_length": 3,22"skew": 223},24"date_created": "2015-07-30T20:00:00Z",25"date_updated": "2015-07-30T20:00:00Z",26"url": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",27"links": {28"verification_checks": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/VerificationCheck",29"verifications": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Verifications",30"rate_limits": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/RateLimits",31"messaging_configurations": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/MessagingConfigurations",32"entities": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Entities",33"webhooks": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Webhooks",34"access_tokens": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AccessTokens"35}36}
The message template used for a Verification is defined with the following priority order, from first to last priority:
TemplateSid
provided in the create Verification request.DefaultTemplateSid
set for the Verify Service.