# Templates

A template is an insertion in double curly braces `{{ ... }}`. Before sending, the bot replaces it with a value: the contact's name, an answer saved in a variable, or the result of a calculation.

```
Hello, {{ first_name }}! Your order for ${{ $total }} has been accepted.
```

A contact named Anna whose `total` variable holds `1500` will receive:

```
Hello, Anna! Your order for $1500 has been accepted.
```

## What you can insert

| Syntax | What gets inserted | Learn more |
|---|---|---|
| `{{ first_name }}` | Contact data: name, phone, email and more | [Contact data](https://support.watbot.org/chatbots/templates/data#contact-data) |
| `{{ $city }}`, `{{ var("Client name") }}` | A contact variable's value. Names with spaces go through `var` | [Variables](https://support.watbot.org/chatbots/templates/data#contact-variables) |
| `{{ office_address }}` | A global bot variable's value | [Global variables](https://support.watbot.org/chatbots/templates/data#global-variables) |
| `{{ round($price * 0.9, 2) }}` | The result of an expression: arithmetic, conditions, functions | [Expressions](https://support.watbot.org/chatbots/templates/expressions) |
| `{{ date("d.m.Y") }}` | The result of a function | [Function reference](https://support.watbot.org/chatbots/templates/functions) |

## How it works

1. The bot finds every `{{ ... }}` insertion in the text.
2. It replaces each one with its value. If there is no value — for example, the contact has no phone number — that spot is left empty.
3. It sends the finished text.

An inserted value is always plain text. If a contact types `{{ ... }}` in an answer, the bot shows it as is and doesn't execute anything.

> [!TIP]
> Check your templates in the bot preview — the "Test the bot" button in the builder. If an insertion fails, the reason and a link to the block appear below the chat. See [Errors and limits](https://support.watbot.org/chatbots/templates/errors).

## Where templates work

In message texts, file captions, buttons, links, conditions and the settings of many blocks. Some places don't support every function — see [Where templates work](https://support.watbot.org/chatbots/templates/where).
