> For the complete documentation index, see [llms.txt](https://docs.rubica.au/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rubica.au/households/email-broadcasts/merge-fields.md).

# Merge Fields

Merge fields personalise each email: the client's name, a greeting, or anything else the audience carries, such as a review date from a spreadsheet.

A **merge field** is a placeholder in a template that's replaced with each person's own details when the broadcast is sent. *Hi `{{{contact.first_name}}}`* becomes *Hi Margaret* for one client and *Hi Grace* for the next.

## What you can use

Every audience gives your templates its own set of merge fields:

* **The details in the audience's rule.** Every field the audience picks up from the CRM, such as first name, last name or a greeting, can be used in the email.
* **Email address**, always.
* **Columns from a spreadsheet**, if the audience came from one and you ticked them. See [Audiences from a Spreadsheet](/households/email-broadcasts/spreadsheet-audiences.md).

You'll see the list in three places:

* step 3 of **New audience** (**Merge fields this audience gives your templates**),
* when you open an audience (**Merge fields**, with an example value for each),
* in the send window (**Merge fields you can use**, with the values for the person you're previewing as).

Click a merge field to copy it, then paste it into your template in Resend.

## How to write them

Merge fields are written with three curly brackets and `contact.` in front:

| Write                             | Becomes                                                |
| --------------------------------- | ------------------------------------------------------ |
| `{{{contact.first_name}}}`        | Margaret                                               |
| `{{{contact.first_name\|there}}}` | Margaret, or **there** for anyone without a first name |
| `{{{contact.suburb}}}`            | A column called **Suburb** from a spreadsheet          |

Add a fallback after a `|` for anyone who might not have a value, so nobody gets *Hi ,*.

How field names turn into merge fields:

* Spaces and capital letters become underscores and lower case: **Review date** becomes `review_date`, **FirstName** becomes `first_name`.
* A field on a related record joins the two names: **Account › Name** becomes `account_name`.

You don't need to work these out yourself. Copy them from the list.

## Greetings

If your firm has a greeting field, such as one that greets a couple sharing an inbox as *Margaret & Tom*, it appears in the list as **First name greeting** or **List email greeting**. Use it instead of the first name for a warmer, more accurate greeting, with a fallback: `{{{contact.list_email_greeting|Valued Client}}}`.

## Check it before you send

In the send window, **Preview as** shows the email filled in for a real person in the audience. Pick a few different people, especially a couple and someone with missing details, to check the fallbacks read well. Then **Send me a test**.

<figure><img src="https://3555949013-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqzoPnlIGiL5ejRdJEq5X%2Fuploads%2Fgit-blob-e1c911e06096404c49c1e0ee71b3b20075471baf%2Femail-preview.gif?alt=media" alt="Preview as: switching the person changes the greeting and the suburb in the email, and Merge fields you can use lists each merge field with that person&#x27;s value"><figcaption><p>The email changes with the person you preview as. All names are examples.</p></figcaption></figure>

{% hint style="warning" %}
**Couples in a household spreadsheet.** When a spreadsheet lists households and the email goes to the people in them, both people get the value from the household's row. Check it reads well for both before you use it in a sentence.
{% endhint %}
