Developer docs

22. Channels (broadcast)

On this page

A channel (CHAT_TYPE_CHANNEL) is a chat where only admins with post_messages post and subscribers read. Posts are anonymous (sender_id = 0). The sync model is unchanged (§4): one event per post in the channel’s pts log, read by every subscriber, so a post costs the same at 10 or 10 million subscribers. Everything below is in ChannelsService (channels.proto) unless another service is named.

22.1 Discussion group and comments

  • Linking. SetDiscussionGroup(channel_id, group_id) needs change_info in both chats. The group can’t be a forum and can be the discussion of only one channel; group_id = 0 unlinks. Both chats get Chat.linked_chat_id (and a chat_updated event). GetGroupsForDiscussion lists the groups the caller could link.
  • Thread roots. Every new post (not service messages, not scheduled until sent) is copied into the group in the same transaction: sender_id = 0, sender_chat_id = channel, automatic_forward = true, forward naming the post. The copy is the post’s thread root. Album items are all copied; the first copy is the root of the whole album. Edits of the post are mirrored into the copy; deleting the post keeps the copy (as in Telegram). Only posts sent while a group is linked get comments.
  • Comments are replies in the group. A reply’s reply_to_top_id is the root of the thread it replies into (a reply to a comment stays in the same thread). Every rule of the group applies: bans, restrictions, default permissions, slow mode, join requests, moderation. A reader of the channel who isn’t in the group is joined on their first comment (or files a join request if the group approves members). Channel admins with post_messages may comment as the channel: SendMessageRequest.send_as_chat_id = channel gives sender_id = 0, sender_chat_id = channel; anyone else gets SEND_AS_PEER_INVALID. Service messages (joins) don’t start the slow-mode timer.
  • Counters. Message.replies on the post: comments, replies, up to three recent_repliers (users) and recent_chat_repliers (chats posting as themselves), discussion_chat_id, root_id, max_id, and my read_max_id. On the root in the group: the same with channel_id. Counters are not pushed to subscribers (that would be one write per subscriber per comment): clients refresh the posts on screen with MessagesService/GetViews, which now returns views, forwards and replies aligned with message_ids (Telegram getMessagesViews). Poll every 5–10 s while a post is visible.
  • Reading a thread. GetDiscussionMessage(chat_id, message_id) takes the channel post (or a message in the group) and returns the root (all album items), the group, replies, max_id, my read_inbox_max_id, unread_count and can_comment. GetReplies pages the thread like GetHistory (newest first; offset_id, add_offset, min_id, max_id). Access comes from the channel: anyone who can read the post can read its thread, also when the group is private; a private channel’s threads stay private. Group members get new comments live as group events; others poll GetReplies with min_id. ReadDiscussion(chat_id, message_id, read_max_id) stores my position (it only moves forward) and returns the unread count.
  • Bot API. channel_post / edited_channel_post as before. Copies have is_automatic_forward: true and sender_chat = the channel; comments carry message_thread_id = the root id; a bot sending with message_thread_id in a discussion group (no reply_to) posts a comment. getChat returns linked_chat_id on both sides.

22.2 Posts

  • Signatures. ToggleSignatures(chat_id, signatures, profiles) (change_info). With profiles, posts also carry post_author_id (Telegram “show authors’ profiles”) next to post_author, so clients link the signature to the profile; the Bot API sets from on such posts.
  • Counters. views (§22.4), forwards (every forward of the post, also forwards of forwards, counted on the original post), edit_date = “edited”.
  • Polls / quizzes, albums, pins, silent and scheduled posts work in channels as in groups: quizzes stay correct-option-hidden until closed, any admin who may post may schedule (schedule_date, §13.3), silent posts send no notification sound.
  • Post links. ExportMessageLink(chat_id, message_id, comment_id?) → https://<host>/<username>/<id> for public chats (works for anyone), https://<host>/c/<chat_id>/<id> for private ones (members only), ?comment=<id> for a comment. ResolveMessageLink(link) accepts those, /s/<username>/<id>, and televo://resolve?domain=<u>&post=<id>. Opened in a browser, public links render the web preview (§22.6), private ones redirect to televo://privatepost?channel=&post=.

22.3 Admin log (“Recent actions”)

GetAdminLog(chat_id, types[], admin_ids[], query, max_id, limit) for groups and channels, admins only (CHAT_ADMIN_REQUIRED). Events (AdminLogEvent.Type): edits (previous and new content), deletions (the deleted content), pins/unpins, settings (field: title, about, photo, username, signatures, slow_mode, permissions, noforwards, ttl, reactions, sensitive, forum, appearance, with prev_chat/new_chat), discussion link changes, joins, leaves, invites, joins by link (invite_link) and by request, kicks, bans, unbans, restrictions, promotions, demotions, rights or title changes, ownership transfer, stream ingest key creation/revocation and stream schedules. actor_id is who did it (the member themself for joins and leaves). Changes without a user (auto-delete timers, workers) are not logged. Entries are sealed at rest and kept TELEVO_ADMIN_LOG_HOURS (default 48, like Telegram); AdminLog.retention_hours says how long. Telegram has no Bot API method for the admin log, so neither do we.

