← Back to Blog

Building Akua: A Production-Ready WhatsApp AI Shopping Assistant



Building Akua: A Production-Ready WhatsApp AI Shopping Assistant

Building an AI shopping assistant for an e-commerce store like Clickmothercare leaves very little margin for error. When a conventional web application fails, users encounter a 500 error page and hit refresh. However, when an AI assistant invents a product that does not exist in stock, recommends an incorrect size to an expecting mother, or drops a cart mid-conversation, you risk losing that customer permanently.

Clickmothercare required Akua: a WhatsApp assistant capable of understanding natural customer inquiries, checking real-time inventory, and guiding shoppers through checkout. The core challenge involved reliably connecting unpredictable language models to a rigid e-commerce backend.

Common AI Failure Modes We Encountered

Early during development, three primary issues emerged:

  • Product Hallucinations: The model would confidently suggest products Clickmothercare did not carry, frustrating users when they attempted to purchase them.
  • Context Loss During Handoffs: Transferring state between specialized agents (such as greeting, inventory lookup, and checkout) frequently lost conversation history, forcing customers to repeat themselves.
  • Silent Cart Failures: Network timeouts between the model API and the database caused cart updates to occasionally fail without reporting an error, leading the bot to lose track of selected items.

Re-Architecting for Reliability with n8n and Kubernetes

To address these challenges, I replaced the initial monolithic script architecture with an asynchronous, event-driven backend utilizing n8n deployed on Kubernetes.

Here is how we resolved each issue:

  • Strict Inventory Checks: Instead of allowing the model to answer queries from memory, we restricted it to strictly typed tool calls against a Redis-cached inventory database.
  • Centralized State Management: We transferred conversation state out of individual agent prompts and stored it in a PostgreSQL cluster, ensuring context remained intact during agent transitions.
  • Message Queues and Retries: We introduced message queues configured with exponential backoff to handle transient network drops, guaranteeing that database writes and cart updates execute reliably.

Akua currently handles thousands of WhatsApp messages daily without losing context or recommending out-of-stock items.