> AI agents: this is one page from PostHog's docs. Full index of Markdown docs for LLMs: https://posthog.com/llms.txt # Liquid and variables Canonical URL: https://posthog.com/docs/workflows/email/liquid ## On this page - [What you can use](#what-you-can-use) - [Add a default](#add-a-default) - [Properties that start with $](#properties-that-start-with-) - [Show something to only some people](#show-something-to-only-some-people) - [Filters](#filters) - [When it goes wrong](#when-it-goes-wrong) Every email can use [Liquid](https://shopify.github.io/liquid/) to fill in names, plans, links, and anything else you know about the person. In the [email editor](https://posthog.com/docs/workflows/email-editor.md), click `{x}` to pick a variable, or type it. ## What you can use | Variable | What it holds | Where | | --- | --- | --- | | `{{ person.properties.first_name }}` | Any [person property](https://posthog.com/docs/data/persons.md) | Broadcasts and automations | | `{{ event.properties.plan }}` | A property of the event that started the automation | Automations with an event trigger | | `{{ variables.reset_link }}` | Values your code sends, or values earlier steps saved | Transactional emails and automations | | `{{ unsubscribe_url }}` | The person's link to the preferences page | Marketing emails. See [unsubscribes](https://posthog.com/docs/workflows/email/unsubscribes.md). | A [transactional email](https://posthog.com/docs/workflows/transactional/templates.md#variables) can't read person properties. Your code sends everything it shows. ## Add a default A property can be missing for some people. Add a default: ```liquid Hi {{ person.properties.first_name | default: 'there' }}, ``` Use single quotes inside Liquid. A double quote inside a link's `href` ends the address early and breaks the link. ## Properties that start with `$` Use brackets and single quotes: ```liquid {{ person.properties['$email'] }} ``` `{{ person.properties.$email }}` fails, and the email doesn't send. ## Show something to only some people Wrap it in an `if`: ```liquid {% if person.properties.plan == 'pro' %} Thanks for being on Pro. {% endif %} ``` In the email editor, you can do the same for a whole block: open **Who sees it**, pick **Show only when…**, and fill in **Only if**. ## Filters Filters change a value before it shows, such as `upcase`, `capitalize`, `date`, and `truncate`: ```liquid Your trial ends on {{ person.properties.trial_ends_at | date: '%B %-d' }}. ``` PostHog adds a `currency` filter, which takes a currency code, a locale, or both: ```liquid Your total is {{ variables.total | currency: 'EUR' }}. ``` The [Liquid docs](https://shopify.github.io/liquid/filters/abs/) list the standard filters. PostHog turns off the filters that take an expression, such as `where_exp` and `group_by_exp`. ## When it goes wrong | Error | Fix | | --- | --- | | `TokenizationError: unexpected character` | Replace curly quotes, often pasted from a document, with straight single quotes. | | `expected "\|" before filter` | A property starts with `$`. Use `person.properties['$email']`. | | A blank where a name should be | The person doesn't have the property. Add a `default`. | If Liquid doesn't render, the email doesn't send. Before you go live, pick a real person in **Preview as**, and send yourself a test. For the size and send limits on each email, see [email and automation limits](https://posthog.com/docs/workflows/reference/limits.md#email-and-automation-limits).