# 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. QwryAI WhatsApp Automations send a customer an approved WhatsApp message template automatically when something happens in a tool your agent is connected to, such as a new order in your Shopify store. They're for stores that want order messages on WhatsApp without sending them by hand. For example, a store can confirm every cash-on-delivery order on WhatsApp as soon as it's placed. 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. ## WhatsApp automation 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 in that tool that starts the automation. | Type | Trigger | Starts when | | - | - | - | | Shopify | Order created | A customer places an order in your Shopify store. | An 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 create a WhatsApp automation * **Connect Shopify** to your agent. See [Shopify](/docs/user-guides/integrations/shopify). Until it's connected, the **Automation** tab shows **Connect Shopify to get started**. * **Connect a WhatsApp number** to the same agent. See [WhatsApp](/docs/user-guides/integrations/whatsapp). 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](/docs/user-guides/integrations/whatsapp-templates). Only approved templates can be picked. * **Make sure orders have a phone number.** The message goes to the phone on the shipping address, then the billing address, then the customer, then the order. Orders without a phone number get no message. ## Create a WhatsApp automation **1. Open the Automation tab** Go to **Channels › WhatsApp › Manage** and open the **Automation** tab. Select **Add automation**. ![The WhatsApp channel's Automation tab with the Create your first automation empty state and the pointer on Add automation.](annotated/01-empty.webp "Automation › Add automation.") **2. Check the type and trigger, and choose the number** The editor opens as **New automation**, with **Type** set to **Shopify** and **Trigger** set to **Order created**. Under **Phone number**, choose the WhatsApp number the messages come from in **Send from**. ![The New automation editor with Type Shopify, Trigger Order created and the Send from field under Phone number.](annotated/02-editor.webp "Type, trigger and Send from.") **3. Add a rule and its conditions** Under **Match & send**, give the first rule a **Rule name** that says what it matches, such as *Match cash*. Then add its conditions. For each one, pick an order field in **Variable**, an operator in **Condition**, and type or pick a **Value**. ![The Variable dropdown open on the Payment & money fields, with Customer & address below, and the pointer on Payment method.](annotated/03-variable.webp "Pick an order field.") ![A rule with Payment method chosen as the Variable and the Condition dropdown open on is, is not, contains and does not contain.](annotated/06-condition.webp "Pick how to compare it.") Choose **Match all** when every condition must be true, or **Match any** when one is enough. Select **Add condition** for more. See [Conditions](#whatsapp-automation-conditions) for every field and operator. ![A rule named Match cash with the condition Payment method contains cash, Match all and Match any, Add condition, and Select template under Then.](annotated/04-rule.webp "A rule: If its conditions match, Then send its template.") **4. Pick the template** Under **Then**, select **Select template** and pick an approved template. Search with **Search...** or filter with **Type**. ![Selecting Select template, searching the approved templates with Search... and Type, and picking order_confirm.](walkthroughs/auto-select-template.gif) > [!WARNING] > > Automations fill the variables in the template's **body**. 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](#whatsapp-automation-template-variables). ![Picking Customer first name for {{1}} and Order number for {{2}} in a rule's template.](walkthroughs/auto-template-variables.gif) The WhatsApp preview on the right shows the message of the rule you're working on, with your choices filled in. ![The WhatsApp preview beside the editor showing the template with Customer first name and Order number filled in.](walkthroughs/auto-preview.gif) **6. Add more rules and a fallback (optional)** Select **Add rule** for more cases, and drag a rule by its handle to change the order. The top-most rule that matches wins. ![A new Rule 2 with its drag handle, empty Rule name, condition and template fields, and the pointer on Add rule.](annotated/08-add-rule.webp "Add rule, then drag to reorder.") To send something when no rule matches, turn on **Send a fallback message**, then pick its template and fill in its variables. ![The Fallback section with Send a fallback message turned on and its Select template field.](annotated/05-fallback.webp "The fallback covers every other order.") ![Setting the fallback's {{1}} to Custom text with the value there.](walkthroughs/auto-custom-text.gif) > [!NOTE] > > An automation needs at least one rule or the fallback: *Add a rule or turn on the fallback*. Missing fields are outlined with *Fill in the highlighted fields*. **7. Save & enable** Select **Save & enable**. QwryAI shows *Automation saved*, turns the automation on, and takes you back to the list. It sends on the next order. ![Selecting Save & enable and the Automation tab listing the Order created automation as Active.](walkthroughs/auto-save-enable.gif) ## WhatsApp automation conditions Conditions compare a field of the new Shopify 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 entered: * **Numbers** must be numbers: *Enter a number*. * **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 three-letter code such as `USD`. * **is set** and **is not set** need no value. ### Payment method condition **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 in Shopify admin under **Settings › Payments › Manual payment methods**, such as `Cash on Delivery (COD)`. ![Shopify admin, Settings › Payments, with the manual payment methods Cash on Delivery (COD) and Example Pay.](walkthroughs/shopify-payment-methods.gif) Other gateways can store a different name from the one your checkout shows. Shopify's test gateway, for example, is stored as `bogus`. To see the gateway of an order, open the order in Shopify and expand the payment line in its **Timeline**. ![A Shopify order's Timeline with the payment line expanded to show the gateway.](walkthroughs/shopify-order-gateway.gif) > [!TIP] > > Use **contains** with a short, distinctive word from the name, such as `cash`, when you're not sure of the exact name. Use **is** when you know it. ## WhatsApp automation template variables The automation fills each variable in a template from the Shopify order, or from text you type. | Value | What it fills in | | - | - | | Customer first name | The customer's first name. | | Customer full name | The customer's full name. | | Customer email | The customer's email 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. | | Payment method | The order's gateway names. See [Payment method condition](#payment-method-condition). | | Item count | The total quantity of items. | | Discount code | The discount code used on the order. | | Shipping address | The shipping address on one line. | | Shipping city | The shipping city. | | Shipping country | The shipping country. | | Custom text | The text you type, the same for every order. Up to 255 characters. | WhatsApp doesn't allow line breaks inside a variable, so each value is a single line. If the order has no value for a variable, such as a guest checkout without a first name, the variable is filled with `-` and the message still sends. Use **Custom text** for a friendlier fixed value. ## What a WhatsApp automation does when a Shopify order comes in 1. Each agent connected to the store checks its active *Order created* automation. 2. Rules are checked from top to bottom. The first rule whose conditions match sends its template. 3. If no rule matches, the fallback sends, if it's on. 4. The message goes to the order's phone number and is added to that customer's WhatsApp conversation in the **Inbox**. Each order gets at most one message per agent, even if Shopify reports it twice. ## Manage your WhatsApp automations The **Automation** tab lists each automation with its trigger, when it was last updated, and whether it's **Active**. Use **Category** to show one type. ![The Automation tab with the Category filter open on All and Shopify, and an Order created automation marked Active.](walkthroughs/auto-category-filter.gif) When every trigger already has an automation, **Add automation** is disabled. Hover over it to see why: *Each trigger can have one automation. Edit the existing one instead.* ![Hovering the disabled Add automation button to show the tooltip.](walkthroughs/auto-add-disabled.gif) ### Edit or pause an automation Select an automation to edit it. Each rule has a button to expand or collapse it. Use the **Active** switch next to **Save** to turn the automation off or back on, then select **Save**. ![Opening an automation, turning off Active and selecting Save.](walkthroughs/auto-edit-active.gif) ### Delete an automation Open the **⋯** menu on an automation and choose **Delete**. In **Delete automation?**, confirm. Deleting can't be undone. ![Opening an automation's ⋯ menu, choosing Delete and confirming in Delete automation?](walkthroughs/auto-delete.gif) ### Limits * One automation per trigger for each 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 on WhatsApp 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. It uses one approved template, *order\_confirm*: ```text 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) | Match cash | "Hello Sara, …" | | Example Pay | Match Example Pay | "Hello Sara, …" | | Any other payment method | Fallback | "Hello there, …" | The fallback sends to every order no rule matches. To message only cash and Example Pay orders, turn the fallback off. ## Troubleshooting > [accordion] Why didn't a customer get a WhatsApp message for their Shopify order? > > Check, in order: > > 1. The automation is **Active** on the 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 condition](#payment-method-condition). > 3. The order has a phone number. > 4. The **Send from** number is connected and switched on in **Channels › WhatsApp**. > 5. The template is still approved in WhatsApp Manager. If it isn't, the editor shows *This template is no longer approved. Select another.* > 6. The template's variables haven't changed since you saved. If they have, open the automation and fill them in again. > [accordion] Why did my automation send the wrong template? > > Rules are checked from top to bottom, and the first match wins. Drag the more specific rule above the general one. > [accordion] Why is my template missing from the template picker? > > **Select template** lists only approved templates of the number in **Send from**. Check the template's status in WhatsApp Manager, or pick the number it belongs to. ## Frequently asked questions > [accordion] Can a WhatsApp automation message every new Shopify order, with no conditions? > > Yes. Turn on the fallback and add no rules. The fallback then sends on every order. > [accordion] What kind of messages do WhatsApp automations send? > > Approved WhatsApp templates. WhatsApp requires businesses to start a conversation with an approved template, so every automation message uses one. > [accordion] Does a new WhatsApp automation start sending right away? > > Yes. **Save & enable** saves it already active. To pause it, open it, turn off **Active** and select **Save**. > [accordion] Who pays for automation messages? > > Meta bills each template message to your WhatsApp Business account at its own rates. > [accordion] Where can I see the messages a WhatsApp automation sent? > > In the **Inbox**. Each message is added to the customer's WhatsApp conversation, so you see it alongside any replies, and your agent answers when the customer writes back. ## Next steps > [card] WhatsApp Templates | /docs/user-guides/integrations/whatsapp-templates | Create and get approval for the templates your automations send.