22.4 Statistics and views

  • Who. Admins of channels with at least TELEVO_CHANNEL_STATS_MIN subscribers (default 500); ChatFull.can_view_stats. Others get CHAT_ADMIN_REQUIRED / CHAT_STATS_UNAVAILABLE.
  • What. GetBroadcastStats(chat_id, days ≤ 90): followers now vs. days ago, views/shares/reactions per post (current vs. previous period), the share of subscribers with notifications on, and day-by-day graphs: followers total, joined/left, muted/unmuted, views, shares, reactions, views by source (GetViewsRequest.source: channel, forward, search, link, web, other) and by viewer UI language (top 8 + other); top posts and recent posts with views, forwards, reactions and comments. GetPostStats(chat_id, message_id): the post’s counters, views per day, reactions per emoji, and the public groups/channels it was forwarded to (never users or private chats).
  • Privacy. Only aggregates exist. Views are counted in a per-post HyperLogLog sketch (viewers are hashed into registers; nobody can be read back out); the old per-viewer table is dropped. Daily rollups (channel_stats_daily, sharded rows) are maintained by triggers (joins, leaves, mutes, reactions) and by the view flusher; no statistic is ever broken down below “per day per channel”.
  • View counting. GetViews(increment = true) from subscribers: a user counts once per post (dedupe window TELEVO_VIEW_SKETCH_DAYS, default 30 days; older posts restart dedupe from their count), with ~1.6 % error at large counts and practically exact below a few thousand. Writes are batched per node every TELEVO_VIEW_FLUSH_MS (default 2 s) in one transaction; nodes merge their sketches (HLL union), so a viewer seen by two nodes still counts once. There is no live views broadcast: clients poll GetViews for visible posts.

22.5 Ownership and admins

ChatsService/SetMemberRole(role = OWNER) transfers ownership; the owner must send password when two-step verification is set (PASSWORD_REQUIRED, PASSWORD_HASH_INVALID; attempts share the SetPassword limit). Custom admin titles (title, ≤ 32), anonymous posting (AdminRights.anonymous) and subscriber management (GetMembers / RemoveMember for admins) are unchanged; subscribers still can’t list subscribers (G8). ChatFull.admins_count / banned_count for admins.

22.6 Discovery and the web

  • Similar channels. GetSimilarChannels(chat_id) (chat_id = 0: from all my channels, minus the ones I follow). An offline job (TELEVO_RECS_EVERY_MIN, default daily) uses public, non-sensitive, unmoderated channels with at least TELEVO_RECS_MIN_SUBSCRIBERS (100) subscribers, a deterministic sample of TELEVO_RECS_SAMPLE (20000) subscribers each, and keeps a pair only when the sampled overlap is at least TELEVO_RECS_MIN_OVERLAP (50, k-anonymity). Score = cosine similarity; top 10 per channel.
  • Public search of channels is UsersService/Search (§14.2).
  • Web preview. GET /s/<username> (latest 20 posts), /s/<username>/<post>, /<username>/<post>, ?embed=1 for iframes: server-rendered HTML, no scripts, strict CSP, text and media labels only (no files). A restriction_reason for platform web or all replaces the page with its text; sensitive chats show a notice only; noforwards pages are marked protected (no selection) and say so; private and banned chats answer 404. Web views are not counted.

22.7 Boosts and levels

Premium accounts have TELEVO_BOOST_SLOTS (4) boost slots. ApplyBoost(chat_id, replace_chat_id?) (premium, else PREMIUM_ACCOUNT_REQUIRED with capability channel_boosts) puts a slot on a channel until the account’s premium ends; with all slots used, replace_chat_id moves one. GetBoostStatus / GetMyBoosts. Levels need 1, 3, 7, 12, 20, 30, 45, 65, 90, 120 boosts (Chat.level). Unlocks (SetChannelAppearance, change_info, else BOOSTS_REQUIRED with capability level:<n>): accent colour Chat.color (level 1), emoji_status_id (2), channel-wide autotranslation (3, translates posts for every subscriber, not only premium ones with Dialog.auto_translate). When the level drops, the settings are kept but hidden.

22.8 Live streams

Channel streams are CallsService KIND_STREAM calls (§12.6). GetStreamIngest(chat_id, kind RTMP|WHIP) (owner or change_info) returns the URL and the stream key for OBS & co., creating a LiveKit Ingress the first time; the ingress publishes into the channel’s active stream call (re-pointed on every call). The key is sealed at rest, never shown to other admins without the right, and RevokeStreamIngest deletes the ingress (the old key stops working) and makes a new one. available = false when the media server has no ingress service. ScheduleStream(chat_id, start_at, title) announces a stream (60 s … 7 days ahead; start_at = 0 cancels; ChatFull.scheduled_stream), ToggleStreamReminder lets anyone who can read the channel ask for a push (t = "stream") when it is due.

22.9 Push notifications for posts

Posts in channels (and messages in groups with ≥ TELEVO_FANOUT_GROUP_MIN = 1000 members) are notified through the durable fan-out queue (ARCHITECTURE “Broadcast fan-out”). Muted subscribers, sessions in the foreground and the author get nothing; who gets what (sound, preview) is decided per recipient by the notification settings policy. Channel pushes carry no badge (badge = -1) and collapse per chat (c<chat_id>).

Generated from docs/PROTOCOL.md in the Telvoro repository. Wire names such as televo.v1 are unchanged.