PhoenixKitWeb. Live. Components. TelegramNotificationsCard
(phoenix_kit v2.62.2)
Copy Markdown
View Source
"Telegram" card of a user's notification settings: link a chat to the website's Telegram bot with one tap, choose what goes there, disconnect.
Shown while the admin has chosen a website bot
(PhoenixKit.Integrations.Telegram.SiteBot), or while the user still has a
link to show; otherwise it renders nothing. It needs no permission beyond the
settings page itself — an ordinary customer links their chat here, without
the admin area or the integrations permission.
Connect mints a one-time https://t.me/<bot>?start=<token> link
(Telegram.Linking). The page then reads the bot's updates every few
seconds while it stays open; the I've sent it button reads them at once.
A user who closes the page after pressing Start is linked the next time
they, or anyone, poll that bot — and the page checks once when it opens
while a link is still pending. Nothing asks Telegram unless a link is
pending, one timer per card drives the polling, and Connect / I've sent
it are throttled, so clicking them quickly cannot pile up requests.
A link Telegram's delivery has switched off (the user blocked the bot) shows as such, with a Reconnect button that runs the same one-tap flow. A link that runs out before Start is pressed says so.
Attrs: id, user (the signed-in %User{}).