Per-customer persistent memory, Shopify order lookup, and returns handling — all via WhatsApp

The Problem

Three staff members handling 60–80 WhatsApp messages each daily — 70% identical questions about orders, returns, and shipping. Previous chatbot demos were rejected because the bot forgot context between messages, forcing customers to repeat themselves every reply. The business needed real per-customer memory, not session-scoped amnesia.

The Solution

WhatsApp Business API webhook triggers n8n on every incoming message. The AI Agent retrieves the customer's conversation history from Postgres keyed by phone number — memory that persists across days, not just within one session. Three tools: a Vector Store Retriever grounded in store policy documents (from P4), a Shopify order status lookup via HTTP, and a returns intake tool that logs to Postgres. Every response is generated and dispatched back to WhatsApp via HTTP within the platform's 15-second response window. Each customer's memory is completely isolated — no cross-contamination between sessions.

Key Engineering

Result

→ 3 staff salaries worth of repetitive WhatsApp support automated. Agent maintains full conversation context across multi-day threads. Order status and returns handled without human involvement. All responses delivered within WhatsApp's timing requirements.

Tech Stack

WhatsApp Business API, n8n AI Agent, Postgres Memory (Per-user), Vector Store Retriever, Shopify API, HTTP Request, Supabase, pgvector

NOTE WhatsApp Trigger node replaces Chat Trigger; session key becomes the customer's phone number instead of the auto-generated sessionId.

n8n P13 img 1.png

n8n P13 img 2.png

n8n P13 img 3.png

n8n P13 img 4.png

n8n P13 img 5.png