Deploy Automata | WhatsApp, Telegram, SQL MCP

WhatsApp, Telegram & Postgres MCP for Claude | Alt to Zapier, Composio

Deploy Automata | WhatsApp, Telegram, SQL MCP

Just deployed

Just deployed

/data

Automata MCP Telegram Bridge

ju-li/automata-mcp-telegram-bridge:latest

Just deployed

/evolution/instances

/var/lib/postgresql/data

Deploy and Host Automata | WhatsApp, Telegram, SQL MCP on Railway

Automata is a self-hosted MCP server that connects Claude, ChatGPT, Codex, Cursor and other AI assistants to your WhatsApp, Telegram and PostgreSQL. Link an account by QR code or paste a database URL, then issue connector tokens limited to specific chats, tables and tools. Teams share connections inside an organization, with roles, invitations and email alerts when a connection drops.

About Hosting Automata | WhatsApp, Telegram, SQL MCP

The template deploys five services that share one Postgres, each in its own schema:

  • Automata MCP: the dashboard and the /mcp endpoint. Runs its migrations at boot.
  • Evolution API (evolution-api-reforged) + Redis: WhatsApp.
  • Automata MCP Telegram Bridge: Telegram.
  • Postgres: app data, WhatsApp messages, Telegram sync.

Every secret is generated at deploy. Nothing is required to get WhatsApp and SQL working.

After you deploy

  1. Sign up. Open the Automata MCP service's public domain. The first account becomes the admin, and setup walks you through your first connection and token. Later sign-ups are by invitation only; to change that, set NUXT_SIGNUP_CODE (or NUXT_SIGNUP=open) on Automata MCP.
  2. Create the WhatsApp indexes. Strongly recommended. On a new deployment they take seconds; see Indexes below.
  3. Add a connection.
    • WhatsApp: scan the QR code from WhatsApp → Settings → Linked devices. The number's past conversations are imported once, at pairing. Test with a spare number, because repeated pairing can get a number banned.
    • SQL: paste a postgres:// URL. The role in that URL is the real security boundary, so use one that can only reach the tables you want Claude to see.
    • Telegram: needs API keys first (step 5).
  4. Mint a token and connect your assistant. Copy the connector URL from the token screen. In Claude: Settings → Connectors → Add custom connector. The app shows the steps for other assistants.
  5. Optional: Telegram API keys.
    1. Sign in at my.telegram.org with your phone number → API development tools → create an app (any name; platform "Other" is fine).
    2. Copy App api_id and App api_hash. (Telegram's guide)
    3. On Automata MCP Telegram Bridge → Variables, set TELEGRAM_API_ID and TELEGRAM_API_HASH. Set both or neither: the bridge won't start with only one. Railway redeploys it, and Telegram appears under Add a connection.
    4. Use your own keys. Telegram rejects pairs copied from tutorials.
    5. Back up TELEGRAM_SESSION_ENCRYPTION_KEY somewhere other than Railway. Losing or changing it unlinks every Telegram account.
  6. Optional: email. On Automata MCP set NUXT_SMTP_HOST, NUXT_SMTP_PORT, NUXT_SMTP_USERNAME, NUXT_SMTP_PASSWORD and NUXT_MAIL_FROM (an address your provider accepts). Without SMTP, disconnect alerts aren't sent and invitation links are shown for you to copy. With SMTP set, new sign-ups must verify their email.

Indexes

Evolution indexes its "Message" table by account only. A number with years of history makes reading, chat listing and search time out (the app gives up after 10 s). The app looks for these indexes every 10 minutes and uses them once they exist, with no restart needed.

Run them as the postgres user with railway connect Postgres, one statement at a time. CONCURRENTLY can't run inside a transaction, and it keeps WhatsApp writing while the index builds.

CREATE INDEX CONCURRENTLY IF NOT EXISTS message_instance_ts_idx
  ON "Message" ("instanceId", "messageTimestamp" DESC);

CREATE INDEX CONCURRENTLY IF NOT EXISTS message_instance_chat_ts_idx
  ON "Message" ("instanceId", (key->>'remoteJid'), "messageTimestamp" DESC);

CREATE INDEX CONCURRENTLY IF NOT EXISTS message_lid_alt_idx
  ON "Message" ("instanceId") WHERE key ? 'remoteJidAlt';

-- pg_trgm is installed in the telegram schema by the bridge
CREATE INDEX CONCURRENTLY IF NOT EXISTS isonwhatsapp_jidoptions_trgm
  ON "IsOnWhatsapp" USING gin ("jidOptions" telegram.gin_trgm_ops);

For fast message search, also build message_body_trgm. Copy it exactly from docs/whatsapp.md → Indexes on Evolution's tables. Postgres ignores the index if its expression differs from the app's query at all, and nothing reports an error.

Upgrading an earlier deployment of this template (to 1.4)

  • Back up Postgres first. Migrations only go forward; an older image can't read a migrated database.
  • Evolution moved to the reforged fork. On its first start, the fork removes duplicate messages and adds the unique index Message_instanceId_key_unique in one transaction that blocks writes. Evolution serves nothing until it finishes. Under a few hundred thousand messages, just switch the image. Above that, build the index first while the old image keeps running: Moving from stock Evolution 2.3.7. Afterwards, check that the indexes above still exist (SELECT indexname FROM pg_indexes WHERE tablename = 'Message';).
  • Check the Automata MCP boot log. If it says "Message" vacuum settings skipped, run this as postgres: ALTER TABLE "Message" SET (autovacuum_vacuum_insert_scale_factor = 0.01, autovacuum_vacuum_scale_factor = 0.05);
  • Restart Evolution after any Postgres restart. Otherwise accounts can show as connected while nothing is sent or received.

Common Use Cases

  • Let Claude/Codex/Grok read, search and summarize WhatsApp or Telegram conversations, including history imported at linking, and send replies
  • Give Claude/Codex/Grok read-only (or write) SQL access to a Postgres database, limited to the tables you choose
  • Share messaging accounts and databases across a team, with per-member tokens that can be revoked or rotated

Dependencies for Automata | WhatsApp, Telegram, SQL MCP Hosting

  • PostgreSQL (app data, WhatsApp messages, Telegram sync)
  • Evolution API (reforged) + Redis with persistence (WhatsApp)
  • Automata Telegram bridge (Telegram; API ID/hash optional)
  • SMTP server (optional, for alerts, invitations and email verification)

Implementation Details

  • Tokens are bound to a single connection. Tools take no account or database argument, so a token can only reach the connection it was issued for.
  • Keep Automata MCP at one replica. Disconnect alerts run in-process, so each extra replica sends duplicate emails.
  • Keep WEBHOOK_GLOBAL_ENABLED=false on Evolution. The app registers a webhook per connection, so turning the global one on delivers every event twice.

Why Deploy Automata | WhatsApp, Telegram, SQL MCP 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 Automata | WhatsApp, Telegram, SQL MCP on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.


Template Content

More templates in this category

View Template
N8N Main + Worker
Deploy and Host N8N with Inactive worker.

jakemerson
121
View Template
Evolution API with n8n
Automate WhatsApp workflows with Evolution API, n8n, and Postgres.

codestorm
113
View Template
Postgres Backup
Cron-based PostgreSQL backup to bucket storage

Railway Templates
866