Register your interest: Tag @Cody, get an agent
BlogResources

How to build a WhatsApp AI agent for e-commerce

Learn how to build a WhatsApp AI agent for e-commerce — order tracking, product discovery, returns, Shopify integration, and abandoned cart recovery.

Rebecca PearsonRebecca Pearson7 min read

Summarize with AI

How to build a WhatsApp AI agent for e-commerce
On this page

E-commerce is one of the highest-value use cases for WhatsApp AI agents. Your customers are already on WhatsApp. They're already asking questions about orders, products, and returns. The question isn't whether to be there — it's how to make the experience good enough that it converts and retains customers. Here's how to build a WhatsApp AI agent for e-commerce that handles the full customer journey.

TL;DR

  • Order tracking is the highest-volume use case — "where's my order?" is the most common e-commerce support message, and it's trivially automatable with a Shopify integration.
  • Product discovery is where AI agents genuinely outperform chatbots — a customer describing what they need can be matched to the right product in natural language.
  • Inbound abandoned cart recovery works — when a customer who abandoned a cart messages you, the bot can surface their cart and offer to help them complete the order.

Why WhatsApp is a natural fit for e-commerce

Email is the traditional e-commerce communication channel. Order confirmations, shipping updates, promotional messages — all sent via email. But email open rates hover around 20%, and response rates are even lower.

WhatsApp open rates sit at around 98%. When a customer messages you on WhatsApp, they're in a conversational mindset — they expect a reply, and they're ready to engage. That's a fundamentally different dynamic than an email that gets buried in an inbox.

For e-commerce businesses, this creates opportunities at every stage of the customer journey: discovery, purchase, fulfilment, and re-engagement.

Use case 1: order tracking

"Where's my order?" is the most common customer service query in e-commerce. In many businesses, it accounts for 30–50% of all support contacts. It's also the most automatable — the answer is in your order management system, and retrieving it requires a simple lookup.

The flow:

  1. Customer sends "where's my order?" (or any variation: "order status", "tracking", "has my parcel shipped?")
  2. Bot asks for the order number or the email address used at checkout
  3. Bot queries your order management system (Shopify, WooCommerce, or whatever you use)
  4. Bot returns the current status: "Your order #12345 was dispatched on 14 July and is estimated to arrive tomorrow. Your tracking number is GB123456789."
  5. If the customer wants to track it live, the bot sends the carrier tracking link

This flow, fully automated, handles hundreds of "where's my order?" queries a day without any human involvement.

Use case 2: product discovery and recommendations

A customer who knows exactly what they want can find it on your website. But a customer who knows what they need — without knowing what it's called or whether you stock it — is harder to serve via a product catalogue.

In WhatsApp, natural language description works. A customer can say "I'm looking for a gift for my mum, she's really into cooking, budget around £50" and an AI agent can engage with that description, ask a clarifying question or two, and surface the right products from your catalogue.

This is the use case where AI agents genuinely outperform traditional chatbots. A menu-based bot can't handle open-ended product discovery. An AI agent can hold a consultative conversation, much like a good in-store sales assistant.

With Shopify connected via Composio, the bot can search your product catalogue in real time and send links to specific products, including prices and availability.

Use case 3: returns and refunds

Returns are a pain point for customers and for support teams. The customer has to find the returns policy, complete a form, wait for a label, and then often follow up because they're not sure the return was received.

A WhatsApp returns flow simplifies this:

  1. Customer messages "I want to return an order"
  2. Bot asks for the order number and reason for return
  3. Bot checks your returns policy (is it within the return window? Is the item eligible?)
  4. Bot confirms the return, generates a returns label link, and sends it in chat
  5. Bot confirms receipt when the warehouse processes the return

This flow saves significant support time and, importantly, makes customers feel cared for. A fast, easy return experience often converts a potentially negative situation into a loyalty moment.

Use case 4: size and fit guidance

For fashion and apparel businesses, size and fit queries are high volume and high stakes. A customer who orders the wrong size returns the item. A customer who got helpful guidance before ordering — and ordered the right thing first time — has a better experience and a lower return rate.

In WhatsApp, the bot can ask relevant questions ("what's your usual size in other brands?", "are you between sizes?", "is this for a relaxed or fitted look?") and guide the customer to the right choice. It can also handle fabric questions, care instructions, and anything else a customer might need before committing to a purchase.

Use case 5: inbound abandoned cart recovery

Outbound abandoned cart messages — blasting everyone who left something in their cart — are restricted by WhatsApp's messaging policies (you need an opt-in template and appropriate business tier). But inbound recovery works differently and is completely unrestricted.

When a customer who has an abandoned cart messages your WhatsApp number — for any reason — the bot can check whether they have an active cart. If they do, it can surface it: "By the way, you have some items in your basket — do you want to pick up where you left off?" This is contextual, welcome, and converts well because the customer is already in conversation with you.

This requires connecting your e-commerce platform to the bot so it can look up cart status by phone number. With Shopify and Composio, this is a standard integration.

Use case 6: loyalty and re-engagement

