Category: Automations › WhatsApp Sales · Best for: Shopify stores that offer cash on delivery and lose money on fake or refused COD orders · Platform: n8n · Steps: 16
What it does
Every Shopify order gets a WhatsApp confirmation. Cash-on-delivery buyers tap Confirm or Cancel before you ship, and everyone gets their tracking link when it ships.
Refused cash-on-delivery parcels cost you shipping both ways. Asking the buyer to confirm on WhatsApp before you ship lets you hold or cancel the orders nobody will accept.
Works with: Shopify, Google Sheets, WhatsApp
What you get
- The n8n workflow file (
workflow.json), ready to import - This setup guide, including the WhatsApp message templates to create
- Email support if you get stuck
Before you start
-
An n8n account. Easiest: n8n Cloud (free trial). Self-host for free with Docker:
docker run -it --rm -p 5678:5678 -v n8n_data:/home/node/.n8n docker.n8n.io/n8nio/n8n. Other services need to reach your n8n, so a self-hosted n8n must be on a public HTTPS address. -
A WhatsApp Business Cloud API number from Meta (free to set up; Meta charges per conversation, see WhatsApp pricing). Your personal WhatsApp number can't be used.
-
These credentials in n8n (Credentials → Add credential):
- Shopify (
shopifyAccessTokenApi): in Shopify admin open Settings → Apps and sales channels → Develop apps, create an app with theread_orders,write_ordersandread_checkoutsscopes, install it and copy the Admin API access token, your shop subdomain and the app secret. n8n guide - Google Sheets (
googleSheetsOAuth2Api): click Sign in with Google in n8n. n8n guide - WhatsApp Business Cloud (
whatsAppApi): at developers.facebook.com make an app of type Business, add WhatsApp, then create a permanent access token for a system user in Business Settings. In n8n paste the token and your WhatsApp Business Account ID. n8n guide - WhatsApp (incoming messages) (
whatsAppTriggerApi): the App ID and App secret of the same Meta app (App settings → Basic). n8n uses it to hear replies. n8n guide
- Shopify (
Create your WhatsApp templates (once)
Meta only lets a business start a WhatsApp chat with an approved template. Create these in WhatsApp Manager → Message templates → Create template, language English (en). Approval usually takes minutes.
1. cod_confirm (category: Utility, COD orders; add two Quick reply buttons: Confirm order, Cancel order):
Hi {{1}}, thanks for order {{2}} ({{3}}, cash on delivery). Please confirm so we can ship it.
2. order_confirmed (category: Utility, prepaid orders):
Hi {{1}}, your order {{2}} ({{3}}) is confirmed. We'll message you when it ships.
3. order_shipped (category: Utility, on fulfilment):
Hi {{1}}, your order {{2}} has shipped! Track it here: {{3}}
Use other wording if you like, keeping the same {{1}} placeholders. If you rename a template, change the Template field in its WhatsApp box to match (name|language).
Install
- In n8n, click Create workflow (top right).
- Click the ⋯ menu → Import from file and choose
workflow.json. Or copy the file's contents and paste onto the empty canvas with Ctrl/Cmd + V. - Open each box with a red warning triangle and pick the matching credential from the list above.
- In every WhatsApp box, replace
YOUR_WHATSAPP_PHONE_NUMBER_IDwith your Phone number ID (WhatsApp Manager → API setup). - Make a Google Sheet with a tab called Orders and this header row:
order_id | order_name | phone | name | total | cod | status | created_at. Format thephonecolumn as plain text. Paste the sheet's link into the three Google Sheets boxes. - Filter your Shopify orders by the
cod-confirmedtag before you ship. Note: setting tags replaces the order's existing tags.
Then click Save. In each Code box, DEFAULT_COUNTRY_CODE is 91 (India): change it to 1 for the US and Canada, 44 for the UK, and so on.
Test it
- Click Test workflow.
- Place a test COD order on your store with your own number, tap Confirm on WhatsApp, then check the order's tag in Shopify. Fulfil it to get the tracking message.
- Click each box to see its output. A green tick means the step worked. A red box is almost always a credential, a template name that doesn't match, or a number without its country code.
Go live
Toggle Active (top right). From now on it runs on its own. Check Executions in the left sidebar to see every run.
How it works, step by step
- New order fires for every Shopify order.
- Read the order gets the buyer's name, number and total, and spots cash on delivery.
- Log the order saves it in the Orders tab.
- Cash on delivery? sends COD buyers Ask to confirm COD and everyone else Confirm paid order.
- Customer replies hears the button they tap; Find their orders and Confirm or cancel? match it to their waiting order.
- Tag the order in Shopify adds
cod-confirmedorcod-cancelled, Update the order row updates the sheet and Reply to the customer answers them. - Order shipped sends the tracking link when you fulfil the order.
Good to know
- WhatsApp only lets a business message first with an approved template; replies within 24 hours of the customer's last message can be free text.
- Meta sends a WhatsApp number's incoming messages to one webhook at a time. If you run more than one workflow that starts with a WhatsApp trigger (COD replies, follow-up replies, the order bot, the booking bot, reminder replies), give each its own Meta app, or ask us how to merge them into one.