Advanced Email Templating

Advance Email Templating allows for highly customized email templates. It can be used in both the drag-and-drop editor and directly on imported HTML.

Our templating syntax allows for highly customized email templates that cater to a wide range of business needs and individual preferences. Powered by Liquid, this syntax is incredibly versatile and can be used in both the drag-and-drop editor and directly on imported HTML. Leveraging this syntax opens up a world of possibilities to create outstanding email templates, be it for marketing campaigns, newsletters, transactional emails, or personalized customer communications. Whether you are a seasoned developer or new to email design, our templating syntax provides the tools and flexibility needed to craft visually appealing and highly effective email templates, ensuring you can achieve the best possible outcomes for your emails.

1. Predefined Variables

When you input predefined variables into your messages, they are replaced with the corresponding values when the message is sent.

Contact

Contact personalisation enables you to display dynamic Contact attributes in your messages. They are prefixed with contact.attributes.. You can reference default contact attributes, and also any custom attributes defined in your workspace.

Input
Hi {{ contact.attributes.firstName }} {{ contact.attributes.lastName }}, how are you? 
Output
Hi John Doe, how are you?

Organization

Organization tags allow you to include information about your company or organization in your messages. You can manage this information by navigating to Settings > Organization and updating the Contact information section.

Tag

Description

{{organization.id}}

Your organization’s ID

{{organization.name}}

Your organization’s legal name

{{organization.fullAddress}}

Your organization’s full address, including city, state zip code, and country

{{organization.street}}

Your organization’s street address

{{organization.city}}

Your organization’s city

{{organization.state}}

Your organization’s state

{{organization.country}}

Your organization’s country

{{organization.zipCode}}

Your organization’s zip code

{{organization.websiteUrl}}

Your organization’s website URL

Email Address

To reference the email address that the email is being sent to, you can use the {{ emailAddress }} variable.

Unsubscribe URLs

You can use the {% unsubscribe %} tag to include an unsubscribe link in your email. Note that this tag also embeds a link (<a> tag) with the text ‘Unsubscribe’, so using {% unsubscribe %} will embed a generated unsubscribe url.

To customise the text you can provide an argument, e.g. {% unsubscribe 'Custom text' %} will output:

<a href="https://bird-unsub-url.com" style="text-decoration:underline;">Custom text</a>

If you need to embed just the link (URL) part without the surrounding <a> tag (because you have your own <a> tag already or you want to style your own link) you can use the {% unsubscribeLink %} tag. Since no <a> tag is being provided you need to have your own, e.g.:

<a href="{% unsubscribeLink %}">Unsubscribe</a>

Web view URLs

You can use the {% webView %} tag to include a web view link in your email. Note that this tag also embeds a link (<a> tag) with the text ‘View in browser’, so using {% webView %} will embed a generated web view link.

To customise the text you can provide an argument, e.g. {% webView 'View on the web' %} will output:

<a href="https://bird-webview-url.com" style="text-decoration:underline;">View on the web</a>

If you need to embed just the link (URL) part without the surrounding <a> tag (because you have your own <a> tag already or you want to style your own link) you can use the {% webViewLink %} tag. Since no <a> tag is being provided you need to have your own, e.g.:

<a href="{% webViewLink %}">View in browser</a>

Dates

There are a number of different ways to make references to dates.

Input

Output

{{ today | date: "%Y-%m-%d" }}

2017-03-25

{{ "now" | date: "%Y-%m-%d %H:%M" }}

2024-04-30 21:02

{% currentYear %}

2017

{% currentMonthName %}

March

{% currentWeekday %}

Saturday

{% currentDay %}

25

2. Filters

Filters allow you to change the way tags appear.

default filter

The default filter allows you to set a default value for a tag, if it’s value may not be set:

Input
Hi {{ contact.attributes.firstName | default: 'there' }}, how are you?
Output
Hi there, how are you?

capitalize, upcase, downcase filters

The capitalize filter capitalizes the first letter of value:

Input
Hi {{ contact.attributes.firstName | capitalize }}, how are you? Hi {{ contact.attributes.firstName | upcase }}, how are you? Hi {{ contact.attributes.firstName | downcase }}, how are you?
Output
Hi John, how are you? Hi JOHN, how are you? Hi john, how are you?

date filter

The date filter allows you to format a date. This supports the same syntax as strftime

Input
{{ contact.attributes.birthday | date: '%a, %b %d, %y' }}
{{ contact.attributes.birthday | date: '%Y-%m-%d' }} 
Output
Fri, Jul 17, 15Input
2015-07-17

currencyFormat filter

The currencyFormat filter allows you to format a number as a currency.

Input
{{ contact.attributes.totalSpent | currencyFormat: 'USD' }}
Output
$100.00

3. Logic & Segmentation

Conditionals

Conditional logic enables you to show or hide content based on certain conditions.

{% if contact.attributes.membership == "gold" %} 
Hey there gold member! Here's a special offer just for gold members. 
{% elsif contact.attributes.membership == "silver" %} 
Hey there silver member! Here's a special offer just for silver members. 
{% else %} 
Hey there! Here's a special offer for everyone else. 
{% endif %}

When writing conditional logic, it is important to consider the type of the tag in question. If you are comparing a number for example you can use number-specific operators like >, <, >=, <=.

{{ catalogItem.title }} {% if catalogItem.price > 100 %} 
This item qualifies for free shipping! 
{% endif %}

You can also write conditional logic based on a contact’s membership of a given segment. You can do this like so:

{% if contact.segments contains "abcd-1234-efgh-5678" } 
This contact is a member of the segment with ID "abcd-1234-efgh-5678". 
{% endif %}

Loops

Loops enable you to iterate over a list of items. Ensure that attriute you are referecing is an array:

Input
"favoriteColors": ["Red", "Blue", "Green"]

{% for color in contact.attributes.favoriteColors %} 
    {{ color }} 
{% endfor %} 
Output
Red Blue Green

Last updated