Skip to content

Notifications to people

github-actions[bot] edited this page Dec 4, 2026 · 4 revisions

What the panel tells the people who use it in a Telegram bot of its own: linking a chat, the kinds of notice and their modes (off, ask, auto), drafts the owner approves, incidents when access is down, and the settings.

The panel can write to the people who use it, in a Telegram bot of its own: the term is ending, the traffic is running out, the owner changed their access, the servers do not work. It is off until the owner sets a bot up and a person connects their own chat. The bot only talks: it never sends a link or a key and never asks for anything, and its words are neutral ("access", "device", "service"). The alerts for admins are another bot, see Telegram alerts.

Where it stands. The behaviour below is in the code and tested; the admin has no screens for it yet. The person connects a chat on their page. The owner sets the bot, hands out links and changes the chat limit through the Connect API (UserNotifyService, see API); the kinds and their settings are read and changed through the MCP tools user_notify_settings_get and user_notify_settings_set.

The bot and the chats

  • The bot. The owner makes a bot of its own with @BotFather and gives its token to the panel (SetUserBot, owner only, with a fresh sign-in confirmation). A token of the admin alerts' bot is refused. The token is sealed like the other secrets and never returned. A different bot, or none, unlinks every chat. The bot only listens for the commands below (long polling, no webhook).
  • Linking. A person links a chat from their page, or the owner or a helper hands out a link for them (BeginUserTelegramLink): t.me/<bot>?start=<code>, one-time, valid for 15 minutes, one pending link per person. Only a private chat can be linked. A chat that is not linked gets an answer only to /start <code>: a welcome, or a short reason when the code is bad or the person has as many chats as the limit allows; anything else gets no reply.
  • The limit. A person has up to 3 chats by default; the owner changes it for everybody (1 to 10) or for one person (SetUserTelegramChatLimit). A new chat is told to the person's other chats.
  • Commands. /stop unlinks the chat; /mute switches the owner's announcements off and on again (the announcements themselves are not sent yet, so today it changes nothing); the owner can send a chat one fixed test message (TestUserTelegramChat), at most every 10 seconds. The bot never sends a link.
  • Language. A message is in the language of the chat in Telegram (Russian, English, Simplified Chinese, Turkish or Persian), else in the panel's default language, else in English.

A person's chat ties them to a Telegram account: read the privacy note on the user page before you offer it.

What people are told

Every kind has a mode: off (nothing), ask (the panel makes a draft and waits for the owner, see Drafts) or auto (it goes out at once), and a sound: loud, or silent (Telegram's "no sound"). Each kind also has the channel switch telegram / app; Telegram is the only channel that sends today.

Kind When Default
expiry_soon The term ends in 3 days, and again in 1 day (days, one to five values of 1 to 365) auto, silent
expired The term has ended auto, loud
quota_warn The traffic reaches a share of the quota (percent, 1 to 99) auto, silent, 80
quota_over The traffic is used up auto, loud
restored Access is back after "expired" or "used up" (a renewal, a new quota period) auto, silent
link_rotated The owner issued a new subscription link (the message does not hold it) auto, loud
device_removed The owner removed or blocked a device: its type and when it was last online; its own name only when device_name is on, because it often holds a person's name auto, loud
awg_reconfig An AmneziaWG key is out of date and has to be downloaded again auto, loud
tg_key_changed The person's Telegram proxy key was changed (or revoked, only if the person has a key again by the time it is sent) auto, silent
incident_all_down All of a person's servers are down, see Incidents ask, loud

Three more kinds are in the settings table (incident_primary_down, torrent, device_limit) with their modes, but nothing sends them yet.

Rules that hold for all of them:

  • Only for a person with a chat, and only for what happened after the first chat was linked (and, for the status kinds, in the last 24 hours): turning this on or linking a chat never sends the past.
  • The notices of the owner's actions are for what the owner did: what the person does on their own page tells them nothing.
  • Checked again before sending. A renewal cancels "the term ends soon"; an incident that is over is not announced.
  • Few messages per chat. What is due for one person at the same time is joined into as few messages as fit, but an incident message is always sent alone (it is edited later) and a long text is split.
  • No secrets in the panel's own texts. No link, key, config, node address, person's name or traffic details; a device is named only when device_name is on. The owner's own text (a draft's text, own of an incident) goes out as written: the panel checks only its length and that it has no link, so keep names and addresses out of it.
  • Per-person switch-off. The owner can switch kinds off for one person alone (person with the list off in user_notify_settings_set; off_for_person in user_notify_settings_get). They then get nothing of that kind, including an incident.
  • Delivery. At most 20 messages a second from the bot and one a second to a chat. A failed send is retried after 1, 2, 4, 8, 16, 32 and 64 minutes and the notice is dropped when the eighth attempt fails; when Telegram says "too many requests" the panel waits as long as it asks and spends no attempt; a chat that blocked the bot is forgotten. The journal (user_notify_log, kept 30 days unless journal_days says otherwise) shows what was decided and how it ended, never the text, a chat or an account. A crash can send a message twice, never lose one. On the Cloudflare edition all of this runs from the admin Worker's minute schedule, so the first send, and any retry, waits for the next minute.

Drafts for the owner

