DEV Community

Waqas Ahmed Waseer
Waqas Ahmed Waseer

Posted on AI-assisted

Build a WhatsApp chatbot with n8n + WaSphere (self-hosted, no Meta approval)

Want a WhatsApp chatbot without going through Meta's business verification, template approvals, and per-conversation pricing? Combine n8n (the open-source workflow automation tool) with WaSphere — an open-source (MIT), self-hosted WhatsApp API — and you get a fully self-hosted chatbot stack on your own server.

The architecture

  • WaSphere connects to WhatsApp (scan a QR code once) and exposes a local REST API plus HMAC-signed webhooks.
  • n8n receives inbound messages via a Webhook trigger, runs your bot logic, and calls WaSphere's API to send replies.

No Meta approval, no per-message platform fees, and your conversation data never leaves your infrastructure.

1. Deploy WaSphere

Any VPS with Docker works. This is the actual quick start from the GitHub repo:

git clone https://github.com/wasphere/wasphere.git
cd wasphere
cp .env.example .env
docker compose up -d
Enter fullscreen mode Exit fullscreen mode

Then open the dashboard at http://your-server:3004, register your first admin account, set the WA Server URL to http://wa-server:3001 (plus your WA_TOKEN) under Settings, and pair your number under Sessions by scanning the QR code.

2. Create the n8n webhook trigger

In n8n, add a Webhook node — this gives you a URL like https://your-n8n/webhook/whatsapp-in. In WaSphere, point your webhook settings at that URL. Every inbound message and status event now arrives in n8n as JSON, signed with:

X-WaSphere-Signature: v1,sha256=<hmac>
X-WaSphere-Timestamp: <unix-seconds>
Enter fullscreen mode Exit fullscreen mode

The signature is the HMAC-SHA256 of {timestamp}.{rawBody} with your webhook secret — verify it in a Function/Code node before trusting the payload.

3. Add your bot logic

Route on the message text with a Switch node, look up answers in a database or an LLM call, then send the reply.

4. Send replies through WaSphere

Add an HTTP Request node:

  • Method: POST
  • URL: your WaSphere workspace send endpoint (the interactive API reference at /docs/wa-server on your own instance documents every route)
  • Header: Authorization: Bearer wsk_… (your WaSphere API key)

WaSphere supports 14 message types — text, image, video, audio, documents, stickers, location, contact, polls, buttons and lists, reactions — so your bot isn't limited to plain text.

Why this beats the Meta Cloud API route

  • No Meta approval — pair a number and start building
  • Free WhatsApp API — your only cost is the VPS
  • Multi-session — several numbers from one WaSphere deployment, one n8n workflow each
  • Realtime team inbox — when the bot can't answer, a human takes over in WaSphere's dashboard
  • Open source — both n8n and WaSphere are auditable and self-hostable

Try it

If you've been putting off WhatsApp automation because of the Meta approval maze, this is the shortcut: a self-hosted WhatsApp API plus n8n, deployed before your coffee cools.

Top comments (0)