Railway

Deploy WAHA + n8n — Self-Hosted WhatsApp Automation

Self-host WhatsApp automation — WAHA + n8n, nodes persist

Deploy WAHA + n8n — Self-Hosted WhatsApp Automation

Just deployed

/var/lib/postgresql/data

Just deployed

Deploy and Host WAHA + n8n on Railway

WAHA + n8n is a complete, self-hosted WhatsApp automation backend: WAHA provides the WhatsApp HTTP API (send and receive messages, manage sessions), and n8n orchestrates the workflows — connecting WhatsApp events to APIs, databases, CRMs, and AI tools through a visual, no-code editor. This template ships both pre-wired, with the WAHA node auto-installed in n8n, the two services connected over the private network, and persistent volumes so your custom nodes and workflows survive redeploys.


What This Template Deploys

ServicePurpose
WAHAThe WhatsApp HTTP API — sessions, sending, and incoming-message webhooks
n8nThe visual workflow engine — logic, integrations, and the WAHA node
PostgreSQLOptional persistence for n8n workflows and execution history

WAHA and n8n talk over Railway's private network, and volumes persist WAHA's session and n8n's custom nodes and data, so nothing is lost on redeploy.


About Hosting

The value of a WAHA + n8n bundle is in the wiring — the parts a manual setup gets wrong are all handled here.

Custom nodes and workflows persist across redeploys. n8n stores its custom/community nodes and workflow data on disk, and without a volume they're wiped on every redeploy — the auto-installed WAHA node and your flows vanish. This template mounts volumes for both services, so the WAHA node, your workflows, and WAHA's WhatsApp session survive deployments. This is the "persistent nodes" difference.

The services connect privately — not via localhost. The single most common WAHA + n8n mistake: n8n cannot reach WAHA at http://localhost:3000, because inside the n8n container "localhost" is n8n itself, not WAHA. The two must talk over the internal network by service name. This template wires that automatically, so the connection works out of the box instead of failing with a confusing "connection refused."

Use the NOWEB engine to stay light. WAHA's WEBJS engine runs a full headless Chromium and is memory-hungry; the NOWEB engine (WHATSAPP_DEFAULT_ENGINE=NOWEB) does the same job with far less RAM. This template defaults to NOWEB so the stack runs comfortably on a small Railway instance.

Incoming messages flow into n8n via webhook. WHATSAPP_HOOK_URL points at your n8n webhook and WHATSAPP_HOOK_EVENTS=message forwards messages, so a workflow triggers the moment someone messages you. Replies go back out through WAHA's API, all in one flow.

Secure it. WAHA_API_KEY protects WAHA's endpoints, WAHA_DASHBOARD_USERNAME/PASSWORD guard its dashboard, and WAHA_PUBLIC_URL is your Railway domain. Keep N8N_ENCRYPTION_KEY stable, or n8n can't decrypt saved credentials.

Respect WhatsApp's limits — it's an unofficial API. WAHA connects through a WhatsApp Web session, not Meta's Cloud API. Use a dedicated number (not your personal one), warm it up, and keep outbound modest — well under ~20 messages/minute for a fresh number, pacing with n8n Wait nodes. For regulated or high-volume messaging, use the official Cloud API.

Typical cost: ~$5–15/month on Railway for WAHA, n8n, and optional Postgres. Both are free and open source.


How It Compares

WAHA + n8n (self-hosted)Twilio + ZapierWhatsApp Cloud APIManual coding
Cost modelFlat infraPer message + per taskPer conversationDev time
No-code workflowsYes (n8n)Yes (Zapier)NoNo
Data ownershipFull — your infraVendorMetaFull
SetupOne click, pre-wiredMulti-vendorApproval neededBuild it all
Self-hostableYesNoNoYes

Twilio plus Zapier works but bills per message and per task, and your data lives across vendors. The official Cloud API is compliant but needs Meta business approval and bills per conversation. WAHA + n8n gives you the whole automation backend — WhatsApp gateway plus a visual workflow engine — pre-wired and self-hosted, at flat cost with your data on infrastructure you own.


Deploy in Under 5 Minutes

  1. Click Deploy on Railway — WAHA and n8n build, wire together, and the WAHA node installs (~4 minutes)
  2. Set WAHA_API_KEY, the dashboard credentials, and confirm WAHA_PUBLIC_URL is your domain
  3. Open WAHA's /dashboard, connect with your API key, and scan the QR code with your WhatsApp
  4. Open n8n, confirm the WAHA node is available, and build a workflow
  5. Point WHATSAPP_HOOK_URL at your n8n webhook to trigger flows on incoming messages

Use a dedicated WhatsApp number, and pace outbound messages to stay within safe limits.


