Skip to content
Automata | WhatsApp, Telegram, SQL MCP

a month ago

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

Category: Automation

URL: https://railway.com/deploy/automata-or-whatsapp-telegram-sql-mcp

1 Reply

17 hours ago

NOTICE: Upgrading to Automata 1.4.0 (and the new Evolution image)

TL;DR: 1.4.0 moves WhatsApp to our Evolution fork, evolution-api-reforged 3.1.0. The switch is recommended but optional: Automata 1.4 also runs against stock Evolution 2.3.7. If your WhatsApp accounts hold a lot of messages, read step 3 before you switch.

What the fork fixes

  • An account that shows "connected" but stops receiving messages until Evolution restarts (one undecodable message used to stall it)
  • WhatsApp dropping the connection about every 50 minutes
  • Messages lost when Evolution restarts (they now wait in a Redis queue and are replayed)
  • Messages stored twice (a unique index stops new duplicates)

Steps

1. Back up Postgres. Migrations only go forward; an older image can't read a migrated database.

2. Update the Automata MCP service to ghcr.io/ju-li/automata-mcp-web:1 (we recommend :1 over :latest, so a future major version never arrives by surprise). It migrates its tables at boot. Check its log: if you see "Message" vacuum settings skipped, run this as postgres (railway connect Postgres):

ALTER TABLE "Message" SET (autovacuum_vacuum_insert_scale_factor = 0.01, autovacuum_vacuum_scale_factor = 0.05);

3. Check how many WhatsApp messages you store:

SELECT reltuples::bigint AS approx_messages FROM pg_class WHERE relname = 'Message';

On its first start, the fork removes duplicate messages and adds a unique index in one transaction that blocks writes. Evolution serves nothing until it finishes.

  • Under a few hundred thousand: go straight to step 4.
  • More than that: build the index first, while stock Evolution keeps running: Moving from stock Evolution 2.3.7. Switch soon after it's built.

4. Switch the Evolution API image to:

ghcr.io/operational-intelligence-inc/evolution-api-reforged:3.1.0@sha256:09a2b03c065c888a9e3b80212ce372a5dae9128cdfbc6f59450b0c71131daea3

and add QRCODE_LIMIT=30 to its variables. The fork won't start if AUTHENTICATION_API_KEY is empty or one of the example keys from Evolution's docs. The template generated a random one, so this only matters if you changed it. Linked accounts stay linked; no QR rescan is needed.

5. Add the query indexes if you haven't already. They make reading, chat listing and search fast on large accounts, whichever Evolution you run. The app finds them within 10 minutes, with no restart. Run each statement on its own:

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';

For the search and IsOnWhatsapp indexes, copy the SQL exactly from docs/whatsapp.md → Indexes on Evolution's tables.

Staying on stock Evolution?

That's fine. Two things:

  • Pin it to 2.3.7 rather than latest, since that's the version Automata is tested against.
  • Don't build Message_instanceId_key_unique unless you're about to switch. On stock, it makes a duplicate message fail to save instead of being saved twice.

Rolling back

Going back to stock 2.3.7 from the fork has been tested and works. You'll just lose the fixes above.

Questions or problems: reply here or open an issue at https://github.com/ju-li/automata-mcp/issues.


Welcome!

Sign in to your Railway account to join the conversation.

Loading...