Yes, the Verify Templates feature, currently in beta, allows you to customize the message to send for SMS or Voice verifications to your users. By default, Verify uses a set of default templates, however, there are two template options that give you control beyond this default template:
- Pre-Approved Templates: a comprehensive collection of curated templates that include the most commonly used wording tailored for different use cases. These templates are crafted to ensure ease of use and applicability across a wide range of scenarios.
- Custom Templates: these are personalized templates that you create and must undergo approval and registration. They are made available on a case-by-case basis, allowing for tailored solutions to meet specific requirements.
To get started, you can take a look at our pre-approved templates to confirm if one of them works for your use case. You can also list available templates with the request below, getting available pre-approved and custom templates. For each template, you will get the friendly name, template SID, locales, and channels available.
curl -X GET "https://verify.twilio.com/v2/Templates?PageSize=20" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
Once you have the Template SID of the template you want to use, you have two options, set it as the default template for your Verify service, or use it in each verification.
Setting a specific template as default for your Verify service:
curl-X POST https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX \
--data-urlencode "DefaultTemplateSid=HJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"\
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
Setting the template to be used at Verification creation:
curl-X POST https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Verifications \
--data-urlencode "To=+15017122661"\--data-urlencode "Channel=sms"\
--data-urlencode "TemplateSid=HJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"\
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
For more information on how to implement this feature, please refer to our documentation.
How to request a custom template
If one of our pre-approved templates does not work for your use case, you can request a custom template. Make sure to collect the following information before you start the process:
- Your account SID.
- Your Verify service SID.
-
The message body you want to register.
- Follow the instructions below to build it.
- If you're registering multiple templates or translations, use the CSV format.
- The message body locales you want to use, along with the default locale.
- The name you want to assign to the custom template.
- Confirm if the template will be used to send traffic to Canada, Singapore, Malaysia or China.
- Make sure to confirm the verification expiration time if you include the ttl variable in the template.
To build the message body:
- You must include the code variable
{{code}} | The 4-10 digit one-time passcode. |
- Optionally, you might include the following variables:
{{friendly_name}} | The friendly name of your Verification Service. |
{{ttl}} | The expiration time of the one-time passcode in minutes. |
- Check the message body you want in the segment calculator. Ideally, your template should have just 1 segment (be aware that you're charged per segment), but it's fine to have a longer SMS as long as you agree with the additional charges. To learn more, check: What The Heck Is A Segment?
- If your template has several locales, submit a CSV file in the format below.
CSV format to request several locales:
templateName
|
channels |
locale |
isDefaultLocale |
messageBody |
---|---|---|---|---|
Example template |
sms |
en |
TRUE |
Your {{friendly_name}} verification code is: {{code}} |
Example template |
sms |
fr |
FALSE |
Votre code de vérification {{friendly_name}} est: {{code}} |
Example template |
sms |
de |
FALSE |
Dein {{friendly_name}} Sicherheitscode lautet: {{code}} |
To request the private template registration, contact our Twilio Support Team with the information above.
Notice: The registration of custom templates can take about 2-4 weeks
If your request is successful, you'll find your custom templates by navigating on Console to Verify > Settings > Templates Management.
You can Approve or Reject the translations
Once the template and its translations are approved by you, you'll be able to use it as described above.
FAQs
Can I submit languages that Verify doesn’t support?
Although our language support for the Verify Default template is limited, we have a longer list of supported locales for custom templates. Please check Verify Supported Languages page
Be aware that if you try to use a locale we don't support, you'd get error 60331.
Will I get a unique template for each language I register?
No, you can register a list of translations per a single template ID. Then, you can pass in the appropriate language within the locale
parameter.
You must provide the translated body messages
If for some reason I pass a locale that is not defined in the template, can we expect that the message will default to English?
If you pass a locale that is not defined in the template, we'll fall back to the default locale you defined at template creation. For Verify Default templates and pre-approved templates, the default will be English.