Send WhatsApp shipping updates when Shopify orders ship
Every hour, just-shipped customers get a WhatsApp message with their order number, carrier and tracking link, so they stop emailing to ask where it is.
Every hour, send a WhatsApp shipping notification to every Shopify customer whose order was fulfilled in the last hour, so they get their tracking details without having to email us asking where their order is. Run this on an hourly cron schedule.
Start with Shopify List Orders to find orders fulfilled in the last hour. Filter to orders whose fulfillment status is fulfilled or partially fulfilled and that were updated since the start of the window. For each order, call Shopify List Fulfillments for Order to pull its fulfillments, and keep only the fulfillments created inside the last hour. If you need fuller customer or shipping detail for an order, use Shopify Get Order.
For each new fulfillment, read the carrier name, the tracking number and the tracking URL. Skip the fulfillment if there is no tracking number yet. That happens when a fulfillment is created before the label is bought, and it will be picked up on a later run once tracking is attached. Prefer the tracking URL Shopify supplies. If there is no URL, send the carrier name and tracking number on their own.
Find the customer's phone number, checking the order phone, then the shipping address phone, then the saved customer record phone. Normalise it to full international format with no plus sign, spaces, dashes or brackets, for example 15551234567. If the number is in a local national format, use the shipping address country to work out the correct country code. Skip the order if there is no usable phone number anywhere.
Send the notification with WhatsApp Send Message as a template message. This is a business-initiated message, so it must use a template that has already been approved in the WhatsApp Business account rather than free text, since the 24-hour customer service window will normally be closed. Pass the order number, the carrier and the tracking link as the template variables, in the order the template defines them.
A given fulfillment must only ever be messaged once. Use the fulfillment ID as the key, and only message fulfillments whose created timestamp falls inside the current hour window. If a run is retried, or if windows overlap, do not resend for a fulfillment that was already covered. When an order ships in several packages, treat each fulfillment separately and make clear which package the tracking refers to.
Finish with Slack Bot Send a Message to the ops channel summarising the run: how many shipping notifications went out, and how many orders were skipped, broken down by reason (no phone number, no tracking number yet, or the WhatsApp send failed). List the skipped order numbers so someone can follow them up.
What does this prompt do?
- Checks every hour for orders that have just been marked as shipped.
- Pulls the carrier and tracking number attached to each new shipment.
- Sends the customer a WhatsApp message with their order number, carrier and tracking link, using your approved message template.
- Posts an hourly Slack summary of how many updates went out and which orders were skipped, and why.
What do I need to use this?
- A Shopify store where you mark orders as fulfilled and add tracking numbers.
- A WhatsApp Business account. Personal WhatsApp accounts cannot send these messages.
- A shipping update message template already approved in your WhatsApp Business account, with slots for the order number, carrier and tracking link.
- Customer phone numbers on your orders, ideally collected at checkout.
- A Slack workspace and a channel for the hourly summary.
How can I customize it?
- Change how often it runs, for example every 30 minutes for faster updates, or twice a day if you ship in batches.
- Swap in a different approved template, or add an extra slot such as the estimated delivery date.
- Pick which Slack channel gets the summary, and skip the summary entirely on hours when nothing shipped.
FAQs
Why does this have to use a pre-approved WhatsApp template?
What happens if an order has no phone number?
Will a customer ever get the same tracking message twice?
What if an order ships in more than one box?
What if the order is marked shipped before a tracking number exists?
Related templates
When someone leaves, we check which shared passwords they used in their final months and post a ranked rotation list to your security channel.
Every Monday, check every S3 bucket for public exposure, missing encryption and weak backup settings, then get the risks ranked in Slack.
Twice every weekday, the conversations from your social inbox land on the right HubSpot contact timelines, with a Slack recap for sales.
Every morning, find the addresses that hard bounced or filed a spam complaint, update the matching HubSpot contacts, and post a short Slack recap.
Every weekday at 4pm, spot the threads that went quiet, stage a ready-to-send nudge in your mailbox, and get a ranked Slack recap.
When you merge a fix in GitHub, this agent checks the matching dead-letter queue, replays the failed messages, and reports back on the pull request and in Slack.
Stop answering "where is my order?"
Let every just-shipped customer hear from you on WhatsApp before they think to ask.