> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lekalao.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Personalisation

> Variables, conditions and loops, to write to each person.

The content and the subject take **variables** between double braces, and a small language of **conditions** and **loops**. No code is run: the engine understands only what is described here.

The **Variables** button of each editor lists the ones available; one click copies a variable.

## Variables

### In campaigns and automations

| Variable                                        | Value                                                  |
| ----------------------------------------------- | ------------------------------------------------------ |
| `{{ subscriber.first_name }}`                   | First name                                             |
| `{{ subscriber.last_name }}`                    | Last name                                              |
| `{{ subscriber.email }}`                        | E-mail address                                         |
| `{{ subscriber.attributes.city }}`              | A custom attribute (replace `city`)                    |
| `{{ list.name }}`                               | The list's name                                        |
| `{{ unsubscribe_url }}`                         | The unsubscribe link                                   |
| `{{ preferences_url }}`                         | The link to the preferences page                       |
| `{{ organisation.address }}`                    | The organisation's postal address (Settings → General) |
| `{{ webview_url }}`                             | The link to the web version                            |
| `{{ campaign.name }}`, `{{ campaign.subject }}` | Campaigns: name and subject                            |
| `{{ mail.name }}`, `{{ mail.subject }}`         | Automation e-mails: name and subject                   |

### In the confirmation and welcome e-mails

The same subscriber and list variables, plus `{{ confirm_url }}`, the confirmation link.

### In transactional e-mails

The variables are the ones your application sends. With:

```json theme={null}
{ "customer": { "name": "Ada" }, "order": { "number": "A-1024", "paid": true } }
```

you write `{{ customer.name }}` and `{{ order.number }}`. See [Transactional e-mails through the API](/developers/transactional).

<Note>
  A variable that is unknown or empty is replaced with an empty string. Values are escaped in the HTML: a first name holding `<script>` is shown as it is, and does not run.
</Note>

## Conditions

```liquid theme={null}
{% if subscriber.first_name %}
  Hello {{ subscriber.first_name }},
{% else %}
  Hello,
{% endif %}
```

| Form                             | True when                    |
| -------------------------------- | ---------------------------- |
| `{% if name %}`                  | the value is set (not empty) |
| `{% if name == "value" %}`       | equal, case ignored          |
| `{% if name != "value" %}`       | different                    |
| `{% if name contains "value" %}` | contains the text            |
| `{% unless name %}`              | the opposite of `if`         |

`{% else %}` is optional; `if` is closed with `{% endif %}`, `unless` with `{% endunless %}`.

```liquid theme={null}
{% if subscriber.attributes.plan == "pro" %}
  Thank you for being a Pro customer: delivery is on us.
{% endif %}
```

## Loops

```liquid theme={null}
<ul>
{% for line in order.lines %}
  <li>{{ line }}</li>
{% endfor %}
</ul>
```

The loop runs over a **list of plain values** (`["Sourdough bread", "Brioche"]`) or over text separated by commas. It stops at 500 items.

<Warning>
  A loop over a list of objects (`[{"name": "Bread", "price": 3}]`) will not show `{{ line.name }}`: prepare, on your application's side, a list of lines already written out, such as `"Sourdough bread — 3,000 FCFA"`.
</Warning>

## Two variables you cannot leave out

A campaign does not go out without:

* **`{{ unsubscribe_url }}`**: a visible unsubscribe link;
* **`{{ organisation.address }}`** (or the address written out in full): the sender's postal address.

Both are legal requirements for any marketing e-mail. The simplest thing is to put them in your [template](/content/templates).
