DEV Community

אחיה כהן
אחיה כהן

Posted on • Originally published at achiya-automation.com

How I Built a WhatsApp Business Automation System with n8n (Self-Hosted)

After building 50+ automation projects for small businesses, I want to share the architecture I use most often: n8n + WhatsApp + CRM — all self-hosted, no vendor lock-in.

Why n8n?

I've used Make.com, Zapier, and n8n extensively. Here's why n8n wins for serious projects:

  • Self-hosted — Your data stays on your server
  • No per-execution pricing — Run millions of workflows for $0/month
  • Queue Mode — Handle high volumes without dropping messages
  • Full control — Custom nodes, JavaScript/Python code, no limits

The Architecture

┌─────────────┐     ┌──────────────┐     ┌──────────┐
│  WhatsApp    │────▶│   n8n        │────▶│   CRM    │
│  (WAHA API)  │◀────│  (Queue Mode)│◀────│ (Monday) │
└─────────────┘     └──────────────┘     └──────────┘
       │                    │                    │
       │              ┌─────┴──────┐            │
       │              │  PostgreSQL │            │
       │              │  + Redis    │            │
       │              └────────────┘            │
       │                                        │
       └────────── Google Calendar ◀────────────┘
Enter fullscreen mode Exit fullscreen mode

Key Components

1. WhatsApp Integration

I use WAHA (WhatsApp HTTP API) — a self-hosted solution. Important note: WAHA uses an unofficial WhatsApp connection, not the official Meta Business API. This works great for reactive bots (responding to incoming messages) but is NOT suitable for mass marketing/broadcasting.

// Webhook receives incoming messages
// n8n processes them through workflow
{
  "event": "message",
  "payload": {
    "from": "972501234567@c.us",
    "body": "Hello",
    "timestamp": 1710000000
  }
}
Enter fullscreen mode Exit fullscreen mode

2. n8n Queue Mode

For production, always use Queue Mode. It separates the webhook receiver from the workflow executor:

# docker-compose.yml (simplified)
services:
  n8n-main:
    image: n8n-custom  # Built with queue mode
    environment:
      - EXECUTIONS_MODE=queue
      - QUEUE_BULL_REDIS_HOST=redis

  n8n-worker:
    image: n8n-custom
    command: worker
    environment:
      - EXECUTIONS_MODE=queue

  redis:
    image: redis:7-alpine

  postgres:
    image: postgres:16
Enter fullscreen mode Exit fullscreen mode

3. Common Workflow Patterns

Lead Response Bot:

  1. Customer sends message → n8n webhook triggers
  2. Check if customer exists in CRM
  3. If new → Create contact + send welcome message
  4. If existing → Retrieve history + route to relevant flow
  5. Log everything in CRM

Appointment Scheduling:

  1. Customer requests appointment
  2. n8n checks Google Calendar availability
  3. Present available slots via WhatsApp buttons
  4. Customer selects → n8n creates calendar event
  5. Send confirmation + set reminder triggers

Follow-up Sequences:

  1. Lead enters pipeline → n8n starts sequence
  2. Day 1: Welcome + relevant info
  3. Day 3: Value content (article, case study)
  4. Day 7: Check-in message
  5. If replied at any point → Exit sequence, notify sales

What I Learned from 50+ Projects

  1. Always use Queue Mode in production — Regular mode drops webhooks under load
  2. PostgreSQL > SQLite — SQLite locks under concurrent workflows
  3. Keep execution history — 7 days minimum for debugging
  4. Error handling is 80% of the work — APIs fail, messages timeout, edge cases multiply
  5. Start simple — A basic bot that works > a complex bot that breaks

Results

For a typical small business client:

  • 10-15 hours/week saved on manual tasks
  • 40-60% fewer appointment no-shows (automated reminders)
  • Zero missed leads (24/7 automated response)
  • ROI within 1-2 months

Resources


I'm Achiya, a business automation specialist in Israel. I help small businesses save time with WhatsApp bots and workflow automation. More at achiya-automation.com.

Top comments (0)