Self-host and operate

Connection alerts

A paired messenger account can silently drop. Automata emails everyone who can reach a connection when it disconnects, and again when it recovers, so you find out before an AI client starts failing. That is every administrator of the organization plus the members the connection is assigned to, each mailed separately.

How alerts are detected

Two mechanisms work together:

  • Webhooks give fast alerts. Automata registers a per-connection webhook with Evolution and the Telegram bridge. Each delivery is treated as a prompt to re-read live state, not as trusted state. An hourly task re-registers every webhook with the connection's own key, which picks up connections created before alerts existed or whose server was rebuilt.
  • A five-minute sweep runs inside the web process and re-reads every connection. It is not just a backstop: a socket that dies and is retried emits no webhook at all, and a Telegram bridge that is down cannot send one, so the sweep is the only thing that sees those.

Nothing is mailed until a connection has been down for 10 minutes, in any state (a connection that is only stuck waits two hours, below). A drop that recovers inside that window mails nobody, so a short blip no longer produces an outage email followed seconds later by a recovery email. Because the sweep runs every five minutes, a real outage is reported 10 to 15 minutes after it starts.

A WhatsApp reconnect loop counts as an outage too, even though nearly every live read finds the account open. Two sockets on one set of credentials keep replacing each other, and neither the webhook nor the live state shows it. The sweep reads when Evolution last wrote the account's "Instance" row, which happens on every socket open. Ten minutes of fresh writes on an open row marks the connection unstable, and the 10-minute grace period runs from there, so the email goes out 20 to 25 minutes into the loop. It says restarting the Evolution service is the fix, since Reconnect cannot help. See Stuck reconnecting.

So does a WhatsApp account whose socket is dead under a live open: every read says connected, but a send or group lookup failed with Connection Closed and Evolution has not reopened the socket since. The connection is marked stuck from the next read. Being stuck is inferred rather than read off Evolution, so the organization is mailed only once it has lasted two hours; any other fault at the same time keeps the 10-minute grace, and the operator (below) hears at once. Sends that WhatsApp never acknowledges count as evidence too. The email says the Evolution service needs restarting, never Reconnect. A webhook delivery cannot start it. See Stuck with the socket dead.

Only whoever runs the Evolution service can end a reconnect loop or a stuck session, so the operator can be told directly. Set NUXT_OPS_ALERT_EMAIL on the web service and that address is mailed as soon as a connection on the deployment's own Evolution server is marked unstable or stuck, with no grace period, and once more when that ends. The mail names only ids. Connections on a server the organization supplied are not reported. On the hosted service (NUXT_CLOUD_URL set), the address also changes what customers read: the outage email, the dashboard, and get-connection-status (operatorAlerted: true) say the operator has been alerted and there is nothing for them to do.

Telegram failures are told apart in the email:

What happenedWhat the email says
The connection to Telegram droppedPress Reconnect; no scan
The session was ended from Telegram → Settings → Devices, or by TelegramLink again by QR code; synced chats are kept
The bridge could not be reachedNothing to scan; check the bridge service
Another bridge process holds the sessionNothing to scan; run the bridge as one instance

A connection that has never been paired is skipped, except that an unreachable Telegram bridge counts as an outage even for a connection never linked, since the app cannot tell the two apart from outside. PostgreSQL and email connections are not monitored. An alert is recorded only after the email is actually sent. A broken SMTP configuration delays alerts instead of dropping them, and a deployment with no SMTP host computes alerts without delivering them.

Configure mail

Set the NUXT_SMTP_* variables and NUXT_MAIL_FROM on the web service. Use NUXT_SMTP_TLS=false for STARTTLS on port 587, and true for implicit TLS on 465. The sender must be an address your provider accepts. The full list is in Configuration.

The same mail settings deliver organization invitations and account emails such as verification codes and password resets. Without SMTP, Send invite email answers with an error and leaves the link on screen to copy; Resend email has already replaced the link, so it shows the new one to copy, and the old one no longer works.

Operational rules

  • Set NUXT_WEBHOOK_SECRET so webhook requests carry and verify the shared x-webhook-secret header.
  • Make sure NUXT_WEBHOOK_URL is reachable from Evolution. Without it no per-connection webhook is registered, and alerts arrive only as fast as the sweep. The Telegram bridge posts to NUXT_TELEGRAM_WEBHOOK_URL when it is set, and otherwise derives its callback from NUXT_PUBLIC_APP_URL.
  • Set NUXT_PUBLIC_APP_URL so each alert links to its connection.

Test it locally

Run a mail catcher, then trigger the sweep by hand. The steps are in Local deployment. For missing or duplicate emails, see Troubleshooting.

View source