COD · Order confirmation
Multi-workflowD2C brandsCOD order confirmation on WhatsApp before anything ships
Every COD order that ships without a real buyer behind it costs two shipping legs and a blocked unit of stock. Three workflows ask, listen and sweep, so only confirmed orders reach the warehouse.
Valnora & Elric team5 min read
- WorkflowsThe visual builder: blocks, models and integrations wired into agent logic.
- TablesA database, built in, for cases, queues and decisions.
- DashboardsCharts, tables and KPI tiles over governed metrics.
- RulesPlain-language checks that pass, fail or flag a record.
- LogsEvery run traced block by block.
Cash on delivery lowers the barrier to buy, and it also lowers the barrier to order on a whim. A buyer who forgets, changes their mind or never meant it costs you a forward shipment, a return shipment and a unit of stock sitting in a courier hub for a week. Asking every COD buyer to confirm before you pack is one of the cheapest fixes in D2C. Doing it by hand at 9 pm is not.
This post lays out three workflows in Agent Serve that do the asking, listening and chasing, with a table that records every step.
The shape of the solution
Three workflows: ask, listen, sweep
Workflow 1 · Ask
- 01Shopify order webhookShopify sends each new order to the workflow’s Webhook trigger.
- 02COD and opt-in checkContinues only for COD orders from customers who opted in to WhatsApp updates.
- 03WhatsApp templateApproved template with Confirm, Cancel and Change address quick-reply buttons.
- 04Confirmations tableRow per order: status Pending, value, pincode, sent time, channel.
Workflow 2 · Listen
- 05WhatsApp triggerEach reply arrives through the WhatsApp webhook trigger.
- 06Match and actFinds the order, adds a tag and note in Shopify, or cancels it with restock if the buyer said cancel.
- 07Reply in the chatConfirms back to the buyer. Address changes get a list message inside the open service window.
Workflow 3 · Sweep
- 08Hourly scheduleReads Pending rows from the confirmations table.
- 09SMS fallbackAfter 4 hours without a reply, one SMS through Twilio with a short link.
- 10Call for high valueHigh-value orders still pending are passed to Agent Inbound & Outbound for a confirmation call.
- 11Cancel unconfirmedAfter your window, low-value orders are cancelled in Shopify with restock and a notice.
Each workflow has one job, which keeps them easy to test and change. They share a confirmations table in Tables, one row per COD order, so every workflow reads and writes the same status.
Workflow 1: ask as soon as the order lands
Shopify has no Agent Serve trigger. In Shopify admin, create an orders webhook that points at the Webhook trigger of the first workflow in the workflow builder. The workflow:
- Checks the payment method. Prepaid orders stop here.
- Checks that the buyer opted in to WhatsApp messages at checkout. No opt-in, no WhatsApp; those orders go straight to the SMS path.
- Sends an approved WhatsApp template with the Send Template operation. The template carries three quick-reply buttons: Confirm order, Change address, Cancel.
- Writes a Pending row with order value, pincode and sent time.
A note on consent. WhatsApp’s Business Messaging Policy expects people to opt in before a business messages them, and messages you start must use a template Meta has approved. Order confirmation is usually a utility template, but approval is Meta’s decision, so keep the wording about the order and leave promotions out.
Workflow 2: act on the reply
Replies come in through the WhatsApp webhook trigger. An agent block matches the reply to the order by phone number and the order reference in the conversation, then acts:
- Confirm: adds a
cod-confirmedtag in Shopify and replies with a thank-you. - Cancel: cancels the order in Shopify with restock and the customer notification on. It is COD, so there is nothing to refund.
- Change address: because the buyer just wrote to you, the 24-hour service window is open. The workflow uses Send Interactive to ask whether the change is a flat number, landmark or a different pincode, adds the new detail to the order note and tags it for support. The Shopify order update covers note, tags and email only, so a person edits the shipping address.
Free-text replies such as "deliver after 6 pm" go into the note too, with the tag cod-note for the packing team.
What the solution produces
WhatsApp confirmation template (illustrative)
MessageHi Priya, thanks for your order #48213 from Kaveri Studio.
2 items · ₹2,340 · Cash on delivery
Delivering to: 14 Lake View Road, Jayanagar, Bengaluru 560041
Please confirm so we can pack it today.
[Confirm order] [Change address] [Cancel]
Confirmation log row (illustrative)
Record- Order
- #48213 · ₹2,340 · COD · 560041
- WhatsApp sent
- 19:42 · delivered 19:42 · read 19:51
- Reply
- Change address at 19:53
- Action
- Shopify tags: cod-confirmed, address-change. Note: new flat number 3B.
- Owner
- Support to update the shipping address before pick-up
- Status
- Confirmed · address pending
Workflow 3: the hourly sweep
A Schedule trigger runs every hour and reads Pending rows:
- After 4 hours with no reply, or for buyers without WhatsApp opt-in, send one SMS with Twilio and a link to confirm. Twilio’s SMS-received trigger can catch a reply of YES or NO.
- High-value orders still pending after 12 hours, above a threshold you set such as ₹5,000, are passed to Agent Inbound & Outbound for a confirmation call. It is a separate Valnora & Elric product, available by invitation, that places and answers calls and records the outcome.
- Anything still pending after 24 hours is cancelled in Shopify with restock, and the buyer is told why and how to reorder.
Every threshold lives in a rule, so ops can change "4 hours" or "₹5,000" without editing the workflow.
What to put on the dashboard
The confirmations table feeds a small dashboard: confirmation rate by hour and by channel (WhatsApp, SMS, call), cancellations before dispatch, average time to reply, and RTO rate for confirmed vs unconfirmed orders that shipped anyway. That last panel is how you decide whether the window is too long or too short.
Controls
Controls and governance
Run logs
Every workflow run records each block’s inputs, outputs and errors, so a reviewer can trace how a result was reached.
Deployed versions
Workflows run from a deployed version, so a change is reviewed before it reaches production runs.
PII detection
A Guardrails block detects personal data and blocks or masks it before text reaches the next step.
Roles and permission groups
Admin, write and read roles per workspace, plus permission groups that limit which models, blocks and integrations a team can use.
Audit trail
Proposals, approvals, declines and executed actions are written to the workspace audit log, which admins can export.
More on how Agent Serve handles access, data and audit on the security page.
Every run is in Logs, block by block, so when a buyer says "I never got a message" support can see exactly what was sent and when. Phone numbers and addresses can be masked in logs with PII redaction. Workflows run from a deployed version, so a template change is reviewed before buyers see it.
What you need
- A WhatsApp Business account and an approved confirmation template with three quick-reply buttons
- A record of WhatsApp opt-in at checkout, readable from the order or customer
- Shopify admin access for the orders webhook and an app token for order updates
- A Twilio number for SMS fallback
- Your cancellation window and high-value threshold, agreed with ops and finance
- Access to Agent Inbound & Outbound if you want calls for high-value orders (by invitation)
For what happens after dispatch, see non-delivery follow-up for RTO.
Questions teams ask
Can the workflow change the shipping address in Shopify?
Not directly. The Shopify order update covers note, tags and email. The workflow records the new address in the order note and tags the order, and a person updates the shipping address before pick-up.
We use Gupshup, WATI or Interakt for WhatsApp. Does this still work?
Those providers are not native integrations. You can call their APIs with the API block, with the key stored as a workspace secret, or use the built-in WhatsApp blocks with your own WhatsApp Business account.
Does the AI decide whether an order is fake?
No. The workflows follow fixed steps: ask, record the answer, remind, escalate and cancel after a window you set. Any risk scoring you add is a rule you can read and change.