Deploy Evolution
Evolution API : WhatsApp Cloud API, n8n and signed Meta webhooks (2.3.8).
Evolution
Just deployed
/evolution/instances
Gateway
Just deployed
Just deployed
/var/lib/postgresql/data
Redis
Just deployed
/bitnami
Deploy and Host Evolution API on Railway
Evolution API Pro Stack for the official WhatsApp Business Cloud API. It includes a signed Meta webhook gateway, native Railway PostgreSQL and Redis, and an optional authenticated destination for n8n. Deploy the infrastructure first and connect your Meta business account when you are ready.
About Hosting Evolution API
The template deploys four services and gives you a single HTTPS URL for API requests and Meta callbacks.
| Service | Purpose |
|---|---|
| Gateway | The only public HTTPS service. It accepts the official Meta callback and checks its signature. REST calls require the generated API key. |
| Evolution | The official, pinned Evolution API 2.3.8 image. The API is reachable by the gateway over Railway's private network. |
| PostgreSQL | Railway PostgreSQL with a persistent volume for instance and application records. |
| Redis | Railway Redis with a persistent volume for caching. |
Why Deploy Evolution API on Railway
- Accepts the official Meta Graph API and checks the HMAC of the raw callback body before forwarding it.
- Handles bundled message notifications one change at a time for Evolution, preserving the correct WhatsApp phone number ID.
- Keeps PostgreSQL, Redis and the upstream Evolution API on the private network. The Gateway serves the official WhatsApp Cloud API routes.
- Stores instance records in PostgreSQL and checks access to the Evolution instance API before reporting readiness.
Common Use Cases
- Receive messages and delivery updates for an opted-in customer-support inbox.
- Route verified WhatsApp events to an n8n workflow for processing.
- Send approved WhatsApp message templates for transactional notifications.
Dependencies for Evolution API Hosting
Deployment Dependencies
Railway provisions the Gateway, Evolution API 2.3.8, PostgreSQL and Redis. A Meta app, a WhatsApp Business Account, a phone number ID and a Meta access token are needed for live messaging. An active n8n workflow is optional.
Connect WhatsApp Business Cloud API
- Open the Gateway domain. Keep the gateway API key and webhook verification token in Railway.
- Prepare a Meta app and a WhatsApp Business account. In the Gateway variables set META_APP_SECRET to your Meta App Secret. In Meta use https://YOUR-GATEWAY/webhook/meta and the Gateway's META_VERIFY_TOKEN. Subscribe to the WhatsApp Business Account/messages field.
- Send a JSON request to POST /instance/create with the Gateway API key as the apikey header. Use the Meta Phone Number ID in
number, the WhatsApp Business Account ID inbusinessId, and a Meta access token intoken.
{
"instanceName": "customer-support",
"integration": "WHATSAPP-BUSINESS",
"number": "YOUR_META_PHONE_NUMBER_ID",
"businessId": "YOUR_WHATSAPP_BUSINESS_ACCOUNT_ID",
"token": "YOUR_META_ACCESS_TOKEN"
}
GET /instance/fetchInstances lists instances without returning their Meta credentials. GET /instance/connectionState/customer-support checks the instance state. Use POST /message/sendText/customer-support or POST /message/sendTemplate/customer-support for a permitted recipient, subject to Meta's messaging window, template, and consent rules. Use the Meta test number for the first end-to-end message.
Connect n8n
Create a Webhook node with Header Auth and choose the production URL of an active workflow. Set N8N_WEBHOOK_URL on the Gateway and use the Gateway's generated N8N_WEBHOOK_KEY as the value of the X-Evolution-Webhook-Key header in n8n. The gateway forwards verified WhatsApp JSON events. Have n8n acknowledge quickly and deduplicate messages by their Meta message ID. Meta may retry delivery if a destination returns an error. A private Railway address also works when the n8n service is reachable in the same environment.
Gateway variables
| Gateway variable | Purpose |
|---|---|
| AUTHENTICATION_API_KEY | Generated on the Evolution service and wired automatically. Use it as the apikey header. |
| META_APP_SECRET | Set after deploy. Until then, callback deliveries are refused. |
| META_VERIFY_TOKEN | Generated per deployment. Use it during Meta webhook verification. |
| N8N_WEBHOOK_URL | Optional production webhook for forwarding verified Meta callbacks. |
| N8N_WEBHOOK_KEY | Generated per deployment. Use it for n8n Header Auth. |
Meta business credentials and a WhatsApp Business number are needed for live sending. WhatsApp Web QR pairing is outside this template's scope. Usage on Railway and any charges from Meta are separate.
Template Content