---
title: "Deploy n8n + Evolution API (WhatsApp Automation Stack)"
description: "Automate WhatsApp with n8n + Evolution API. Self-hosted, no Meta approval."
category: "Automation"
url: https://railway.com/deploy/n8n-whatsapp-automation
---

# Deploy n8n + Evolution API (WhatsApp Automation Stack)

Automate WhatsApp with n8n + Evolution API. Self-hosted, no Meta approval.

**[Deploy n8n + Evolution API (WhatsApp Automation Stack) on Railway](https://railway.com/template/n8n-whatsapp-automation)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/n8n-whatsapp-automation/manifest.json

- **Creator:** blueorange
- **Category:** Automation

## Template content

### n8n https://devicons.railway.com/i/n8n.svg

- **Image:** n8nio/n8n
- **Public domain:** Yes

### Redis https://cdn.sanity.io/images/sy1jschh/production/0ce0bfdcfbdbf69662b1116671f97c2dd788b655-157x157.svg

- **Image:** redis:8.2.1
- **Start command:** `/bin/sh -c "rm -rf $RAILWAY_VOLUME_MOUNT_PATH/lost+found/ && exec docker-entrypoint.sh redis-server --requirepass $REDIS_PASSWORD --save 60 1 --dir $RAILWAY_VOLUME_MOUNT_PATH"`

### Evolution API https://doc.evolution-api.com/mintlify-assets/_mintlify/favicons/evolution-74046672/oxfWs8SGvBbKOXUq/_generated/favicon/favicon.ico

- **Image:** evoapicloud/evolution-api
- **Public domain:** Yes

### Postgres https://devicons.railway.app/i/postgresql.svg

- **Image:** ghcr.io/railwayapp-templates/postgres-ssl:18

## Documentation

# Deploy and Host n8n with Evolution API on Railway

![Evolution API, the open-source WhatsApp API](https://raw.githubusercontent.com/evolution-foundation/evolution-api/main/public/images/cover.png)

This template pairs **n8n**, the workflow automation platform with **208,000+ GitHub stars**, with **Evolution API**, the self-hosted WhatsApp API with nearly 10,000 stars. The result is a complete WhatsApp automation stack on Railway: connect a number by scanning a QR code, then build chatbots, auto-replies, AI agents and notifications in n8n's visual editor. There's no Meta Business verification, and no per-message fee like Twilio's $0.005 plus Meta charges. Both apps, Postgres and Redis run for about $8–15/month in total.

---

## What This Template Deploys

| Service | Purpose |
|---|---|
| **n8n** | The n8n editor and workflow engine on port `5678` with a public HTTPS domain. Build WhatsApp flows and receive webhooks here. |
| **Evolution API** | The WhatsApp REST API on port `8080` with a public domain and a built-in manager UI. It connects numbers through WhatsApp's linked-devices QR code. |
| **Postgres** | Postgres 18 storing n8n workflows and credentials, plus Evolution instances, contacts and messages. |
| **Redis** | Cache for Evolution API sessions and message data. |
| **Persistent Volumes** | `/evolution/instances` on Evolution API for instance files, `/data` on n8n, and volumes on Postgres and Redis. |

All four services are wired together on Railway's private network. Evolution API's global API key and n8n's encryption key are generated at deploy time, and Evolution's built-in n8n integration is switched on.

---

## About Hosting n8n with Evolution API

The official WhatsApp Business Platform means Meta business verification, approved message templates and a fee on business-initiated conversations, usually through a provider that adds its own per-message charge. That's a lot of process for a support bot, an order notification or an internal alert.

Evolution API takes a different route: it connects to WhatsApp the same way WhatsApp Web does. You link a phone by scanning a QR code, and then send and receive messages, media, groups and statuses through a REST API. n8n then becomes the brain: incoming messages trigger workflows, and workflows call Evolution API to reply. On Railway, both apps get HTTPS domains, share one Postgres and Redis over the private network, and keep their data on volumes.

**Unofficial connection, so use it responsibly.** Evolution API uses the WhatsApp Web protocol, not Meta's official API. It's well suited to support, notifications and conversations with people who message you, but bulk unsolicited messages can get a number banned. Use a dedicated number, and warm it up before heavy use.

**Set your timezone.** `TZ` and `GENERIC_TIMEZONE` on n8n default to `Asia/Jakarta`. Change both to your own zone (for example `Europe/London`) so schedules and timestamps are right.

Typical cost: **~$8–15/month** on Railway for n8n, Evolution API, Postgres and Redis, with no per-message fees.

---

## Deploy n8n with Evolution API in Under 10 Minutes

1. Click **Deploy on Railway**. All four services start (about 3 minutes).
2. Open the n8n domain and create the owner account. Set `TZ` and `GENERIC_TIMEZONE` to your timezone.
3. Copy `AUTHENTICATION_API_KEY` from the Evolution API service, open `/manager` on its domain, and sign in with that key.
4. Create an instance, then scan the QR code with WhatsApp on your phone (**Settings, Linked devices, Link a device**).
5. In the instance's n8n or webhook settings, point incoming messages to an n8n Webhook URL, and reply from n8n with an HTTP Request node or the Evolution community node.

No Meta Business verification. No template approvals. No per-message fees.

---

## Common Use Cases

- **WhatsApp customer support bot.** Answer FAQs automatically and hand complex chats to a human.
- **AI agent on WhatsApp.** Connect n8n's AI Agent node to OpenAI, Claude or Gemini and chat through WhatsApp.
- **Order and booking notifications.** Send confirmations, reminders and delivery updates from your store or calendar.
- **Lead capture.** Save incoming WhatsApp leads to your CRM, Google Sheets or Airtable.
- **Internal alerts.** Send server, payment or form alerts to a WhatsApp group.
- **Group management.** Welcome messages, moderation and scheduled posts in WhatsApp groups.
- **Multi-number setups.** Run several WhatsApp instances from one Evolution API, each with its own workflow.

---

## Configuration

| Variable | Required | Description |
|---|---|---|
| `AUTHENTICATION_API_KEY` (Evolution API) | 🔐 Auto-generated | Global API key. Send it in the `apikey` header and use it to sign in to `/manager`. |
| `SERVER_URL` (Evolution API) | ✅ Auto-injected | Evolution API's public URL, used in webhooks and QR links. |
| `N8N_ENABLED` (Evolution API) | ✅ Set | `true`. Turns on the built-in n8n integration for instances. |
| `DATABASE_CONNECTION_URI`, `CACHE_REDIS_URI` | ✅ Auto-injected | Postgres and Redis connections for Evolution API. |
| `N8N_ENCRYPTION_KEY` (n8n) | 🔐 Auto-generated | Encrypts n8n credentials. Never change it after setup. |
| `WEBHOOK_URL`, `N8N_EDITOR_BASE_URL` (n8n) | ✅ Auto-injected | n8n's public URL for webhook and editor links. |
| `TZ`, `GENERIC_TIMEZONE` (n8n) | ✅ Set | `Asia/Jakarta` by default. Change to your timezone. |
| `EXECUTIONS_DATA_MAX_AGE` (n8n) | Optional | `336` hours (14 days) of execution history before pruning. |
| `N8N_COMMUNITY_PACKAGES_ENABLED` (n8n) | ✅ Set | `true`, so you can install the Evolution API community node. |

**Connecting n8n to Evolution API.** In n8n, create an HTTP Header Auth credential with header `apikey` and the value of `AUTHENTICATION_API_KEY`, and use the Evolution API domain as the base URL. Or install the `n8n-nodes-evolution-api` community node and enter the same URL and key.

**Receiving messages in n8n.** Create a Webhook node in n8n, copy its production URL, and set it as the instance's webhook in the Evolution manager, enabling the `MESSAGES_UPSERT` event. Every incoming WhatsApp message then starts your workflow.

---

## n8n + Evolution API on Railway vs. Alternatives

| | n8n + Evolution API on Railway | Meta WhatsApp Cloud API | Twilio WhatsApp | WATI |
|---|---|---|---|---|
| **Monthly cost** | ~$8–15 usage | Free API, paid templates | $0.005 per message plus Meta fees | Paid plans plus message fees |
| **Self-hosted** | ✅ Yes | ❌ No | ❌ No | ❌ No |
| **Per-message fees** | ✅ None | ❌ Per template | ❌ Every message | ❌ Template messages |
| **Business verification needed** | ✅ No, scan a QR code | ❌ Yes | ❌ Yes | ❌ Yes |
| **Visual workflow builder included** | ✅ n8n | ❌ No | ❌ No | ⚠️ Basic flows |
| **Official Meta API** | ⚠️ Unofficial (WhatsApp Web) | ✅ Yes | ✅ Yes | ✅ Yes |
| **License** | ⚠️ Modified Apache 2.0 and Sustainable Use | ❌ Proprietary | ❌ Proprietary | ❌ Proprietary |

---

## Dependencies for n8n with Evolution API Hosting

- Railway account. Hobby works for one or two numbers; Pro for heavier workflows.
- A phone with WhatsApp and a number you can dedicate to automation.
- Optional: an AI provider key for AI agent replies.

### Deployment Dependencies

- [Evolution API on GitHub](https://github.com/evolution-foundation/evolution-api): source and releases
- [Evolution API Documentation](https://doc.evolution-api.com): endpoints and integrations
- [n8n Documentation](https://docs.n8n.io): nodes, webhooks and AI agents
- [Railway Volumes Documentation](https://docs.railway.com/volumes): persistence

### Implementation Details

n8n runs in regular mode with Postgres for workflows and credentials. Evolution API stores instances, chats and messages in the same Postgres, with Redis as its cache. Both images track their latest releases, so pin tags once you're in production.

The n8n service also carries `EVOLUTION_API_URL` and `EVOLUTION_API_KEY`, referenced from the Evolution API service, so the URL and key you need for your n8n credential are in one place on n8n's Variables tab.

---

## Frequently Asked Questions

**What does this n8n and Evolution API template include?**
n8n for workflows, Evolution API for WhatsApp, Postgres and Redis, all connected on Railway with HTTPS and persistent storage.

**How much does it cost compared to Twilio or the official API?**
About $8–15/month on Railway with no per-message charges. Twilio charges $0.005 per WhatsApp message plus Meta's template fees, which adds up quickly at volume.

**Why is the QR code not showing or the instance disconnecting?**
Open the instance in `/manager` and reconnect to get a fresh QR code. Then scan it within a minute from **Linked devices** in WhatsApp. Keep the phone online during first sync.

**Do I lose the WhatsApp connection when Railway redeploys?**
No. Instance sessions are stored in Postgres and on the `/evolution/instances` volume, so redeploys reconnect without scanning again.

**Can I build an AI chatbot for WhatsApp with this?**
Yes. Trigger an n8n workflow from incoming messages, pass the text to the AI Agent node with your model, and send the reply back through Evolution API.

**Can my number get banned?**
It can if WhatsApp sees spam-like behaviour, because this is an unofficial connection. Reply to people who contact you, avoid bulk cold messages, and use a dedicated number.

---

## Why Deploy and Host n8n with 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 n8n with Evolution API on Railway, you get a complete WhatsApp automation stack, from QR connection to AI replies, with no per-message fees and no Meta approval process.


## Similar templates

- [N8N Main + Worker](https://railway.com/deploy/n8n-main-worker) — Deploy and Host N8N with Inactive worker.
- [Evolution API with n8n](https://railway.com/deploy/evolution-api-with-n8n) — Automate WhatsApp workflows with Evolution API, n8n, and Postgres.
- [Postgres Backup](https://railway.com/deploy/postgres-s3-backups) — Cron-based PostgreSQL backup to bucket storage

Open this page in a browser: https://railway.com/deploy/n8n-whatsapp-automation