Common Use Cases

  • WhatsApp chatbots — trigger an n8n workflow on each incoming message and reply through WAHA
  • Customer support automation — route, tag, and auto-respond to WhatsApp messages via workflows
  • Notifications and alerts — send order updates, reminders, and alerts from any n8n trigger
  • AI-powered replies — pipe messages through an LLM node and respond intelligently over WhatsApp

Configuration

VariableRequiredDescription
WAHA_API_KEYRequiredProtects WAHA's API endpoints — set a strong random value
WAHA_DASHBOARD_USERNAME / _PASSWORDRequiredGuard the WAHA dashboard
WAHA_PUBLIC_URLRequiredYour Railway public domain for WAHA
WHATSAPP_DEFAULT_ENGINEPre-setNOWEB — low-memory engine, best for Railway
WHATSAPP_HOOK_URLRecommendedYour n8n webhook URL for incoming messages
WHATSAPP_HOOK_EVENTSRecommendedmessage to forward incoming messages
N8N_ENCRYPTION_KEYRequiredEncrypts n8n credentials — keep stable across redeploys

Nodes persist, and services connect privately. Volumes keep the WAHA node, your workflows, and WhatsApp session across redeploys. n8n reaches WAHA over the private network by service name — never localhost:3000, which is the top WAHA + n8n bug.

Secure it and respect WhatsApp's limits. Set WAHA_API_KEY and dashboard credentials, keep N8N_ENCRYPTION_KEY stable, use a dedicated number, and pace sends — WAHA is an unofficial WhatsApp Web API.


Dependencies for WAHA + n8n Hosting

  • Railway account — ~$5–15/month for WAHA, n8n, and optional Postgres
  • A dedicated WhatsApp number (not your personal account) to connect via QR
  • A persistent volume for each service (included and mounted)
  • Optional: PostgreSQL for durable n8n workflow and execution storage

Deployment Dependencies

Implementation Details

The template runs WAHA (devlikeapro/waha) and n8n as two services on Railway's private network, with the WAHA community node auto-installed in n8n so it's available in the editor immediately. Because the WAHA node and n8n's workflow data are stored on disk, both services mount persistent volumes so the node, workflows, execution history, and WAHA's WhatsApp session survive redeploys — the "persistent nodes" behavior in the template name.

Critically, n8n connects to WAHA over the internal network by service name rather than localhost, since inside the n8n container localhost resolves to n8n itself — the most common failure in manual setups. WAHA defaults to the NOWEB engine to minimize memory versus Chromium-based WEBJS, secured with WAHA_API_KEY and dashboard credentials, with WAHA_PUBLIC_URL set to the Railway domain. Incoming messages reach n8n through WHATSAPP_HOOK_URL with WHATSAPP_HOOK_EVENTS=message, and N8N_ENCRYPTION_KEY must stay stable so saved credentials remain decryptable. WAHA uses an unofficial WhatsApp Web session, so a dedicated number, warm-up, and modest rates apply. Optional PostgreSQL provides durable n8n persistence; the volumes are the components to back up.


Frequently Asked Questions

Why won't n8n connect to WAHA? Almost always because it's pointed at http://localhost:3000 — but inside the n8n container "localhost" is n8n, not WAHA. They must connect over the private network by service name, which this template wires automatically.

Do my workflows and the WAHA node survive redeploys? Yes — that's the "persistent nodes" point. Both services use volumes, so the auto-installed WAHA node, your workflows, execution history, and the WhatsApp session persist across deployments.

How do incoming messages reach my workflow? WAHA forwards them to n8n by webhook — WHATSAPP_HOOK_URL points at your n8n webhook and WHATSAPP_HOOK_EVENTS=message sends message events, triggering a flow the moment someone messages you.

How do I avoid getting my number banned? Use a dedicated number (never your personal one), warm it up gradually, and keep outbound under about 20 messages per minute for a fresh number, pacing sends with n8n Wait nodes.

Can I connect it to AI or a CRM? Yes — that's n8n's strength. Route WhatsApp messages through an LLM node for smart replies, or into CRM, database, and API nodes, all in one workflow.


Why Deploy WAHA + n8n on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying WAHA + n8n on Railway you get a complete WhatsApp automation backend with the wiring solved — the WAHA node pre-installed, both services connected privately, the low-memory engine set, and volumes so your nodes and workflows persist. Visual WhatsApp automation, self-hosted on infrastructure you own.


Template Content

More templates in this category

View Template
Telegram JavaScript Bot
A template for Telegram bot in JavaScript using grammY

Agampreet Singh
294
View Template
Cobalt Tools [Updated Aug ’26]
Cobalt Tools [Aug ’26] (Media Downloader, Converter & Automation) Self Host

shinyduo
257
View Template
Telegram Gateway
Multi-bot Telegram webhook gateway with real-time WebSocket event streaming

INAPP
4