Hey everyone ![]()
I put together a free, importable n8n workflow for a common SMB need: a basic WhatsApp customer-service AI agent on the official WhatsApp Cloud API (no third-party WhatsApp SaaS), with OpenAI, short-term memory per phone number, and a simple human handoff.
Sharing it here as a technical showcase. Happy to take questions / edge cases.
What it does
- WhatsApp Trigger receives inbound Cloud API payloads.
- An IF filter drops delivery/read receipts, non-text messages, and messages from your own number (anti-loop — this is the #1 way beginner WhatsApp bots burn API credits).
- If the customer writes
HUMANO, the workflow replies that a person will follow up and leaves a NoOp hook (Avisar al equipo) where you can plug Email / Telegram / Slack. - Otherwise an AI Agent (OpenAI Chat Model + Window Buffer Memory keyed by phone number) replies using a fill-in-the-blanks system prompt for business info, then sends the answer back with a WhatsApp node (trimmed to stay under WhatsApp’s length limit).
Rough flow:
WhatsApp Trigger
→ IF: text from a real customer? (anti-loop)
→ no → NoOp (ignore)
→ yes → IF: asks for HUMANO?
→ yes → WhatsApp reply + team-alert hook
→ no → SplitInBatches (one message at a time)
→ AI Agent + OpenAI + Memory(phone)
→ WhatsApp reply
Nodes (11)
WhatsApp Trigger¿Mensaje de texto de un cliente? (anti-bucle)(IF)Ignorar (estados, propios, no-texto)(NoOp)¿Pide un HUMANO?(IF)Responder: derivado a humano(WhatsApp)Avisar al equipo (conecta aquí Email/Telegram/Slack)(NoOp hook)Uno a uno (memoria aislada por cliente)(SplitInBatches)Agente IA(LangChain Agent)OpenAI Chat ModelMemoria por teléfono(Window Buffer, last 10 messages)Responder por WhatsApp
Requirements (honest)
- n8n Cloud or self-hosted, reachable over HTTPS (WhatsApp must hit your webhook).
- A Meta for Developers Business app with the WhatsApp product. Meta provides a free test number.
- An OpenAI API key with credit (pay-as-you-go; each reply is usually cents or less depending on model).
- Time: ~60–90 minutes for a first working test if Meta + n8n credentials are new to you.
This is not a hosted / done-for-you bot. You run it in your own n8n and pay Meta/OpenAI for what you use.
Testing status (please read)
- Imports cleanly into n8n 2.43.x (tested 2.43.4).
- Anti-loop, handoff branch, and per-phone memory were exercised with simulated WhatsApp payloads and a simulated model.
- Not yet tested end-to-end against a live WhatsApp Business number or live OpenAI. Please test with your own number before putting customers on it.
Known limitations (by design in this free basic version)
- Window Buffer memory lives in n8n RAM → wiped on restart and not suitable for queue mode. For production, move memory to Postgres/Redis.
- After
HUMANO, the bot still answers if the customer writes again (no persistent “paused” flag yet). Wire the team-alert NoOp and/or add a stored handoff state for a real pause. - One webhook per Meta WhatsApp app — switching test vs production URL will break the other (n8n/Meta behaviour).
- Outside Meta’s 24-hour customer-care window you can only send approved message templates.
How to get the files
Free pack (JSON workflow + ES/EN PDF guide + system prompt): leave your email on the download form (double opt-in) here:
If you’d rather have a scrubbed JSON pasted in this thread, say so and I’ll drop a credential-free export in a code block.
Discussion
Curious how others handle:
- Persistent memory for WhatsApp agents without Redis/Postgres overhead on small instances?
- A clean “bot paused while human is in” pattern that survives workflow restarts?
- Filtering noisy Cloud API status webhooks beyond the built-in trigger options?
Feedback and failure reports welcome — especially from anyone who runs this against a real Meta test number.