Updated on October 29, 2026
To connect Shopify to the official WhatsApp Business API, you subscribe to store webhooks (orders/create, orders/paid, fulfillments/create, fulfillment_events/create and checkouts/update), receive those events in your own backend, and send a Meta-approved template for each one. Order confirmation, payment and tracking messages are utility templates; the abandoned cart reminder is marketing and needs its own opt-in. No plugin that automates WhatsApp Web is involved: it is two official APIs talking to each other.
The big picture for online stores (message map, cost per order) is in our guide to the WhatsApp API for ecommerce. This article focuses on Shopify: topics, scopes, signature checks, code and opt-in. The WhatsApp side is the same Cloud API covered in the official WhatsApp API guide, and the Shopify side can be a custom app for a single store or a public app if you sell the integration to merchants.
Which Shopify webhooks to use
Shopify’s webhook reference lists dozens of topics. For order notifications, these are enough:
| Topic | When it fires (Shopify docs) | WhatsApp message | Category |
|---|---|---|---|
orders/create | Whenever an order is created | Order received (or awaiting payment, for delayed payment methods) | Utility |
orders/paid | Whenever an order is paid | Payment confirmed | Utility |
fulfillments/create | Whenever a fulfillment is created | Order shipped, with carrier and tracking number | Utility |
fulfillment_events/create | Whenever a fulfillment event is created | Out for delivery, delivered, delayed or failed | Utility |
checkouts/create and checkouts/update | Whenever a checkout is created or updated | Input for the abandoned cart reminder | Marketing |
customers_whats_app_marketing_consent/update | Whenever a customer’s WhatsApp marketing consent is updated | None: it updates your opt-in records | — |
Payload details that matter in code:
fulfillments/createincludesorder_id,tracking_company,tracking_numberandtracking_url. Look up the phone number in the order you stored onorders/create.fulfillment_events/createincludesstatus, with values from the FulfillmentEventStatus enum such asin_transit,out_for_delivery,delivered,delayedandfailure. Only notify the milestones customers care about.- The checkout includes
abandoned_checkout_url,phoneandcompleted_at, andcompleted_atis filled in once the purchase is completed.
Scopes and protected customer data
According to Shopify’s access scopes, read_orders covers Order, Fulfillment and AbandonedCheckout, so it handles every topic in the table. By default it only reaches orders from the last 60 days; for older orders, also declare read_all_orders.
Phone, name, email and address are protected customer data: your app requests each field, and fields that are not approved come back redacted. Public apps go through Shopify review. Without the phone field, you get the order but have no one to message.
The number may live in phone, shipping_address.phone, billing_address.phone or customer.phone. Pick an order of preference and normalize it to the format the WhatsApp API expects: digits only, with the country code and no + (for example, 15551234567 for a US number).
Signature, timeouts and duplicates
Shopify’s page on delivering webhooks through HTTPS sets the rules your endpoint must follow:
- Signature. The
X-Shopify-Hmac-SHA256header carries a Base64 HMAC-SHA256 of the raw body, keyed with your app’s client secret. Compute it before any JSON parser touches the body. - Response time. One-second connection timeout and five seconds for the whole request. Anything other than a 200 counts as a failure.
- Retries. Shopify retries 8 times over the next 4 hours. Subscriptions created through the Admin API are deleted after 8 consecutive failures.
- Duplicates.
X-Shopify-Webhook-Idis unique per delivery;X-Shopify-Event-Idis shared by all deliveries triggered by the same merchant action.
In practice: return 200 right away and send the WhatsApp message afterwards, from a queue. A slow API call inside the handler makes Shopify redeliver the event, and the customer gets the confirmation twice.
Want to try it while you read? Create a Vectalk account and send your first message through the official API. Create free account →
Node.js example
The example verifies the HMAC, drops duplicates and sends templates through Vectalk, which accepts the same payload as Meta’s Cloud API. The in-memory structures are for demonstration only; in production, use a database with a unique key and a queue with retries.
import crypto from 'node:crypto';
import express from 'express';
const SHOPIFY_SECRET = process.env.SHOPIFY_CLIENT_SECRET;
const VECTALK_URL = 'https://apis.vectalk.com.br/api/messages';
const VECTALK_TOKEN = process.env.VECTALK_TOKEN; // instance token
const seen = new Set(); // processed X-Shopify-Webhook-Id values
const orders = new Map(); // order_id -> { phone, name, number, optin }
function validHmac(raw, header) {
const computed = crypto.createHmac('sha256', SHOPIFY_SECRET).update(raw).digest();
const received = Buffer.from(header || '', 'base64');
return received.length === computed.length && crypto.timingSafeEqual(computed, received);
}
function phoneOf(o) {
const raw = o.phone || o.shipping_address?.phone || o.billing_address?.phone || o.customer?.phone;
return raw ? raw.replace(/\D/g, '') : null; // assumes the country code is present
}
function orderOptin(o) {
return (o.note_attributes || []).some((a) => a.name === 'whatsapp_orders' && a.value === 'yes');
}
async function sendTemplate(to, name, body, buttonSuffix) {
const components = [{ type: 'body', parameters: body.map((text) => ({ type: 'text', text })) }];
if (buttonSuffix) {
components.push({ type: 'button', sub_type: 'url', index: '0', parameters: [{ type: 'text', text: buttonSuffix }] });
}
const r = await fetch(VECTALK_URL, {
method: 'POST',
headers: { Authorization: `Bearer ${VECTALK_TOKEN}`, 'Content-Type': 'application/json' },
body: JSON.stringify({
messaging_product: 'whatsapp',
to,
type: 'template',
template: { name, language: { code: 'en_US' }, components },
}),
});
if (!r.ok) throw new Error(`${name}: ${r.status} ${await r.text()}`);
return (await r.json()).messages[0].id; // wamid: store it with the order
}
const handlers = {
'orders/create': async (o) => {
const p = { phone: phoneOf(o), name: o.customer?.first_name || '', number: o.name, optin: orderOptin(o) };
orders.set(o.id, p);
if (!p.phone || !p.optin) return;
const template = o.financial_status === 'pending' ? 'order_awaiting_payment' : 'order_received';
await sendTemplate(p.phone, template, [p.name, p.number, o.total_price]);
},
'orders/paid': async (o) => {
const p = orders.get(o.id);
if (p?.phone && p.optin) await sendTemplate(p.phone, 'payment_confirmed', [p.name, p.number]);
},
'fulfillments/create': async (f) => {
const p = orders.get(f.order_id);
if (!p?.phone || !p.optin || !f.tracking_number) return;
await sendTemplate(p.phone, 'order_shipped',
[p.name, p.number, f.tracking_company || 'the carrier', f.tracking_number],
String(f.order_id)); // button: https://yourstore.com/track/{{1}}
},
'fulfillment_events/create': async (e) => {
const p = orders.get(e.order_id);
if (p?.phone && p.optin && e.status === 'delivered') {
await sendTemplate(p.phone, 'order_delivered', [p.name, p.number]);
}
},
};
const app = express();
app.post('/webhooks/shopify', express.raw({ type: 'application/json' }), (req, res) => {
if (!validHmac(req.body, req.get('X-Shopify-Hmac-SHA256'))) return res.sendStatus(401);
const id = req.get('X-Shopify-Webhook-Id');
res.sendStatus(200); // acknowledge before calling the WhatsApp API
if (seen.has(id)) return;
seen.add(id);
const handler = handlers[req.get('X-Shopify-Topic')];
if (handler) handler(JSON.parse(req.body)).catch((err) => console.error(err));
});
app.listen(3000);
The tracking button uses a dynamic URL (fixed base plus a suffix), so the store’s /track/{id} route redirects to the carrier’s tracking_url. Keep the returned wamid so you can match it with the delivery statuses from the WhatsApp webhook.
Templates: utility on one side, marketing on the other
Meta’s template categorization guidelines say utility must be non-promotional and specific to the user, such as confirming, updating or canceling an order. Templates with mixed content, like an order update with a promo, are marketing. Examples for a Shopify store:
| Template | Suggested text | Category |
|---|---|---|
order_received | Hi {{1}}! We got your order {{2}} for {{3}}. We’ll let you know here when it ships. | Utility |
order_awaiting_payment | Hi {{1}}! Your order {{2}} ({{3}}) is awaiting payment. Payment instructions are in your confirmation email. | Utility |
payment_confirmed | {{1}}, payment for order {{2}} is confirmed. We’re packing your items now. | Utility |
order_shipped | {{1}}, your order {{2}} shipped with {{3}}. Tracking number: {{4}}. Button: Track order | Utility |
order_delivered | {{1}}, order {{2}} shows as delivered. If anything went wrong, reply to this message. | Utility |
cart_reminder | You left items in your Example Store cart. Want to finish checking out? Button: View cart | Marketing |
The awaiting-payment message matters most in markets like Brazil, where many shoppers pay by Pix (instant bank transfer) or boleto (a payable bank slip), so the order exists before the money arrives. For more ready-made copy, see WhatsApp template examples. If Meta recategorizes a template, how Meta classifies your template explains the criteria.
Abandoned cart with checkouts/update
Shopify has no “checkout abandoned” topic: abandonment is a checkout that has not turned into an order after some time. The flow:
- On
checkouts/createorcheckouts/update, store thetoken, phone,abandoned_checkout_urland timestamp. - Schedule a check a few hours later.
- Send only if the checkout still has no
completed_atand the customer opted in to marketing. - Send a single reminder, with the cart link on the button and a clear way to opt out.
Under Meta’s guidelines, cart retargeting is marketing “even if requested by users.” Marketing costs more than utility (for recipients in Brazil, R$ 0.3217 versus R$ 0.0350 per delivered message, in Brazilian reais) and is subject to per-user marketing limits, so some reminders will not be delivered. The Brazilian playbook for Pix, boleto and cart recovery is in recover Pix, boleto and abandoned carts on WhatsApp.
Opt-in at Shopify checkout
Meta asks that opt-in make clear the person agrees to receive WhatsApp messages from that business, and recommends separate consent per message type (Get opt-in for WhatsApp). On Shopify:
- Shopify Plus: a checkout UI extension with a checkbox on the information, shipping or payment step writes a cart attribute with
applyAttributeChange. It reaches the order innote_attributes, where the code looks forwhatsapp_orders. On other plans, those steps do not accept extensions. - Cart page: a cart attribute field in the theme, which also lands in
note_attributes. - Customer record: if the store tracks WhatsApp marketing consent on the customer, the
customers_whats_app_marketing_consent/updatetopic tells your backend about every change.
Use two separate, unchecked boxes (order updates and offers) and store the date, source and accepted text. See how to build a WhatsApp opt-in list. If you sell to Brazil, the LGPD (Brazil’s data protection law) also applies; this article is not legal advice.
How to do it with Vectalk
Vectalk is a proxy for Meta’s official WhatsApp Cloud API: the backend above sends Meta’s exact JSON to https://apis.vectalk.com.br/api/messages, with an instance token in the Authorization header. Templates live in the dashboard (with a Template Library to start from), delivery statuses reach your webhook in Meta’s format, and each delivered message is deducted from a prepaid balance, so you don’t add a card to Meta. Store logic (events, cart reminders, customer service) stays in your backend, and the number can keep running in the WhatsApp Business app through coexistence. Start with the docs or create an account. On another platform? See the same flow for WooCommerce and Nuvemshop/Tiendanube.
Frequently asked questions
Can the order confirmation include a coupon for the next purchase?
It can, but then the template is no longer utility. Under Meta’s guidelines, mixed content is marketing, with marketing pricing and rules. Send the coupon separately, to customers who opted in to marketing.
Why did the customer get the same message twice?
Almost always the endpoint took longer than five seconds or did not return 200, so Shopify redelivered. Acknowledge immediately, use a queue and drop repeats by X-Shopify-Webhook-Id.
How do I verify the WhatsApp webhook signature as well?
They are two different secrets: your Shopify app’s client secret verifies X-Shopify-Hmac-SHA256, and your Meta app secret verifies X-Hub-Signature-256 on WhatsApp webhooks. The second is covered in WhatsApp webhook signature validation.
How much does an order notification cost?
Since October 1, 2026, each utility template delivered to a Brazilian number costs R$ 0.0350 on Meta’s rate card; four notifications per order add up to R$ 0.14 before volume discounts. Rates vary by recipient country; see WhatsApp API pricing in Brazil.
Official sources consulted on October 29, 2026: Shopify: webhook reference, Shopify: deliver webhooks through HTTPS, Shopify: access scopes, Shopify: protected customer data, Shopify: checkout UI extensions, Shopify: FulfillmentEventStatus, Shopify: order note attributes, Meta: template categorization, Meta: get opt-in for WhatsApp, Meta: pricing, WhatsApp Business Messaging Policy, Vectalk: documentation.
Put your business on the official WhatsApp
Create your account, connect your number to the official API (you can keep the app with coexistence) and start serving customers and sending messages.
