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

# Variables

> Syntax and names of the variables available in messages

Variables are placeholders in email and SMS content that are replaced with a
value when a message is sent. For background, see
[How personalization variables work](https://docs.pocketflows.com/concepts/personalization-variables.md).

## Syntax

Write a variable as its name between double curly braces. Spaces inside the
braces are optional.

```
Hi {{ customer.first_name }}, thanks for visiting {{ business.name }}!
```

A name is a path separated by dots. The first part says where the value comes
from, and the rest names the property. To reach a value nested inside
`metadata`, add a part for each level: `{{ customer.address.city }}` reads
`city` from the `address` object in the customer's `metadata`.

## Customer variables

Filled from the customer receiving the message.

| Variable | Value |
| - | - |
| `customer.id` | The Pocketflows ID of the customer |
| `customer.full_name` | The customer's full name |
| `customer.first_name` | The customer's first name |
| `customer.last_name` | The customer's last name |
| `customer.email_address` | The customer's email address |
| `customer.phone_number` | The customer's phone number |
| `customer.<key>` | The value of `<key>` in the customer's `metadata` |

A `metadata` key with the same name as a built-in property replaces it. For
example, a `first_name` key in `metadata` is used for `customer.first_name`.

## Business variables

Filled from the business sending the message.

| Variable | Value |
| - | - |
| `business.id` | The Pocketflows ID of the business |
| `business.name` | The name of the business |
| `business.<key>` | The value of `<key>` in the business's `metadata` |

## Event variables

Available in triggers that listen for a
[project-defined event](https://docs.pocketflows.com/concepts/events-and-triggers.md). Filled from the event
that started the trigger.

| Variable | Value |
| - | - |
| `event.event` | The `event` you sent when tracking |
| `event.<key>` | The value of `<key>` in the event's `data` |

## Campaign and trigger variables

| Variable | Value |
| - | - |
| `campaign.name` | The name of the campaign |
| `campaign.<key>` | The value of `<key>` in the campaign's `metadata` |
| `campaign.segment.name` | The name of the segment the campaign is sent to |
| `trigger.name` | The name of the trigger |
| `trigger.<key>` | The value of `<key>` in the trigger's `metadata` |

`campaign.` variables are available in campaigns, and `trigger.` variables in
triggers.

## Missing values

A value is missing when the property does not exist or is `null`. A message that
uses a variable with a missing value is not sent to that recipient. An empty
string is a value, and is filled in as nothing.

A campaign cannot be started if one of its messages uses a variable that does
not start with `customer.`, `business.` or `campaign.`.

## Endpoints

| To | Endpoint |
| - | - |
| List the variable names available to a business | `GET /businesses/:id/variables` |
| List them with their values, where the value is known | `GET /businesses/:id/available_variables` |
| List the variables an email template uses | `GET /email_templates/:id/variables` |
| List the variables an SMS template uses | `GET /sms_templates/:id/variables` |

In `available_variables`, `business.` variables have a value because it is the
same for every recipient. `customer.` variables have a `null` value because it
differs for each recipient. `metadata` keys that start with an underscore are
left out of both lists.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.