PhoenixKit.Notifications.Channels.Telegram (phoenix_kit v2.62.2)

Copy Markdown View Source

Telegram notification channel — delivers a user's notifications to Telegram, through their own bot or through the site's.

There's nothing to configure on the notifications page: the channel auto-discovers where to send.

Personal bot

The recipient's own Telegram integration connections, and the chat(s) captured on them (during Test on the integration form). A personal bot wins over the site's: someone who set one up wants it used. Each connection carries a mode:

  • "single" — auto-capture locks one private chat (the owner's), so a stranger who messages the bot right after them is not picked up.
  • "multi" — every chat that has started the bot → a broadcast.

The mode governs auto-capture only: the owner can also link a chat by id (a group, a channel), so chat_ids is not capped by it. The channel sends to every id on the list and does not care which kind each one is.

Site bot

When the recipient has no personal bot linked, the site's bot delivers — if the admin chose one (Telegram.SiteBot) and the recipient linked their chat to it (Telegram.Linking). The chat id is read from config ("site_chat_id"), and the bot comes from the site setting, never from the user's config: a link made to a bot that is no longer the site's bot is not honoured, so changing the bot cannot send one person's messages through a stranger's.

A failure of the site bot itself (revoked token, deleted connection, a 401 or

  1. is transient: it hits every linked user alike, so it must not switch anyone's channel off. Only errors about the chat (blocked, kicked, deactivated, chat not found) are permanent there.

configured?/2 is true once the recipient has somewhere to send. Bot tokens are resolved owner-scoped at send time — this module never handles them.

The config arg (the notification_channel:telegram blob) carries routing/ cadence and, for the site bot, the linked chat.