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

# Template Bots

> Trigger an approved WhatsApp template on a keyword or first message — great for welcomes and re-engagement.

A **Template Bot** reacts to the same trigger rules as a [Message Bot](/automations/message-bots), but instead of sending a plain text reply it sends an **approved WhatsApp template** with parameters filled in.

<Note>
  Templates can be sent even outside the 24-hour customer service window. That makes Template Bots the right tool whenever the message needs to feel more formal, include a header image, or land regardless of session timing.
</Note>

## What a Template Bot does

On an incoming message that matches its trigger, the bot:

1. Looks up the approved template you configured.
2. Substitutes parameters into the header, body, and footer from the values you supplied.
3. Sends the template to the contact.

That's one template send per trigger. Template Bots, like Message Bots, are **stateless** — they don't continue the conversation afterwards.

## Create a Template Bot

Go to **Automations → Template Bots** and click **Create**.

<Steps>
  <Step title="Name it">
    Internal name only — e.g. "Welcome template for new leads". Customers never see this.
  </Step>

  <Step title="Pick who it applies to">
    **Lead** or **Customer**. The bot only fires when the contact has that relationship type.
  </Step>

  <Step title="Pick the trigger type">
    Same four reply types as Message Bots — see the table below.
  </Step>

  <Step title="Enter keywords">
    Required for reply types 1 and 2. Leave empty for types 3 and 4.
  </Step>

  <Step title="Choose the template">
    Pick one of your approved WhatsApp templates. Only approved templates show up in the list.
  </Step>

  <Step title="Fill in parameter values">
    For each variable in the header, body, and footer, provide a value. You can use merge fields (`{contact_first_name}` etc.) to personalise per contact.
  </Step>

  <Step title="Save">
    The bot is live as soon as it's saved and active.
  </Step>
</Steps>

## The four trigger types

Same rules as Message Bots:

| ID    | Name                  | When it fires                                                    | Keywords field                      |
| ----- | --------------------- | ---------------------------------------------------------------- | ----------------------------------- |
| **1** | On exact match        | The incoming message equals a keyword exactly                    | Required — comma-separated keywords |
| **2** | When message contains | The incoming message contains any of the keywords as a substring | Required — comma-separated keywords |
| **3** | On first message      | The contact is messaging your business for the first time        | Ignored                             |
| **4** | If no keyword matches | Nothing else caught this message — the fallback                  | Ignored                             |

## Template parameters

A Template Bot stores parameters as three JSON fields — one for each section of the template:

| Field           | Purpose                                                                         |
| --------------- | ------------------------------------------------------------------------------- |
| `header_params` | Values for variables in the header (or the header media URL for a media header) |
| `body_params`   | Values for the `{{1}}`, `{{2}}`, … variables in the body                        |
| `footer_params` | Values for variables in the footer (if the template has any)                    |

Each field is a list of values matched to the variables in the approved template, in order.

<Warning>
  Template variables use `{{1}}`, `{{2}}`, … syntax. These are **not** the same as the `{contact_first_name}`-style merge fields. You can put a merge field *inside* a parameter value so that a different contact gets a different `{{1}}`.
</Warning>

### Example

Suppose the approved template body is:

```
Hi {{1}}, your order {{2}} is on the way.
```

Your Template Bot's body parameters might be:

1. `{contact_first_name}`
2. `ORD-{contact_id}`

When the bot fires for a contact named "Asha" with ID `482`, WhatsApp receives:

```
Hi Asha, your order ORD-482 is on the way.
```

## Merge fields you can use in parameter values

```
{contact_first_name}
{contact_last_name}
{contact_id}
{contact_company}
{contact_email}
{contact_phone_number}
{lead_status}
{lead_source}
{lead_assigned}
```

<Note>
  Custom fields are not available as merge fields inside Template Bot parameters at the moment.
</Note>

## Why use Template Bots instead of Message Bots?

| You need…                                                                 | Use          |
| ------------------------------------------------------------------------- | ------------ |
| A quick text reply with at most three buttons                             | Message Bot  |
| A branded message with a header image or video                            | Template Bot |
| To reply to a message that came in **outside** the 24-hour session window | Template Bot |
| A reply longer than a short message, with formatting                      | Template Bot |
| A structured call-to-action button that opens a URL                       | Template Bot |

Template Bots are the only way (without building a Bot Flow) to answer a customer with an approved template.

## Active / inactive

Each Template Bot has an active toggle. Inactive bots keep their configuration but don't fire on incoming messages.

## Cloning

**Clone** duplicates an existing bot — useful to fork one for Lead vs Customer, or as a starting point for a near-identical bot with a different template.

## Permissions

| Permission                   | Allows                         |
| ---------------------------- | ------------------------------ |
| `tenant.template_bot.view`   | See the Template Bot list      |
| `tenant.template_bot.create` | Create new Template Bots       |
| `tenant.template_bot.edit`   | Edit existing Template Bots    |
| `tenant.template_bot.delete` | Delete Template Bots           |
| `tenant.template_bot.clone`  | Clone an existing Template Bot |

The workspace owner has all of them automatically.

## Feature availability

Template Bots require the `template_bots` feature on the workspace subscription. If the link is missing from the sidebar, your plan doesn't include them.

<Note>
  Carousel templates (multiple cards in one message) have a reserved `cards_params` column on template bots but are not currently exposed in the UI. We'll announce on the [Changelog](/changelog) when carousel bots ship.
</Note>

## What to read next

<CardGroup cols={3}>
  <Card title="Message Bots" icon="reply" href="/automations/message-bots">
    Plain text keyword replies.
  </Card>

  <Card title="Bot Flows" icon="diagram-project" href="/automations/bot-flows">
    Branching multi-step conversations.
  </Card>

  <Card title="Templates" icon="file-lines" href="/templates/overview">
    How to get templates approved by Meta.
  </Card>
</CardGroup>
