SUPPORT.TWILIO.COM END OF LIFE NOTICE: This site, support.twilio.com, is scheduled to go End of Life on February 27, 2024. All Twilio Support content has been migrated to help.twilio.com, where you can continue to find helpful Support articles, API docs, and Twilio blog content, and escalate your issues to our Support team. We encourage you to update your bookmarks and begin using the new site today for all your Twilio Support needs.

At a Glance: WhatsApp Legacy Templates versus Content Templates

There are important differences between sending WhatsApp template messages using Legacy Templates and Content Templates (Templates submitted via the Twilio Content API/Template Builder). These differences include changes to code and mandatory usage of Messaging Services.

This guide details the main differences between the two systems and what users need to be aware of when implementing Content Templates in their WhatsApp workflow. 

Key Terms

Legacy Templates: Templates submitted in the Twilio Console under Messaging > Senders > WhatsApp Templates.

Content API: API that enables users to create and send rich messaging content over any Twilio-supported messaging channel, not just WhatsApp. Documentation can be found here.

Content Template Builder: Interactive Template Builder that enables users to create, approve, and manage templates from the Twilio Console. Templates can be used on any supported channel, not just WhatsApp. Accessible via Messaging > Content Template Builder. Documentation can be found here.

Sending a message using legacy templates

To send a legacy template, users need to match the message body in the “body” parameter of their API call exactly with the template body as it was created via the Twilio console. This can cause problems with special characters, right to left languages and newlines, leading to error 63016. Often encoded characters or trailing spaces are present in the template body but are missed when sending the message body.

Example of sending a Legacy Template

Raw Template Body:


“Hi {{1}}, thanks for joining our business. \nWe're looking forward to seeing you again soon in store. “

Sending the template with cURL:


curl -X POST "https://api.twilio.com/2010-04-01/Accounts/{account_sid}/Messages.json" \
--data-urlencode "From=whatsapp:+1234567890" \
--data-urlencode "Body=Hi Joe, thanks for joining our business.

We're looking forward to seeing you again soon in store. " \
--data-urlencode "To=whatsapp:+0987654321" \
-u {account_sid}:{auth_token}

Legacy template required API parameters:

  • Body
  • From
  • To

Sending a message with Content Templates

To send a template message using a Content Template, users only need to supply the SID of the template, a Messaging Service SID and the placeholder values, if any. This prevents template mismatch errors that frequently occur using the legacy template system.

Example of sending a Content Template

 Raw Template Body:


“Hi {{1}} thanks for reaching out. \nHow can I help you today? “

Code Snippet:


curl -X POST https://api.twilio.com/2010-04-01/Accounts/{account_sid}/Messages \
--data-urlencode "To=whatsapp:+1234567890" \
--data-urlencode "MessagingServiceSid={messaging_service_sid}" \
--data-urlencode "From=whatsapp:+0987654321" \
--data-urlencode "ContentSid={template_sid}" \
--data-urlencode 'ContentVariables={"1": "Josephine"}' \
-u {account_sid}:{auth_token}

Content template required parameters:

  • From/Messaging Service SID (Can be in the From field or a MessagingServiceSid field)
  • Content SID
  • Content Variables
  • To

Helper Libraries

The Content API is partially supported by our helper libraries for all endpoints that don’t use a JSON body. Users must make sure their helper library is up to date to ensure all features are available for use. 

Required Messaging Services Usage

Content Templates require a ​​Messaging Service to work. This limitation is due to be removed in the first half of 2024. There are two options available to send Content Templates depending on your use case:

  1. Add your WhatsApp Sender(s) to the Messaging Service Sender Pool for automatic sender selection

    You can add one or multiple WhatsApp Senders to a Messaging Service and the Sender Pool logic will select a Sender automatically. You can include the Messaging Service in your API call using either the “From” parameter or the “MessagingServiceSID” parameter.

  2. Chose a specific WhatsApp Sender

    You can decide which WhatsApp Sender you want to use to send your Content Templates. Add the Sender in the “From” parameter of your API call. You will need to include a ​​Messaging Service SID in the “MessagingServiceSID” parameter, but the WhatsApp Sender does not need to be added to the Sender Pool.

Parameter Comparison Table

480px-Eo_circle_light-blue_checkmark.svg.png Supported but not required 480px-Eo_circle_green_checkmark.svg.png Required 480px-Eo_circle_red_no-entry.svg.png Not supported

 

API Parameter Legacy Templates Content Templates
Messaging Service 480px-Eo_circle_light-blue_checkmark.svg.png 480px-Eo_circle_green_checkmark.svg.png
From 480px-Eo_circle_green_checkmark.svg.png 480px-Eo_circle_light-blue_checkmark.svg.png
To 480px-Eo_circle_green_checkmark.svg.png 480px-Eo_circle_green_checkmark.svg.png
Content SID 480px-Eo_circle_red_no-entry.svg.png 480px-Eo_circle_green_checkmark.svg.png
Content Variables 480px-Eo_circle_red_no-entry.svg.png 480px-Eo_circle_light-blue_checkmark.svg.png

Body

480px-Eo_circle_green_checkmark.svg.png 480px-Eo_circle_red_no-entry.svg.png

Media URL

480px-Eo_circle_light-blue_checkmark.svg.png 480px-Eo_circle_red_no-entry.svg.png

 

FAQS

Can I use Legacy Templates and Content Templates at the same time?

Templates submitted through the Legacy Template console cannot be sent in the same way that Content Templates and vice versa. You can utilize both in your code at the same time, but you will have to differentiate between the two types at send time. 

Can I migrate all my legacy templates to content templates?

Yes! Please refer to the steps here for Self-Service template copy.

Where can I find documentation for Content API and Content Template Builder?

You can find Content API docs here and Content Template Builder docs here.

Have more questions? Submit a request
Powered by Zendesk