Personalisation (Liquid)
Overview
Section titled “Overview”amabledata personalises emails with Liquid, a small template language. {{ … }} prints a value and {% … %} runs logic (conditions, loops, variables). You can use Liquid in:
- the subject of broadcasts, templates and automation emails;
- the body of any email, through field chips, condition blocks and Liquid code blocks in the email editor;
- Dynamic Content snippets (Marketing › Email templates › Dynamic Content);
- text inputs of automation App action steps (a reduced set of fields, see Triggers and steps).
This page is the complete reference for what the sending engine accepts. The same information is available in the app: the Liquid helper (button {{ }} Liquid helper in the editor toolbar) and the guide behind How it works.
How it works
Section titled “How it works”For each recipient, amabledata builds a render context (the data listed in Merge fields), renders the referenced snippets, and resolves the Liquid of the subject, the HTML body and the plain-text body in a sandbox:
- No files, no network.
include,renderandlayoutexist as tags but find nothing. Use snippets instead. - Only listed data is readable. Object internals such as
constructoror__proto__are invisible. - Unknown filters are errors. A typo in a filter name stops the email from compiling.
- Unknown variables are not errors. A variable that does not exist, or has no value for this contact, prints nothing.
- Escaping. In the HTML part every
{{ … }}output is HTML-escaped, so contact data can never inject markup. The subject and the plain-text part are not escaped. The final HTML also goes through a whitelist sanitiser. - Bounded. Each render has a time and memory budget (see Limits).
The preview in the app uses the same sandbox and the same context (with an example unsubscribe link), so a template that previews correctly sends correctly.
Merge fields
Section titled “Merge fields”Contact
Section titled “Contact”| Field | Liquid | Type | Value |
|---|---|---|---|
| Contact ID | {{ contact.id }} |
text | The contact’s id |
| First name | {{ contact.first_name }} |
text | The preferred name if set, otherwise the given name |
| Last name | {{ contact.last_name }} |
text | Family name |
| Full name | {{ contact.full_name }} |
text | Given name and family name joined by a space |
{{ contact.email }} |
text | Primary email (or the first one) | |
| Phone | {{ contact.phone }} |
text | First phone number |
| City | {{ contact.city }} |
text | City of the first address |
| Region / state | {{ contact.region }} |
text | Region of the first address |
| Country code | {{ contact.country }} |
text | Country code of the first address, e.g. IT |
| Job title | {{ contact.job_title }} |
text | — |
| Website | {{ contact.website }} |
URL | — |
| Time zone | {{ contact.time_zone }} |
text | IANA zone such as Europe/Rome, or empty |
| Score | {{ contact.score }} |
number | Lead score |
| Tags | {{ contact.tags }} |
list | Names of the contact’s tags |
| Custom fields | {{ contact.custom.<key> }} |
depends | One entry per contact custom field, by key (group Custom fields) |
Missing standard values are empty text. A custom field with no value for the contact is missing entirely: use a fallback.
Custom field types
Section titled “Custom field types”| Custom field type | Liquid value |
|---|---|
| Text, Text area, Name, Email, Phone number, Dropdown, Radio, State, User, Social security number | text |
| Whole number, Decimal number, Currency, Percent, Day of week, Month, Year | number |
| Date, Date and time | date (use the date filter) |
| List box, Drilldown, User list box | list |
| Website | URL |
| Yes/No | true / false |
Sensitive custom fields (for example social security numbers) are masked in previews for roles without contacts:read_sensitive (the field shows a lock: Sensitive: masked for your role). Real sends always use the real value: avoid sensitive fields in emails.
Company, owner and system
Section titled “Company, owner and system”| Field | Liquid | Value |
|---|---|---|
| Company name | {{ company.name }} |
Name of the contact’s company (empty when there is none) |
| Company website | {{ company.website }} |
Company website |
| Owner name | {{ owner.name }} |
Name of the contact’s owner (a workspace member) |
| Owner email | {{ owner.email }} |
Owner’s email |
| Owner signature | {{ owner.signature }} |
Reserved: currently always empty |
| Unsubscribe link | {{ unsubscribe_url }} |
The recipient’s personal unsubscribe URL |
| Current date | {{ "now" | date: "%d/%m/%Y" }} |
The current date is not a variable: use the literal "now" with date |
| Snippets | {{ snippets.<key> }} |
The rendered Dynamic Content snippet (group Dynamic Content) |
The editor groups these as Contact, Custom fields, Company, Owner, Dynamic Content and Email and date.
The tags available in templates are:
if, elsif, else, unless, case, when, for, break, continue, cycle, tablerow, assign, capture, increment, decrement, raw, comment, liquid, echo.
include, render and layout parse but find no files.
Conditions
Section titled “Conditions”{% if contact.score > 80 %} You are one of our best customers.{% elsif contact.tags contains "Trial" %} Your trial is running.{% else %} Welcome!{% endif %}- Operators:
==,!=,>,<,>=,<=,contains(text or list),and,or. - There are no parentheses, and
and/orare evaluated right to left: split complex logic into nestedifblocks. - Empty text counts as true. To test that a field has a value write
{% if contact.first_name != blank %}, not{% if contact.first_name %}. unlessis the opposite ofif:{% unless contact.tags contains "VIP" %}…{% endunless %}.casecompares one value with several:
{% case contact.country %}{% when "IT", "SM" %}Ciao{% when "FR" %}Bonjour{% else %}Hello{% endcase %}{% for tag in contact.tags limit: 3 %} {{ tag }}{% unless forloop.last %}, {% endunless %}{% else %} No interests yet.{% endfor %}limit:andoffset:keep loops short;{% else %}runs when the list is empty.- Inside the loop:
forloop.index(from 1),forloop.first,forloop.last,{% break %},{% continue %}. - Ranges:
{% for i in (1..3) %}. - Lists support
size,firstandlast:{{ contact.tags.size }},{{ contact.tags.first }}.
Variables and whitespace
Section titled “Variables and whitespace”{%- assign name = contact.first_name | default: "there" -%}{%- capture greeting -%}Hi {{ name }}{%- endcapture -%}{{ greeting }}assign stores a value, capture stores rendered text. A dash inside the delimiters ({%-, -%}, {{-, -}}) removes the spaces and line breaks around the tag, so logic on its own lines does not leave blank lines.
Filters
Section titled “Filters”Filters transform a value, {{ value | filter: argument }}, and can be chained. Only these filters exist; any other name is a syntax error.
| Group | Filters |
|---|---|
| Text | append, prepend, capitalize, upcase, downcase, strip, lstrip, rstrip, strip_html, strip_newlines, newline_to_br, normalize_whitespace, squish, truncate, truncatewords, replace, replace_first, replace_last, remove, remove_first, remove_last, split, slice, slugify, number_of_words, array_to_sentence_string |
| Escaping and encoding | escape, escape_once, xml_escape, cgi_escape, uri_escape, url_encode, url_decode, base64_encode, base64_decode, raw |
| Numbers | plus, minus, times, divided_by, modulo, abs, ceil, floor, round, at_least, at_most, to_integer |
| Lists | join, first, last, size, sort, sort_natural, reverse, uniq, compact, concat, map, where, where_exp, reject, reject_exp, find, find_exp, find_index, find_index_exp, has, has_exp, group_by, group_by_exp, sum, sample, push, pop, shift, unshift |
| Dates | date, date_to_string, date_to_long_string, date_to_rfc822, date_to_xmlschema |
| Other | default, json, jsonify, inspect, sha256, hmac_sha256 |
Common examples:
{{ contact.first_name | default: "there" }}{{ contact.first_name | capitalize }}{{ contact.city | upcase }} {{ contact.email | downcase }}{{ contact.custom.bio | truncate: 80 }}{{ contact.custom.bio | truncatewords: 12, "…" }}{{ contact.tags | join: ", " }} {{ contact.tags | size }}{{ contact.custom.price | times: 0.9 | round: 2 }}{{ "now" | date: "%d/%m/%Y" }}Fallbacks with default
Section titled “Fallbacks with default”default replaces a missing, empty or false value:
Hi {{ contact.first_name | default: "there" }},Field chips in the editor have a Fallback setting that writes this for you.
Dates and time zones
Section titled “Dates and time zones”date takes a strftime format and, optionally, a time zone as second argument:
{{ contact.custom.renewal_date | date: "%d/%m/%Y" }}{{ contact.custom.webinar_at | date: "%A %-d %B, %H:%M", contact.time_zone }}{{ "now" | date: "%Y" }}- Without a zone, dates use the workspace timezone from Settings › Email sending (UTC if none is set), in the preview exactly as in the sent email.
- Pass
contact.time_zoneto show the time in the recipient’s zone. If the contact has no zone (or an unknown one), the workspace timezone is used instead of failing. - Pass a fixed IANA zone such as
"Europe/Rome". - Dates without a time (
YYYY-MM-DD, such as Date custom fields) are never shifted to the previous or next day by a zone. - Format codes:
%dday (01–31),%-dday without zero,%mmonth,%Bmonth name,%bshort month,%Aweekday,%Yyear,%H:%Mtime,%I %p12-hour time,%sUnix seconds. - Month and weekday names are in English. For other languages use a
caseondate: "%m".
The date builder in the Liquid helper offers these presets: %d/%m/%Y, %m/%d/%Y, %Y-%m-%d, %-d %B %Y, %A %-d %B, %d/%m/%Y %H:%M, %H:%M, %Y.
The Liquid helper
Section titled “The Liquid helper”Open it with {{ }} Liquid helper in the editor toolbar (a drawer next to the editor) or in the right panel of the snippet editor. Pick fields, build conditions and preview them for a real contact. Inserting puts the code at the editor cursor.
| Tab | What it does |
|---|---|
| Fields | Every field of the render context, searchable (Search fields…), grouped as above. Fallback for inserted fields sets a fallback for the next insert. Click a field to insert it at the cursor (Dates get a format, tags are joined with commas.). Masked sensitive fields show a lock. |
| Build | Generators that write Liquid for you: Fallback, Format date, If / else, Has tag, Loop, Case. Each shows the Generated Liquid (or Complete the form to generate the code.), with Copy, Insert and Try in preview. |
| Preview | Renders Liquid for a contact (Preview for contact, or sample data from your own user). Choose Expression (what you type here) or Whole email / This snippet, and the Output format: Text or HTML (escaped). Shows the Output, syntax errors as Line {line}, column {column}:, variables Not in the render context (typo?): and variables Empty for this contact (fallback used if set):. |
| Guide | The searchable in-app guide to Dynamic Content and Liquid. |
Builder options:
- Fallback: Field, Fallback, Transform (None,
capitalize,upcase,downcase) and Max characters (addstruncate). - Format date: Field, Format preset or Custom format, Time zone: Workspace timezone (default), Contact’s time zone, or Fixed time zone with an IANA zone.
- If / else: one or more conditions with Operator (is, is not, contains, is greater than, is less than, is at least, is at most, is empty, is not empty, contact has tag), Combine conditions (all (and) / any (or)), Then show, Add “else if”, Otherwise show.
- Has tag: Tag, Then show, Otherwise show, and Show when the contact does NOT have the tag.
- Loop: List, Item name, Limit, Separator, For each item show, If the list is empty show.
- Case: Field, one or more Values, comma separated with their text (Add “when”), and the otherwise text; Field options lists the choices of dropdown custom fields.
Recipes
Section titled “Recipes”Greeting with fallback:
Hi {{ contact.first_name | default: "there" }},Text by language (store the language in a custom field such as language):
{% case contact.custom.language %}{% when "it" %}Ciao {{ contact.first_name }}!{% when "fr" %}Bonjour {{ contact.first_name }} !{% else %}Hello {{ contact.first_name }}!{% endcase %}Block only for contacts with a tag:
{% if contact.tags contains "Webinar 2026" %}Your recording is ready.{% endif %}Countdown to a date, shown in the contact’s zone:
{%- assign now_s = "now" | date: "%s" | plus: 0 -%}{%- assign end_s = contact.custom.renewal_date | date: "%s" | plus: 0 -%}{%- assign days = end_s | minus: now_s | divided_by: 86400 -%}{% if days > 0 %}Your plan renews in {{ days }} days, on {{ contact.custom.renewal_date | date: "%d/%m/%Y", contact.time_zone }}.{% endif %}Reference
Section titled “Reference”Where each part is escaped
Section titled “Where each part is escaped”| Part | HTML-escaped | Notes |
|---|---|---|
| Email HTML body | yes | raw disables escaping for one output; the final HTML is sanitised anyway |
| Plain-text body | no | Generated from the same document |
| Subject | no | Line breaks are removed |
| Snippet output | rendered as text, then escaped once by the email’s {{ snippets.<key> }} in the HTML part |
HTML in a snippet shows literally |
REST API
Section titled “REST API”| Method and path | Permission | Purpose |
|---|---|---|
GET /api/v2/t/<workspace>/liquid/schema |
broadcasts:read |
Fields (including custom fields and snippets), filters, tags and limits |
POST /api/v2/t/<workspace>/liquid/preview |
broadcasts:read |
Render a template (max 200,000 characters) for a contact or sample data; returns output, positioned errors, used, missing and unknown variables |
GET /api/v2/t/<workspace>/email/previewContext?contact_id=… |
contacts:read |
The render context of a real contact and the default date zone |
Limits and permissions
Section titled “Limits and permissions”| Limit | Value |
|---|---|
| Snippet and helper template size | 200,000 characters |
| Render time | 1,000 ms per template part per recipient |
| Snippet render time | 500 ms per snippet per recipient |
| Memory | about 10 MB per render (whole compiled emails: up to 32 MB) |
Using the helper and previews requires broadcasts:read; previews with a real contact also need contacts:read. Editing snippets requires templates:write.
Troubleshooting
Section titled “Troubleshooting”| Symptom | Cause | Fix |
|---|---|---|
| Error: or Line N, column M: in the preview; template Needs fixes; broadcast Cannot send yet: the email content has errors | Liquid syntax error: unclosed {% if %}/{% for %}, a stray {{, or an unknown filter |
Open the helper Preview tab, go to the reported line, fix it. Check the filter name against Filters. |
| Not in the render context (typo?): contact.firstname | The variable does not exist | Use the exact path, e.g. contact.first_name, or pick it from Fields. |
| Empty for this contact (fallback used if set): | The field has no value for the selected contact | Add a fallback with default. |
{% if contact.first_name %} is true for contacts without a name |
Empty text is truthy in Liquid | Use != blank. |
| A date is one day off | A date-time value is shown in a different zone | Pass the wanted zone as second argument of date; date-only values are never shifted. |
| Month names are in English | strftime names are English only | Use case on date: "%m". |
| Render stops with a time or memory error | A very large loop | Add limit: to loops. |
{% include %} / {% render %} renders nothing |
The sandbox has no files | Use a Dynamic Content snippet. |

