How do the dynamic variables in Message Templates work?
Dynamic variables – also known as placeholders or substitutions – allow you to pass dynamic contents to the message while requesting message templates you can specify the dynamic variable like {{1}}, {{2}}. By adding unique parameters, you can personalize information for your customers.
For example, in the template below you can replace {{1}} and {{2}] with your own value when sending a message.
You made a purchase for {{1}} using a credit card ending in {{2}}.
For “namespace”: “cdb2df51_9816_c754_c5a4_64cdabdcad3e” with “element_name”: “purchase_with_credit_card”, the first value you list replaces the {{1}} variable in the template message and the second value you list replaces the {{2}} variable.
Some of these parameters (e.g., date_time or currency) are localizable so that they are displayed appropriately based on the customer’s language and locale preferences. If the device is unsuccessful in localizing a parameter, it falls back to the value that is provided as the “default” value.
When a message request is submitted with a template, you specify the variables, which are textually replaced inside the WhatsApp installation we run for a phone number.
ℹ️ Note that the actual variable content cannot contain new lines, tabulators, and more than four consecutive spaces. Also, WhatsApp will not approve templates with floating parameters, i.e. lines with just parameters and without text. Make sure that you surround the variables with context, so it’s clear what type of data is inserted in the Message Template.