Skip to contentSkip to navigationSkip to topbar
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.

FeatureDetails
How to UseNo 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 MaturityGA (General Availability) - all customers can use this feature without restriction.
Channel SupportSMS, Voice, and WhatsApp channels can all send the Verify Default template.
Language SupportSee 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(link takes you to an external page) 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(link takes you to an external page) page and selecting your Service. On the Settings page under the General tab and turning on "Do not share" warning message.

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
FeatureDetails
How to UseNavigate 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.
Feature MaturityPublic Beta - We're actively looking for early-adopter customers to try it out and give us feedback.
Channel SupportSMS 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.
Language SupportSee Verify Supported Languages page.

Checking what channels a template supports via Twilio Console

checking-what-channels-a-template-supports-via-twilio-console page anchor
  • 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

checking-what-channels-a-template-supports-via-api page anchor

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.


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.

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

FeatureDetails
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'. 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 VerificationLink to code sample: Set a Template for an Individual Verification
1
curl -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

Output

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": null
27
}
28
],
29
"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-twilio-console page anchor

Setting a Service-level default template via API

setting-a-service-level-default-template-via-api page anchor

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

Create a Verification Service with a Default Template.Link to code sample: Create a Verification Service with a Default Template.
1
curl -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

Output

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": null
17
},
18
"totp": {
19
"issuer": "test-issuer",
20
"time_step": 30,
21
"code_length": 3,
22
"skew": 2
23
},
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
}
Update a Verification Service to Use a Default Template.Link to code sample: Update a Verification Service to Use a Default Template.
1
curl -X POST https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX \
2
--data-urlencode "DefaultTemplateSid=HJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" \
3
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN

Output

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": 2
23
},
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
}

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.

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.