For customers who've ordered before, the bot can be proactive in a compliant way: when an existing customer messages in, acknowledge their history. "Welcome back, Sarah. Your last order of the lavender candle set was on 12 March — is there anything I can help you find today?"

This kind of personalisation, which feels natural in a one-to-one conversation, is much harder to replicate in email or on a website. It's a genuine advantage of the WhatsApp channel — and it's available to any business that stores basic order history.

Building the Shopify integration

Shopify is the most common e-commerce platform for businesses building WhatsApp agents, and Composio provides a direct integration.

With CodeWords, you describe the flow to Cody, the builder inside CodeWords, and specify that you want to connect to Shopify. Cody builds the integration — the API calls, the data mapping, the conditional logic — without you needing to write code.

For order tracking, you tell Cody: "When a customer asks where their order is, ask for their order number, look it up in Shopify, and reply with the current status and tracking number."

For product discovery, you tell Cody: "When a customer describes what they're looking for, search my Shopify product catalogue and suggest the three most relevant products with links."

What good e-commerce agents do well

The best e-commerce WhatsApp agents share a few characteristics:

They stay focused. They're great at e-commerce tasks and don't try to be everything. When a customer asks something outside scope, they acknowledge it and redirect.

They personalise. They use the customer's name, reference their order history, and make the experience feel one-to-one rather than automated.

They escalate well. For complaints, refund disputes, and genuinely complex situations, they hand over to a human quickly and gracefully — with the full conversation context included.

They close the loop. Order confirmed, payment received, return processed — they always send the final confirmation message so the customer isn't left wondering.


Related reading

Getting order data right

Almost every e-commerce agent lives or dies on one thing: whether it can answer "where is my order" accurately. Everything else is secondary, because that single question dominates inbound volume in most stores.

Identify the customer before you disclose anything. Order details are personal data. Matching on the WhatsApp number is reasonable where the number is on the order; where it isn't, the agent needs another check before reading anything out. An agent that cheerfully reads an order to whoever asks is a data problem waiting to happen.

Read from the source, not a copy. Status held in a synced spreadsheet goes stale, and a stale tracking answer is worse than none because the customer acts on it. If the store and the carrier disagree, say what each says rather than picking one.

Say when you don't know. Carrier tracking gaps are normal and customers handle them fine if told honestly. What they don't forgive is a confident answer that turns out wrong.

Handle the follow-up question. "Where is my order" is usually followed by "can I change the address" or "can I cancel it." Decide in advance which of those the agent may do and which need a person, because those are actions rather than answers.

Returns, refunds, and where automation should stop

Returns are the second-biggest volume driver and the place where the temptation to over-automate is strongest.

Issuing a return label against a clear policy is a good automation: the rules are defined, the outcome is checkable, and the customer gets an immediate answer. Deciding an exception is not. A customer outside the window with a reason attached is a judgment about goodwill and lifetime value, and an agent applying policy rigidly there costs more than the handling time it saved.

The pattern that works is the agent handling everything inside policy immediately, and routing anything outside it to a person with the order history and the request already summarized. That keeps the fast path fast while making the exceptions cheap to decide.

Refunds themselves deserve a person or a specifically tested connection, because money leaving the business unattended is a different risk category from a label being generated.

Frequently asked questions

Can it handle abandoned carts?

Only inbound and consented. Messaging people who abandoned a cart but never agreed to be contacted on WhatsApp is unsolicited outbound, and it's how numbers get restricted. Where a customer has opted in, a single well-timed reminder is reasonable; a sequence of them is not.

Does it need to integrate with our store platform?

For order status, yes, because the whole value is live data. For product questions and policy answers it can work from content you provide, which is a reasonable first build while you arrange the deeper connection.

What about peak periods?

Peak is when it earns its keep, and also when its failure modes are most visible. Test against peak-shaped volume before peak arrives, particularly what happens when your store platform is slow to respond, because that's exactly when it will be.

Should the agent recommend products?

Cautiously, and grounded in your actual catalogue rather than generated. An agent suggesting an item you don't stock, or describing a product inaccurately, creates a worse experience than not recommending at all. Where it works well is narrowing a large catalogue by what someone describes, then handing them real listings to choose from.

How does this work alongside our existing helpdesk?

Best as a first layer rather than a replacement. The agent resolves the high-volume, well-defined questions immediately and passes everything else into the helpdesk with the order details and conversation already attached. That keeps your ticket history intact and means agents pick up prepared context rather than starting from a one-line message.

How do we handle customers who message about several orders?

Have the agent establish which order before answering anything, rather than assuming the most recent. Customers with multiple open orders are usually your best customers, and getting their tracking confused is a poor way to reward that. A short clarifying question costs one message and avoids a wrong answer.

Does this work during a sale or product launch?

It helps most then, provided you've tested against that shape of volume beforehand. Launch periods bring a spike of near-identical questions, which is exactly what an agent handles well, and they also bring the slow store responses and stock discrepancies that expose weak error handling.

Get started today

Your first workflow is free to build.

Describe what you need. Cody handles the build, the connections, and the deployment.