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.

How do I add variables to a content template?

Objective

This article shows you how to personalize a content template with variables, so a single template can insert a customer name, order number, or link at send time, and how to supply the sample values WhatsApp requires for approval.

 

Product

Content Template Builder

 

Environment

Twilio Console

 

User Account Permission/Role(s) Required

Your user needs the content templates create permission for the account to edit template content.

 

Procedure

  1. In the Twilio Console, select Communications in the left sidebar.
  2. Select Messaging, then Templates.
  3. Open the template you want to personalize, or start a new one.
  4. On the Details tab, place your cursor in the field where the personalized value should go, for example Body.
  5. Select Add variable beneath that field. A numbered placeholder is inserted at the cursor position, in the form {{1}}.
  6. Repeat step 5 for every value you want to personalize, in any supported field.
  7. Select Save.
  8. In the Sample variables panel, enter a sample value for each variable under Sample for: {{1}}, and so on. The panel shows the original field value and the value with your samples applied so you can check the result.
  9. Select Save to finish.

 

Additional Information

  • Variables must be written as {{variableName}}. A malformed placeholder or one containing white space fails validation.
  • Sample values are required for every variable in the panel.
  • Some fields limit how many variables they accept. A website address, for example, accepts at most one variable, and it cannot sit inside the host name.
  • A few fields do not support variables at all, the card Subtitle is one, and on a call to action button the Button text only accepts variables when the action type is Voice call.
  • WhatsApp requires a sample for each variable in order to approve a template. If you skip the samples now, you will not be able to submit the template for WhatsApp approval later.
  • The Sample variables panel only appears if the template actually contains variables, and it collects samples for the richest content type in the template.

 

This content was generated by AI and reviewed, edited, and verified by a human.

Have more questions? Submit a request
Powered by Zendesk