A kind in mode ask makes a draft. The owner gets a card in the admin bot (the Telegram alerts chat of an admin with the owner role): the kind, how many people it is about, the text as one of them would read it, and the time it ends. It names nobody. Rows made together are one card: 40 people whose term ends are one card. The card has three buttons:

  • Send (in the panel language: «Отправить», «发送» ...) sends it to everybody in the draft.
  • Don't send drops it.
  • Edit text («Изменить текст») changes nothing by itself: reply to the card with your own text. The text is 1 to 1000 characters with no links (a link is refused with a reply that says so), it replaces the template for everybody in the draft and goes out as you wrote it, in every language. The card shows it and keeps its buttons; the last reply wins. A reply to a card that is already decided is answered "gone".

A press is believed only from the private chat of a linked owner, on the card sent to them; a second press changes nothing. Each press and each end is in the audit log (user_draft_send, user_draft_dismiss, user_draft_expire, user_draft_auto_send).

The deadline. A draft waits ttl_min minutes (30 by default, 1 to 1440). After that it burns: it is not sent, and the card says "Expired, not sent". With auto_send on, it goes out by itself instead, with your text if you gave one. With no owner chat linked there is nobody to show the card to, and the draft waits out the deadline the same way. On the Cloudflare edition a press is heard within a minute.

Incidents

An incident is the notice incident_all_down: every server of a person is down. The people hit by a failure of one server of several are not told: they still have a way in.

When one opens. For a person whose mode is not off (and is not switched off for them), who has a chat and an active account, all together:

  • every server they get (through their groups, main and extra, and their node limits, with a live key) has a "node is unreachable" or "no traffic" alert open, and the most recent of them has been open for at least open_after_min (10 by default). It is counted from the start of the fall: for "no traffic" the opening of the alert, for "node is unreachable" the latest of the alert's opening and the node's last contact (last seen, last disconnected, last connected). The alert itself waits for its own silence first;
  • the last of their servers fell after their first chat was linked;
  • they have no incident open and none opened in the last cooldown_min (60 by default). The incident takes in all the servers that fell: one person gets one, never one per node.

The message. One message per incident: "There are problems with access. We’re fixing it and will let you know when it works", loud by default. It is later edited, not followed by a second one.

When it ends. When a server of the incident has worked for recover_min minutes (5 by default, 0 = at once: no down alert is open on it or ended within that time), the incident closes and the message is edited to "Access was restored at 14:32. If a device didn’t reconnect on its own, reconnect it", in the panel's time zone. The edit is made within an hour of closing, only if the message was sent, the person is still active and the servers have not fallen again. An incident closes without a word of "restored" when:

  • the person was disabled or their term ended;
  • their servers were retired from the fleet;
  • it went silent: the alerts of the servers ended with no real end (the panel itself was blind) and nothing has been down for an hour.

The text. template is 1 to 3: 1 is the plain message, 2 is a short one, 3 is a calming one (it says the device is fine and nothing needs changing). own (up to 300 characters, no links) is your own text, sent instead of the template to the people hit; a reply to a card replaces it for that draft. The owner's text is never part of the soft message and the "restored" edit.

Who is told. scope:

  • affected (the default): only the people whose every server is down;
  • group: and also the people who share a group (main or extra) with someone hit;
  • all: and everybody with a chat.

The others, the informed, get a short soft message instead, always without sound: "Access may be interrupted. We are fixing it and will write when it works again". It is the same for all of them: no owner's text. If the failure reaches them too, it becomes their own incident; when the incident of the group or the fleet ends, the soft message is edited to "restored", or ends silently if nobody was hit for real. The same cooldown holds for them.

In mode ask it is one card for everybody opened in one pass: Affected (the people hit) and Informed (the soft ones), the text for the first and the soft text under "To the others". A draft of the informed only cannot be edited.

Settings

The kinds (mode, sound, channels and the parameters days, percent, device_name), the drafts and the incidents are one set of settings; one that was never touched follows the default of the code. They are read with user_notify_settings_get (any token) and changed with user_notify_settings_set: a plan the owner approves in the admin (MCP); a value out of its range is refused at the plan. The Connect API methods behind it are GetUserNoticeSettings, ApplyUserNoticeChanges and the others of UserNotifyService.

Setting Default Range What it does
ttl_min 30 1 to 1440 Minutes a draft waits for the owner (drafts)
auto_send off on, off At the end the draft goes out instead of burning (drafts)
open_after_min 10 1 to 240 Minutes all servers must be down before an incident opens (incidents)
recover_min 5 0 to 60 Minutes a server must work before the incident ends (incidents)
cooldown_min 60 0 to 1440 No new incident for a person within this time (incidents)
template 1 1 to 3 The text of the incident message (incidents)
own empty up to 300 characters, no links The owner's own text of the incident (incidents)
scope affected affected, group, all Who is told (incidents)
journal_days 30 7 to 365 Days the journal keeps what is finished; once an hour, finished notices, old notices of the app only, closed incidents and decided drafts older than that are removed, never an unfinished Telegram delivery, an open incident or an open draft
per_day 1 1 to 24 Notices a day to one person of the kinds device_limit and torrent (a setting of those kinds, not of journal)

Edit this page · View on mistgate.app

Mistgate

English

Getting started

Guide

Operations

Roadmap

Reference

Русский

Начало работы

Руководство

Эксплуатация

План развития

Справочник

简体中文

入门

使用指南

运维

路线图

参考

Clone this wiki locally