LemuAIDocs

Recipes · 2 min read · For everyone

COD order confirmation call

An AI voice agent calls every cash-on-delivery order a few minutes after it's placed, confirms or cancels it, and tags the order in Shopify.

Open in ChatGPTOpen in ClaudeMarkdown

At the end you'll have a journey that, five minutes after a cash-on-delivery (COD) order, calls the customer, confirms the order (tag cod-confirmed) or cancels it with the reason, and sends a WhatsApp message if nobody answers. Fewer fake orders and fewer returned parcels.

Before you start#

  • Your Shopify store connected under Settings → Integrations (see Shopify), with Order placed events on. To confirm or cancel orders, the app needs the write_orders permission.
  • Telephony set up under Voice Agents → Telephony with a caller ID (see Telephony), and Voice minutes in Usage & Plan.
  • For the fallback message: WhatsApp connected and an approved template, for example "Hi {{1}}, please confirm your order {{2}} of ₹{{3}}" with Confirm and Cancel buttons.

Steps#

  1. Create the voice agent

    Open Voice Agents → Agents and create an agent named COD confirmation (Copilot can build it: "An agent that confirms cash on delivery orders in Hindi or English").

    In Start Call:

    • Greeting: Namaste {{first_name}}, this is Riya from Asian Footwears about your order {{order_name}}. (use your store's name)
    • Prompt: Confirm the customer wants the order of {{total_price}} rupees delivered with cash on delivery. If yes, thank them. If they want to cancel, ask why politely.
    • Enable Variable Extraction: confirmed (Boolean), cancel_reason (String).
  2. Create the journey

    Open Engage → Journeys → New Journey. Choose the trigger Events, event Purchase, with the condition payment_method is cod. Set the delay to 5 minutes and add shopify.order.cancelled as an exit event, so a cancelled order isn't called.

  3. Add the call

    Add a Call step: choose the COD confirmation agent and phone {{context.phone}}. List the variables the agent's prompts use (first_name, order_name, total_price) so they're filled from the order event, and confirmed and cancel_reason as outcomes to bring back into the journey.

  4. Act on the answer

    From the call's completed exit, add a Condition: {{context.confirmed}} is true.

    • true → Shopify step, action Confirm order (adds the tag cod-confirmed).
    • false → Shopify step, action Cancel order, reason from {{context.cancel_reason}} (only unpaid, unshipped orders can be cancelled).
  5. Handle no answer

    From the call's no_answer, busy and voicemail exits, add a WhatsApp step with your confirmation template, then Wait for reply (24 hours): the Confirm button → Shopify Confirm order; Cancel → Cancel order; timeout → Shopify Tag order with not-reached.

  6. Set allowed hours and go live

    In the journey's Workflow Settings, set Allowed hours for calls (for example 10:00 to 19:00). Then Go live.

Check it worked#

  1. Place a test COD order on your store with your own phone number.
  2. Within about 5 minutes your phone rings. Answer and confirm.
  3. Insights → Runs → Journey Runs shows the run with each step; Agent Calls shows the call with confirmed = true.
  4. In Shopify, the order has the tag cod-confirmed.

Common problems#

What you seeFix
No run startsCheck Order placed is ticked in the Shopify integration's Store events, and the order's payment method name contains cash on delivery or cod (see Cash-on-delivery payment methods)
The run waits at the Call stepOutside allowed hours, or all phone lines busy. See Journeys troubleshooting
"The caller ID is not on the provider account"See Calls and telephony
Shopify step failsCancelling a paid or shipped order isn't allowed by Shopify. Tag it instead