Use the Brevo Template Language to personalize your messages with contact- or event-specific data, hide or display content to specific recipients, and adjust how values are formatted.
💬 Variables
Variables, also known as placeholders or merge tags, are tags that you can insert into your messages to personalize them. When you send a message, each variable is automatically replaced with the corresponding contact's information.
Variables must be enclosed within double curly brackets, like {{ ... }} or {{...}}. They can be used for simple insertions or combined with conditional statements and filters for advanced personalization.
| Variable type | Use case |
|---|---|
| 👤 Contact variables | Static contact attributes (name, email…) |
| ⚡ Event variables | Data from a triggered action |
| 🛢️ Data feed variables | Real-time data from an external source |
| 🛒 Product feed variables | Dynamic product listings |
| 📦 Object variables | Custom object attributes |
| 📅 Date variable | Send timestamp |
| 🔗 Email link and preview variables | Mirror, unsubscribe, update profile, and double opt-in links |
👤 Contact variables
| Available for: | ✅ SMS | ✅ Push |
The syntax is {{ contact.ATTRIBUTE }}, where you should replace ATTRIBUTE with the exact name of the contact attribute as it appears on the Contact attributes page. Both default and custom attributes are supported.
For example:
| Input | Description | Output |
|---|---|---|
| {{ contact.EMAIL }} | Email address (default) | abby@the-green-yoga.com |
| {{ contact.FIRSTNAME }} | First name (default) | Abby |
| {{ contact.SMS }} | Phone number (default) | +12152688872 |
| {{ contact.LANGUAGE }} | Language (custom) | English |
➡️ To learn more, check our dedicated articles:
⚡ Event variables
| Available for: | ✅ Email (triggered only) |
✅ SMS (triggered only) |
✅ WhatsApp (triggered only) |
✖️ Push |
Event variables let you display data from specific events triggered by a contact's actions, such as the price of their last purchased item or the name of the meeting they booked.
To identify the available variables, check your API call or event logs in Brevo. The examples below are based on the following JSON structure:
|
data is the root object containing the following properties:
|
The root object (data above) is mandatory. All other properties are optional and can be named as needed.
Depending on where your data is stored in the JSON structure, the syntax varies:
Data stored directly under the root object typically contains key event details, such as cart information, and can be retrieved without needing to loop through arrays.
The syntax is {{ params.property }}, where you should replace property with the exact name of the property under the root object in your JSON structure.
Given the JSON structure above:
| Input | Description | Output |
|---|---|---|
| {{ params.id }} | Cart ID | cart:1234 |
| {{ params.total }} | Cart total | 280 |
| {{ params.currency }} | Cart currency | USD |
| {{ params.url }} | Cart URL | https://www.example.com |
Arrays stored under the root object, such as the items array above, can contain multiple elements, each with its own properties. Use indexing to reference specific elements, or a for loop to iterate over all of them.
Use indexing to reference specific elements
The syntax for indexing is {{ params.array.index.property }}, where you should replace each placeholder as follows:
- array with the exact name of the array under the root object in your JSON structure.
- index with the position of the element you want to reference, starting from 0 for the first element.
- property with the exact name of the property within the array element in your JSON structure.
Given the JSON structure above:
| Input | Description | Output |
|---|---|---|
| {{ params.items.0.name }} | First item name | Black shoes |
| {{ params.items.1.name }} | Second item name | White shirt |
Use a for loop to iterate over all elements
The syntax with a for loop is {% for item in params.array %} {{ item.property }} {% endfor %}, where you should replace each placeholder as follows:
- array with the exact name of the array under the root object in your JSON structure.
- property with the exact name of the property within the array element in your JSON structure.
Given the JSON structure above:
| Input | Description | Output |
|---|---|---|
| {% for item in params.items %} {{ item.name }} {% endfor %} | All item names |
Black shoes White shirt |
➡️ To learn more about for loops, check our dedicated article [Manual] Repeat a block of items in your emails using for loops.
🛢️ Data feed variables
| Available for: | ✅ SMS | ✖️ Push |
Data feed variables let you pull real-time data from an external source or API directly into your messages. To identify the available variables, go to Settings > Data management > Data feeds and check your source file structure:
Depending on the complexity of your data feed structure, the format varies:
Data stored directly under the root object typically contains the most relevant, immediate entity in your feed, such as the next upcoming event or latest product, and can be retrieved without needing to loop through arrays.
The syntax is {{ feed.feedalias.variable }}, where you should replace each placeholder as follows:
- feedalias with the exact alias name of your data feed, matching the spelling and case as it appears on the Data feeds page.
- variable with the specific variable or field name you want to display.
Given the data feed above:
| Input | Description | Output |
|---|---|---|
| {{ feed.next_yoga_class.class_name }} | Class name | Sunrise Vinyasa |
| {{ feed.next_yoga_class.studio_location }} | Studio location | Downtown Studio |
| {{ feed.next_yoga_class.date }} | Class date | 2025-03-07 |
| {{ feed.next_yoga_class.time }} | Class time | 06:30 AM |
Arrays stored under the root object can contain multiple elements, each with its own properties. Use indexing to reference specific elements, or a for loop to iterate over all of them.
Use indexing to reference specific elements
The syntax for indexing is {{ feed.feedalias.array.index.variable }}, where you should replace each placeholder as follows:
- feedalias with the exact alias name of your data feed, matching the spelling and case as it appears on the Data feeds page.
- array with the name of the array that contains the values for each item.
- index with the position of the specific item you want to display, starting from 0 for the first item.
- variable with the specific variable or field name you want to display, e.g., name, price, or date.
Given the data feed above:
| Input | Description | Output |
|---|---|---|
| {{ feed.yoga_classes.following_classes.0.class_name }} | First class name | Power Flow Yoga |
| {{ feed.yoga_classes.following_classes.1.class_name }} | Second class name | Evening Restorative |
Use a for loop to iterate over all elements
The syntax with a for loop is {% for item in feed.feedalias.array %} {{ item.variable }} {% endfor %}, where you should replace each placeholder as follows:
- feedalias with the exact alias name of your data feed, matching the spelling and case as it appears on the Data feeds page.
- array with the name of the array that contains the values for each item.
- variable with the specific variable or field name you want to display, e.g., name, price, or date.
Given the data feed above:
| Input | Description | Output |
|---|---|---|
| {% for item in feed.yoga_classes.following_classes %} {{ item.class_name }} {% endfor %} | All class names |
Power Flow Yoga Evening Restorative Hatha Yoga Basics Yin Yoga & Meditation ... |
➡️ To learn more about for loops, check our dedicated article [Manual] Repeat a block of items in your emails using for loops.
🛒 Product feed variables
| Available for: | ✅ SMS | ✖️ Push |
Product feed variables let you display a dynamic list of products from your online store, including details like name, description, prices, images, and availability.
The syntax is {{ feed.feedalias.products.variable }}, where you should replace each placeholder as follows:
- feedalias with the exact name of your product feed, matching the spelling and case as it appears on the Product feeds page.
- variable with the field name you want to display.
Given the product feed above:
| Input | Description | Output |
|---|---|---|
| {{ feed.mats_bestseller.products.imageUrl }} | Product image | |
| {{ feed.mats_bestseller.products.name }} | Product name | Non-slip yoga mat - 6mm |
| {{ feed.mats_bestseller.products.url }} | Product URL | https://thegreenyoga.com/non-slip/black-mat.html |
Use a for loop to iterate over all elements
The syntax with a for loop is {% for item in feed.feedalias.products %} {{ item.variable }} {% endfor %}, where you should replace each placeholder as follows:
- feedalias with the exact alias name of your data feed, matching the spelling and case as it appears on the Data feeds page.
- variable with the specific variable or field name you want to display, e.g., name, price, or date.
Given the product feed above:
| Input | Description | Output |
|---|---|---|
|
{% for item in feed.mats_bestseller.products %} {{ item.name }} {% endfor %} |
All product names |
Non-slip yoga mat - 6mm Yoga block - 4inch High waist wide leg yoga pants |
➡️ To learn more about for loops, check our dedicated article [Manual] Repeat a block of items in your emails using for loops.
📦 Object variables
| Available for: | ✅ Email (automation only) |
✅ SMS (automation only) |
✖️ Push |
Object variables let you include details about your custom objects or their associated objects in your messages. They can only be used in automations, as they rely on a specific object record being the automation trigger.
To build object variables, you will need the object name and attribute IDs from the Custom objects settings page. Depending on which data you want to display, the syntax varies:
Object data variables let you display attributes from the custom object record that triggered the automation, such as a quote amount or creation date.
The syntax is {{ feed.object.attributes.variable }}, where you should replace each placeholder as follows:
- object with the singular name of your custom object as defined when you created it.
- variable with the attribute ID you want to display, e.g., name, amount, or date. You can find attribute IDs by clicking the object name from the Custom objects settings page.
Given a quote object with attributes amount, date, id_quote, and paid:
| Input | Description | Output |
|---|---|---|
| {{ feed.quote.attributes.amount }} | Quote amount | 350 |
| {{ feed.quote.attributes.date }} | Quote creation date | 2025-03-29T00:04:11+00:00 |
| {{ feed.quote.attributes.paid }} | Payment status | true |
| {{ feed.quote.attributes.id_quote }} | Quote ID | OQPPBDCSSZQ9 |
Associated object data variables let you display attributes from objects linked to the custom object that triggered the automation. Use indexing to reference specific records, or a for loop to iterate over all of them.
Use indexing to reference specific elements
The syntax for indexing syntax is {{ feed.object.associations.associatedobject.index.variable }}, where you should replace each placeholder as follows:
- object with the singular name of your custom object as defined when you created it.
- associatedobject with the singular name of your associated object found under the Associations tab when selecting a custom object from the Custom objects settings page.
- index with the position of the associated object record you want to display, starting from 0 for the first record.
- variable with the attribute ID you want to display, found under the Associations tab when selecting a custom object from the Custom objects settings page.
Given a quote object associated with vehicle records containing a brand attribute:
| Input | Description | Output |
|---|---|---|
| {{ feed.quote.associations.vehicle.0.brand }} | First vehicle brand | Renault |
| {{ feed.quote.associations.vehicle.1.brand }} | Second vehicle brand | Toyota |
Use a for loop to iterate over all elements
The syntax with a for loop is {% for item in feed.object.associations.associatedobject %} {{ item.variable }} {% endfor %}, where you should replace each placeholder as follows:
- object with the singular name of your custom object as defined when you created it.
- associatedobject with the singular name of your associated object found under the Associations tab when selecting a custom object from the Custom objects settings page.
- variable with the attribute ID you want to display, found under the Associations tab when selecting a custom object from the Custom objects settings page.
Given a quote object associated with vehicle records containing a brand attribute:
| Input | Description | Output |
|---|---|---|
|
{% for item in feed.quote.associations.vehicle %} {{ item.brand }} {% endfor %} |
Brand of all associated vehicle records |
Renault Toyota Audi ... |
➡️ To learn more about for loops, check our dedicated article [Manual] Repeat a block of items in your emails using for loops.
📅 Date variable
| Available for: | ✅ SMS | ✖️ Push |
Inserts a timestamp of the exact date and time the message was sent, based on your Brevo account's timezone. Defaults to UTC if no timezone is set.
The syntax is {{ time_now }}.
For example:
| Input | Description | Output |
|---|---|---|
| Today is {{ time_now }} | Full timestamp | Today is 2025-03-11 15:10:20.823713502 +0100 CET |
| Today is {{ time_now |date:"Monday, Jan 2, 2006" }} | Formatted date using the date filter | Today is Tuesday, Mar 11, 2025 |
➡️ To learn more about adjusting the formatting of dates, check our dedicated article Modify the formatting of your placeholders with filters.
🔗 Email link and preview variables
| Available for: | ✖️ SMS | ✖️ Push |
Place these variables inside an HTML <a> tag to let recipients view your email in a browser, unsubscribe, or manage their preferences.
The following email link and preview variables are available:
| Input | Description | Output |
|---|---|---|
| <a href="{{ mirror }}">View in browser</a> | Mirror link | View in browser |
| If you'd no longer <a href="{{ unsubscribe }}">Unsubscribe</a> | Unsubscribe link | Unsubscribe |
| <a href="{{ update_profile }}">Update your preferences</a> | Profile update link | Update your preferences |
| <a href="{{ doubleoptin }}">I confirm my subscription</a> | Double opt-in link | I confirm my subscription |
➡️ To learn more, check our dedicated articles:
- Insert a 'View in browser' link in your campaigns
- Insert an unsubscribe link in your campaigns
- Update your contact details and preferences (profile update form)
- Create a custom double opt-in (DOI) email template for a sign-up form created in Brevo
📢 Conditional statements
| Available for: | ✖️ SMS | ✖️ Push |
Conditional display (if statements)
Use an if statement to show or hide parts of an email based on each recipient’s data.
➡️ To learn more, check our dedicated article [Manual] Show or hide content in your emails using if statements.
Repeatable sections (for loops)
Use a for loop to dynamically display all elements in an array, without manually referencing each index.
➡️ To learn more, check our dedicated article [Manual] Repeat a block of items in your emails using for loops.
🪄 Filters
| Available for: | ✅ SMS | ✖️ Push |
Filters modify the output of a variable and are placed inside the double brackets, separated by a pipe |. Multiple filters can be chained together.
For example:
| Input | Description | Output |
|---|---|---|
| {% for item in feed.yoga_classes.following_classes|slice:'0:3' %} | Limits the number of items to display in a for loop |
Power Flow Yoga Evening Restorative Hatha Yoga Basics |
| {{ contact.FIRSTNAME|upper }} | Converts the recipient’s first name to uppercase (originally: Abby). | ABBY |
| {{ params.TOTAL|floatformat:2 }} | Displays the cart total with two decimal places (originally: 49.995). | 49.99 |
| {{ time_now|date:"02/01/2006" }} | Formats the current date as dd/MM/yyyy (originally: 2025-03-11 15:10:20.823713502 +0100 CET). | 11/03/2025 |
➡️ To learn more, check our dedicated article Modify the formatting of your placeholders with filters.
🤔 Have a question?
If you have a question, feel free to contact our support team by creating a ticket from your account. If you don't have an account yet, you can contact us here.
If you’re looking for help with a project using Brevo, we can match you with the right certified Brevo Agency partner.