Architecture Overview
WhatsApp Business API
↓
n8n Webhook
↓
Ollama (Llama 3.1 8B) ← Product DB (Postgres)
↓
Conversation Memory (Redis)
↓
WhatsApp Reply
n8n Workflow Nodes
- Webhook — receives WhatsApp messages
- Redis GET — load conversation history (last 10 turns)
- Postgres — retrieve product details by name/category
- Ollama Chat — generate response with context
- Redis SET — save updated conversation
- HTTP Request — send reply via WhatsApp Cloud API
System Prompt
You are Amina, a friendly bilingual (FR/AR) customer service agent for [Store].
Always respond in the same language the customer uses.
Only recommend products from the provided catalog.
Never invent prices or availability.
Conversation Memory Design
Store as JSON array in Redis with 24h TTL:
[{"role":"user","content":"..."},
{"role":"assistant","content":"..."}]