
Deploy n8n + Evolution API — WhatsApp Automation Stack on Railway
WhatsApp automation with n8n + Evolution API. No per-message fees.
Just deployed
/var/lib/postgresql/data
Redis
Just deployed
/data
n8n
Just deployed
/data
Evolution API
Just deployed
/evolution/instances
Deploy and Host n8n + Evolution API — WhatsApp Automation Stack on Railway
The complete self-hosted stack for WhatsApp workflow automation: Evolution API as the WhatsApp gateway, n8n as the visual workflow engine, and PostgreSQL as the persistent data layer — all pre-wired on Railway's private network with one-click deployment.
Connect a WhatsApp account via QR code, design automation flows in n8n, and handle real-time WhatsApp events via webhook — no Meta Business API approval, no per-message billing, fully self-hosted on Railway for ~$10–15/month flat.
What This Template Deploys
| Service | Purpose |
|---|---|
| n8n | Visual workflow automation engine — drag-and-drop workflow builder, 500+ integrations, AI nodes, and webhook trigger handling on port 5678 |
| Evolution API | WhatsApp REST gateway — QR-code account connection, message sending/receiving, instance management, and webhook delivery to n8n on port 8080 |
| PostgreSQL 16 | Shared persistent database — stores n8n workflows, credentials, execution history, and Evolution API session state |
All three services connect over Railway's private internal network. Credentials are injected automatically via reference variables — no manual connection string setup required.
About Hosting n8n + Evolution API
Running a production WhatsApp automation stack requires three coordinated services: Evolution API for the WhatsApp connection, n8n for workflow logic, and a PostgreSQL database shared between them — all behind HTTPS with proper webhook routing between services.
Without a managed host, you're configuring Docker Compose, inter-service networking, SSL, and environment variable coordination across three containers manually. Railway provisions all of it automatically — private networking, shared credentials, and HTTPS endpoints for both n8n and Evolution API.
Typical cost: ~$10–15/month on Railway's Hobby plan for the three-service stack. Compare to WATI (managed WhatsApp + automation) at $49/month, or Twilio WhatsApp at $0.005–$0.085 per message combined with n8n Cloud at $20/month with execution caps. This stack gives you unlimited WhatsApp messaging and unlimited n8n executions at flat compute pricing.
Deploy in Under 5 Minutes
- Click Deploy on Railway — all three services build automatically (~4–5 minutes)
- Set
AUTHENTICATION_API_KEY,SERVER_URL(Evolution API domain), andWEBHOOK_URL(n8n domain) in the Variables tab - Mount a Railway volume at
/evolution/instanceson the Evolution API service - Open your n8n URL — create your admin account and install the
n8n-nodes-evolution-apicommunity node from Settings → Community Nodes - Open
[evolution-domain]/manager, create a WhatsApp instance, and scan the QR code - Build your first WhatsApp automation workflow in n8n
No SSH. No Docker Compose. No manual networking.
Common Use Cases
- Self-hosted WhatsApp automation without Meta Business API — connect any WhatsApp account via QR code and trigger n8n workflows from incoming messages without Meta Business Manager verification, API application, or per-message billing
- WhatsApp customer support automation — triage messages, respond to FAQs, create CRM records, and escalate to agents via Slack or Chatwoot — all triggered by Evolution API webhooks
- Self-hosted alternative to WATI and Twilio WhatsApp — replace $49–$99/month managed platforms with a flat ~$10–15/month stack; unlimited messages, no per-message fees
- AI-powered WhatsApp chatbot — chain Evolution API webhook triggers into n8n AI nodes (Claude, GPT-4o, Gemini) to build intelligent WhatsApp bots that understand context and respond conversationally
- WhatsApp lead capture and CRM automation — capture inbound leads, enrich via n8n, and push to HubSpot, Airtable, Notion, or any CRM using n8n's 500+ integrations
- Multi-account WhatsApp notifications — manage multiple Evolution API instances; trigger personalised order updates, payment confirmations, and reminders at scale with no per-message billing
Configuration
| Variable | Required | Description |
|---|---|---|
AUTHENTICATION_API_KEY | ✅ Required | Evolution API master key — authenticates all REST calls to the WhatsApp gateway |
SERVER_URL | ✅ Required | Your Railway Evolution API public URL — required for QR code generation and webhook delivery |
DATABASE_URL | ✅ Auto-injected | PostgreSQL connection string — shared between n8n and Evolution API via Railway reference variable |
WEBHOOK_URL | ✅ Required | Your Railway n8n public URL — Evolution API sends message events here to trigger workflows |
N8N_ENCRYPTION_KEY | ✅ Required | 32-char random string — encrypts all n8n credentials in PostgreSQL |
N8N_BASIC_AUTH_ACTIVE | Recommended | Set to true — protects the n8n editor from public access |
N8N_BASIC_AUTH_USER | Recommended | Username for n8n basic auth |
N8N_BASIC_AUTH_PASSWORD | Recommended | Password for n8n basic auth — use a strong value |
DATABASE_PROVIDER | Pre-set | postgresql — connects Evolution API to the shared Railway PostgreSQL |
CACHE_REDIS_URI | Optional | Add a Railway Redis service and set this for Evolution API session caching at scale |
Volume required: Mount a Railway volume at
/evolution/instanceson the Evolution API service. Without it, WhatsApp authentication is lost on every redeploy and users must re-scan the QR code each time.
n8n + Evolution API vs. Managed WhatsApp Automation Platforms
| This Stack (Railway) | WATI | Twilio + n8n Cloud | MessageBird | |
|---|---|---|---|---|
| Monthly cost | ~$10–15 flat | $49/month | $20+ (n8n) + per msg | $25+ per msg |
| Per-message fees | ✅ None | ❌ Yes | ❌ Twilio charges per msg | ❌ Yes |
| n8n execution caps | ✅ Unlimited | N/A | ❌ 10,000/month | N/A |
| Meta Business approval | ✅ Not required | ✅ Required | ✅ Required | ✅ Required |
| Data ownership | ✅ Your infrastructure | ❌ WATI servers | ❌ Split across vendors | ❌ MessageBird servers |
| Multi-account WhatsApp | ✅ Multiple instances | ❌ One number/plan | ❌ One number | ❌ One number |
| Self-hostable | ✅ Yes | ❌ No | ❌ No | ❌ No |
| AI/LLM workflow nodes | ✅ Native n8n AI nodes | ❌ No | ⚠️ n8n Cloud only | ❌ No |
Dependencies for n8n + Evolution API Hosting
- Railway account — Hobby plan (~$10–15/month) covers all three services
- A WhatsApp account (personal or business) for QR code connection
Deployment Dependencies
Implementation Details
Both n8n and Evolution API share a PostgreSQL 16 instance over Railway's private network.
n8n stores workflows, credentials, and execution history; Evolution API stores WhatsApp
instance metadata. Evolution API delivers webhook events (messages, QR, status) to n8n's
WEBHOOK_URL in real time — use a Webhook trigger node in n8n to receive them. Install
n8n-nodes-evolution-api from n8n Settings → Community Nodes for native send/receive
actions. Mount a volume at /evolution/instances on Evolution API — sessions are lost
without it.
Frequently Asked Questions
Do I need Meta Business API approval to use this stack? No. Evolution API connects via Baileys using a standard personal or business WhatsApp account — QR scan only. No Meta Business Manager, business verification, or WhatsApp API application required. Note: using unofficial WhatsApp integrations carries account ban risk — avoid bulk unsolicited messages and implement rate limiting.
How do I connect n8n to Evolution API for WhatsApp triggers?
Set WEBHOOK_URL to your n8n Railway domain. Create a Webhook trigger node in n8n. In the
Evolution API Manager, set each instance webhook to your n8n webhook path. Install
n8n-nodes-evolution-api from n8n Settings → Community Nodes for pre-built action nodes.
How much does this stack cost vs WATI or Twilio? This stack runs at ~$10–15/month on Railway's Hobby plan — flat, with unlimited WhatsApp messages and unlimited n8n workflow executions. WATI starts at $49/month with per-message charges above plan limits. Twilio WhatsApp charges $0.005–$0.085 per message on top of n8n Cloud's $20/month with 10,000 execution caps.
Do I lose my WhatsApp sessions and n8n workflows on redeploy?
n8n workflows and credentials are stored in PostgreSQL — they survive all redeploys. WhatsApp
sessions persist only if the /evolution/instances volume is mounted on the Evolution API
service. With the volume in place, instances reconnect automatically after restarts.
Can I run multiple WhatsApp accounts? Yes. Evolution API supports multiple instances per deployment, each with its own QR-connected WhatsApp account. Create and manage instances via the Manager dashboard. n8n routes workflows by instance ID.
Can I add AI to my WhatsApp workflows? Yes. n8n has native AI nodes for Claude, GPT-4o, Gemini, and LangChain. Connect an Evolution API webhook trigger to an AI node to build a WhatsApp chatbot with natural language responses.
Why Deploy n8n + Evolution API 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 this stack on Railway, you get a complete WhatsApp automation platform — Evolution API for messaging, n8n for workflow logic, PostgreSQL for persistence — at ~$10–15/month flat with no per-message fees, no execution caps, and full data ownership.
Template Content