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

# WhatsApp Automations

> Send customers an approved WhatsApp template automatically when something happens in another tool, such as a new Shopify order. Choose who gets which message with rules, conditions and a fallback.

WhatsApp Automations send a customer an approved WhatsApp message template automatically when something happens in a tool your AI agent is connected to. For example, a store can confirm every new order on WhatsApp, ask cash-on-delivery customers to confirm before shipping, or send a different message to customers in another country.

Each automation picks the right template for the order with **rules**. Rules are checked from top to bottom, and the first one whose conditions match sends its template. An optional **fallback** template covers orders that no rule matches.

## Types and triggers

Every automation has a **type** and a **trigger**:

* The **type** is the tool the event comes from.
* The **trigger** is the event inside that tool that starts the automation.

| Type | Trigger | Starts when |
| - | - | - |
| Shopify | Order created | A customer places an order in your Shopify store. |

Shopify is the only type for now, and it has one trigger, **Order created**. More types and triggers will appear in the same place as they're added.

An AI agent can have **one automation per trigger**. Once it has an *Order created* automation, **Add automation** is disabled, and you change that automation instead of adding another.

## Before you start

* **Connect Shopify** to your AI agent. See [Shopify](https://chatbase.co/docs/user-guides/integrations/shopify.md).
* **Connect a WhatsApp number** to the same AI agent. See [WhatsApp](https://chatbase.co/docs/user-guides/integrations/whatsapp.md). The automation sends from this number.
* **Create and get approval for the templates** you want to send, in the WhatsApp Business Account of that number. See [WhatsApp Templates](https://chatbase.co/docs/user-guides/integrations/whatsapp-templates.md). Only approved templates can be picked.
* **Make sure orders have a phone number.** The message goes to the phone number on the order, its customer, or its shipping or billing address, in that order. Orders without a valid phone number are skipped.

## Create an automation

**1. Open the Automation tab**

Go to **Channels → WhatsApp** and open the **Automation** tab. Click **Add automation**.

![The WhatsApp page's Automation tab with the Create your first automation empty state and an Add automation button](https://mintcdn.com/chatbase/vqI1HlwQDAQejNk0/user-guides/integrations/images/whatsapp-automations/01-automation-tab.png?fit=max\&auto=format\&n=vqI1HlwQDAQejNk0\&q=85\&s=86a4df546388337fead43a32e7f69b03)

**2. Check the type and trigger, and choose the phone number**

The editor opens with **Type** set to **Shopify** and **Trigger** set to **Order created**. Under **Phone number**, choose the WhatsApp number the messages are sent from in **Send from**.

![New automation editor showing Type Shopify, Trigger Order created and the Send from phone number](https://mintcdn.com/chatbase/vqI1HlwQDAQejNk0/user-guides/integrations/images/whatsapp-automations/02-type-trigger.png?fit=max\&auto=format\&n=vqI1HlwQDAQejNk0\&q=85\&s=d21c4db038676af0155a0175a1fbc98a)

**3. Add a rule and its conditions**

Under **Match & send**, give the first rule a name that says what it matches, such as *Match cash*. Then add its conditions. For each condition, pick an order field in **Variable**, an operator in **Condition**, and type or pick a **Value**.

![The Variable dropdown open, listing order fields grouped under Payment & money, Customer & address and Products](https://mintcdn.com/chatbase/vqI1HlwQDAQejNk0/user-guides/integrations/images/whatsapp-automations/03-condition-variables.png?fit=max\&auto=format\&n=vqI1HlwQDAQejNk0\&q=85\&s=abd3b01109fa467ced1d46fde30f3d69)

Choose **Match all** when every condition has to be true, or **Match any** when one is enough. Click **Add condition** for more. See [Conditions](#conditions) for every field and operator.

![A rule named Match cash with one condition: Payment method contains cash](https://mintcdn.com/chatbase/vqI1HlwQDAQejNk0/user-guides/integrations/images/whatsapp-automations/04-rule-conditions.png?fit=max\&auto=format\&n=vqI1HlwQDAQejNk0\&q=85\&s=c5ad51e6078e9140a526a13f6b06159f)

**4. Pick the template**

Under **Then**, click **Select template** and pick an approved template.

![The Select template dialog listing approved WhatsApp templates](https://mintcdn.com/chatbase/vqI1HlwQDAQejNk0/user-guides/integrations/images/whatsapp-automations/05-template-picker.png?fit=max\&auto=format\&n=vqI1HlwQDAQejNk0\&q=85\&s=0a0941d2560dbbf39ac94171cfee5246)

> [!WARNING]
>
> Automations fill variables in the template's **body** only. If a template has variables in its header, the automation can't fill them, so pick a template whose header has no variables.

**5. Fill in the template's variables**

For each variable in the template, such as `{{1}}`, choose the order field that fills it, or **Custom text** to type a fixed value. See [Template variables](#template-variables).

![A template variable's dropdown open, listing order fields and Custom text](https://mintcdn.com/chatbase/vqI1HlwQDAQejNk0/user-guides/integrations/images/whatsapp-automations/06-variable-sources.png?fit=max\&auto=format\&n=vqI1HlwQDAQejNk0\&q=85\&s=db68edf14e21a84bfa8dcff4bd56ef14)

![The Order Confirm template with \{\{1}} set to Customer first name and \{\{2}} set to Order number](https://mintcdn.com/chatbase/vqI1HlwQDAQejNk0/user-guides/integrations/images/whatsapp-automations/07-template-variables.png?fit=max\&auto=format\&n=vqI1HlwQDAQejNk0\&q=85\&s=f83246aefde7b79aa14521e20b1a4b5e)

The WhatsApp preview on the right shows the message with your choices filled in.

![The WhatsApp preview showing Hello \[Customer first name\], We received your order \[Order number\]](https://mintcdn.com/chatbase/vqI1HlwQDAQejNk0/user-guides/integrations/images/whatsapp-automations/08-phone-preview.png?fit=max\&auto=format\&n=vqI1HlwQDAQejNk0\&q=85\&s=6902fb1ebffe6fd567807855d9f92a42)

**6. Add more rules and a fallback (optional)**

Click **Add rule** for more cases, and drag rules to change their order. The top-most rule that matches wins.

To send something when no rule matches, turn on **Send a fallback message**, then pick its template and fill in its variables.

![The fallback turned on with the Order Confirm template, \{\{1}} set to Custom text there and \{\{2}} set to Order number](https://mintcdn.com/chatbase/vqI1HlwQDAQejNk0/user-guides/integrations/images/whatsapp-automations/09-fallback.png?fit=max\&auto=format\&n=vqI1HlwQDAQejNk0\&q=85\&s=df9a5b12ba431d745afc5f9696976312)

Each template has an eye button next to its **Preview**. Click it to show that template in the WhatsApp preview. Without it, the preview shows the top-most rule's template.

![The WhatsApp preview showing Hello there after clicking the fallback's eye button](https://mintcdn.com/chatbase/vqI1HlwQDAQejNk0/user-guides/integrations/images/whatsapp-automations/10-fallback-preview.png?fit=max\&auto=format\&n=vqI1HlwQDAQejNk0\&q=85\&s=1d57551cca34e265826d3563f8209360)

> [!NOTE]
>
> An automation needs at least one rule or the fallback.

**7. Save & enable**

Click **Save & enable**. The automation is saved, turned on, and you're taken back to the list. It sends on the next order that comes in.

![The Automation tab listing the Order created automation as Active](https://mintcdn.com/chatbase/vqI1HlwQDAQejNk0/user-guides/integrations/images/whatsapp-automations/11-automation-list.png?fit=max\&auto=format\&n=vqI1HlwQDAQejNk0\&q=85\&s=a8b51d3cfb46fc4962c06db9e987f1a5)

## Conditions

Conditions compare a field of the new order with the value you enter.

| Group | Variable | Conditions |
| - | - | - |
| Payment & money | Payment method | is, is not, contains, does not contain |
| | Order total | equals, does not equal, is greater than, is at least, is less than, is at most |
| | Payment status | is, is not |
| | Subtotal | equals, does not equal, is greater than, is at least, is less than, is at most |
| | Total discounts | equals, does not equal, is greater than, is at least, is less than, is at most |
| | Shipping price | equals, does not equal, is greater than, is at least, is less than, is at most |
| | Currency | is, is not |
| | Discount code | is, contains, is set, is not set |
| Customer & address | Shipping country | is, is not |
| | Shipping province/state | is, is not |
| | Shipping city | is, is not, contains |
| | Shipping postal code | is, is not, starts with |
| | Customer tags | contains, does not contain |
| | Customer email | is set, is not set |
| Products | Product title | contains, does not contain |
| | Product SKU | contains, does not contain |
| | Product vendor | contains, does not contain |
| | Number of products | equals, does not equal, is greater than, is at least, is less than, is at most |
| | Total quantity | equals, does not equal, is greater than, is at least, is less than, is at most |
| | Total weight (g) | equals, does not equal, is greater than, is at least, is less than, is at most |

How values are compared:

* **Text** ignores upper and lower case and spaces around the value.
* **Lists** (customer tags, discount codes, product titles, SKUs and vendors) match **contains** when any item contains your text, and **does not contain** when no item does.
* **Numbers** never match when the order has no value for that field.
* **Payment status** is picked from a list: Pending, Authorized, Partially paid, Paid, Partially refunded, Refunded, Voided.
* **Shipping country** is picked from the country list. **Currency** is a currency code such as `USD`.
* **Shipping province/state** matches either the name or the code, such as `California` or `CA`.

### Payment method

**Payment method** matches the **gateway name** Shopify stores on the order, as plain text.

For a manual payment method, the gateway name is the method's name as it appears in Shopify admin under **Settings → Payments → Manual payment methods**, such as `Cash on Delivery (COD)` or `Example Pay`.

![Shopify admin Payments settings, Manual payment methods: Cash on Delivery (COD) and Example Pay, both Active](https://mintcdn.com/chatbase/vqI1HlwQDAQejNk0/user-guides/integrations/images/whatsapp-automations/18-shopify-payment-methods.png?fit=max\&auto=format\&n=vqI1HlwQDAQejNk0\&q=85\&s=4776c88ec963e94cd52adb934bdf27fa)

Other gateways can store a different name from the one your checkout and admin show. Shopify's test gateway, for example, shows as "(for testing) Bogus Gateway" on the order, but its gateway name is `bogus`. To see the gateway of an order, open the order and, in its **Timeline**, expand the payment line.

![A Shopify order timeline with the payment expanded, showing Gateway (for testing) Bogus Gateway](https://mintcdn.com/chatbase/vqI1HlwQDAQejNk0/user-guides/integrations/images/whatsapp-automations/19-shopify-order-gateway.png?fit=max\&auto=format\&n=vqI1HlwQDAQejNk0\&q=85\&s=2364c8a7804cfcc4de7f0f127e811878)

> [!TIP]
>
> Use **contains** with a short, distinctive word from the name, such as `cash` or `bogus`, when you're not sure of the exact name. Use **is** when you know it, such as `Example Pay`.

## Template variables

Each variable in a template is filled from the order, or from text you type. You can pick Customer first name, Customer full name, Customer email, Order number, Order summary, Order total, Payment method, Item count, Discount code, Shipping address, Shipping city, Shipping country or Custom text. These need a word of explanation:

| Value | What it fills in |
| - | - |
| Customer first name | The customer's first name, or the first name on the shipping or billing address. |
| Customer full name | The customer's full name, or the name on the shipping or billing address. |
| Order number | The order's name, such as `#1001`. |
| Order summary | One line with the order number, items, shipping address and total. |
| Order total | The total with its currency, such as `USD 254.79`. |
| Payment method | The order's gateway names. See [Payment method](#payment-method). |
| Item count | The total quantity of items. |
| Custom text | The text you type, the same for every order. Up to 255 characters. |

If a rule matches but the order has no value for one of its variables, such as a guest checkout without a first name, that rule is skipped and the next rule is checked. The fallback is skipped the same way. To always send something, use **Custom text** or a field every order has.

## What happens when an order comes in

1. Each AI agent connected to the store checks its active *Order created* automation.
2. Rules are checked from top to bottom. The first rule that matches and can fill all its variables sends its template.
3. If no rule sends, the fallback sends, if it's on and can fill its variables.
4. The message goes to the phone number on the order. Each order gets at most one message per AI agent, even if Shopify sends the same order twice.

## Manage your automations

The **Automation** tab lists each automation with its type, its trigger, when it was last updated and whether it's **Active**. Use **Category** to show only one type.

![The Category filter open with All and Shopify](https://mintcdn.com/chatbase/vqI1HlwQDAQejNk0/user-guides/integrations/images/whatsapp-automations/14-category-filter.png?fit=max\&auto=format\&n=vqI1HlwQDAQejNk0\&q=85\&s=3a6ce1a47fd05657fa43e5ebe8594b7d)

When every trigger already has an automation, **Add automation** is disabled. Hover over it to see why.

![A tooltip on the disabled Add automation button: Each trigger can have one automation. Edit the existing one instead.](https://mintcdn.com/chatbase/vqI1HlwQDAQejNk0/user-guides/integrations/images/whatsapp-automations/15-one-per-trigger.png?fit=max\&auto=format\&n=vqI1HlwQDAQejNk0\&q=85\&s=8498671b5f67bb62ac2f055a0d9b9085)

### Edit, turn off or on

Click an automation to edit it. Its saved rules start collapsed and show their names; click a rule to expand it.

![Match & send with two collapsed rules: Match cash and Match Example Pay](https://mintcdn.com/chatbase/vqI1HlwQDAQejNk0/user-guides/integrations/images/whatsapp-automations/12-rules-collapsed.png?fit=max\&auto=format\&n=vqI1HlwQDAQejNk0\&q=85\&s=ebb5f5f3458198e1540166d7ccb0f625)

Use the **Active** switch next to **Save changes** to turn the automation off or back on, then click **Save changes**. You stay on the page after saving. **Save changes** stays disabled until you change something.

![Edit automation header with the Active switch turned on next to the Save changes button](https://mintcdn.com/chatbase/vqI1HlwQDAQejNk0/user-guides/integrations/images/whatsapp-automations/13-edit-header.png?fit=max\&auto=format\&n=vqI1HlwQDAQejNk0\&q=85\&s=f6d21c48d0c03d9aefeb8df11e318a77)

### Delete

Open the **⋯** menu on an automation and choose **Delete**, then confirm. Deleting can't be undone.

![The automation's menu open with Delete](https://mintcdn.com/chatbase/vqI1HlwQDAQejNk0/user-guides/integrations/images/whatsapp-automations/16-delete-menu.png?fit=max\&auto=format\&n=vqI1HlwQDAQejNk0\&q=85\&s=5bb981705ddf4fe8fefea2bd8011ef61)

> [!WARNING]
>
> Disconnecting Shopify from your AI agent deletes its Shopify automations.

### Limits

* One automation per trigger for each AI agent.
* Up to 25 rules per automation and 10 conditions per rule.
* Up to 50 variables in a template body.
* Rule names, condition values and custom text can be up to 255 characters.

## Example: confirm cash on delivery and Example Pay orders

A store offers two manual payment methods, **Cash on Delivery (COD)** and **Example Pay**. It wants every order paid with either one confirmed on WhatsApp, greeting the customer by first name when the order has one.

It uses one approved template, *order\_confirm*:

```text wrap theme={null}
Hello {{1}},

We received your order {{2}}. We'll send you a status update once your payment is approved.

Thank you for shopping with us!
```

The automation has two rules and a fallback, all with this template and `{{2}}` = Order number:

| Name | Conditions | `{{1}}` |
| - | - | - |
| Match cash | Payment method contains `cash` | Customer first name |
| Match Example Pay | Payment method is `Example Pay` | Customer first name |
| Fallback | None | Custom text `there` |

What each order gets:

| Order | Sent by | Message starts with |
| - | - | - |
| Cash on Delivery (COD), has a first name | Match cash | "Hello Sara, …" |
| Example Pay, has a first name | Match Example Pay | "Hello Sara, …" |
| Either method, no first name | Fallback | "Hello there, …" |
| Any other payment method | Fallback | "Hello there, …" |

The fallback sends to every order no rule sends to. To message only cash and Example Pay orders, turn the fallback off and add a copy of each rule with `{{1}}` = Custom text `there` below the original.

## Troubleshooting

> [accordion] A customer placed an order but got no message
>
> Check, in order:
>
> 1. The automation is **Active** on the AI agent connected to the store.
> 2. A rule's conditions match the order, or the fallback is on. For **Payment method**, compare your value with the order's gateway name; see [Payment method](#payment-method).
> 3. The order has a value for every variable the matching template uses. A missing value skips that rule or the fallback.
> 4. The order has a valid phone number.
> 5. The template is still approved in WhatsApp Manager, and its header has no variables.

> [accordion] The wrong template was sent
>
> Rules are checked from top to bottom and the first match wins. Drag the more specific rule above the general one.

> [accordion] A template I created doesn't appear in the picker
>
> Only approved templates of the WhatsApp number in **Send from** are listed. Check its status in WhatsApp Manager, or pick the number the template belongs to.

## Frequently asked questions

> [accordion] Can I send a message without any conditions?
>
> Yes. Turn on the fallback and leave out the rules. The fallback then sends on every order.

> [accordion] Do automations send free-form messages?
>
> No. WhatsApp only lets businesses start a conversation with an approved template, so every automation message is a template.

> [accordion] Does a new automation start sending right away?
>
> Yes. **Save & enable** creates it already active. To pause it, open it, turn off **Active** and save.

> [accordion] What happens to my automations if I disconnect Shopify?
>
> They're deleted. After reconnecting, create them again.

## Next steps

> [card] [WhatsApp Templates](https://chatbase.co/docs/user-guides/integrations/whatsapp-templates.md)
>
> Create and get approval for the templates your automations send.


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