← Back to PRs

#7058: feat(telegram): add channel_post handler for broadcast channels

by waifu7498173 open 2026-02-02 10:29 View on GitHub →
channel: telegram
## Summary Adds support for receiving posts from Telegram broadcast channels. ## Changes - Add `channel_post` handler in `bot-handlers.ts` - Add `TelegramChannelSchema` config schema - Add `channelPolicy` and `channelAllowFrom` config options - Update `bot-message-context.ts` to handle channel peer type - Route channel posts to sessions like `agent:main:telegram:channel:<id>` ## Config Example ```json { "channels": { "telegram": { "channelPolicy": "allowlist", "channelAllowFrom": ["435522423"], "channels": { "-1001397847758": { "enabled": true } } } } } ``` ## Testing - Added bot as channel admin - Channel posts now route to separate sessions per channel - Supports per-channel config (enabled, allowFrom, systemPrompt) Closes #7027 <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR adds support for Telegram broadcast channels by wiring a new `channel_post` update handler and extending Telegram config to include per-channel settings (policy/allowFrom plus per-channel overrides). Channel posts are routed into distinct sessions (via a `channel:<id>` peer id) and `bot-message-context` is updated to treat channel chats as a separate peer type for envelope/session metadata. Main things to double-check before merge are (a) the routing `peer.kind` type for channels (so bindings/session keys behave as intended) and (b) consistency between the new config schema vs the documented example (schema currently requires fields that the example omits), plus making sure the intended default policy source is used for channels. <h3>Confidence Score: 3/5</h3> - Moderately safe, but there are a couple of routing/config mismatches that could break channel support in real deployments. - Core implementation is straightforward, but the channel peer kind is currently cast away when calling the routing layer (risking incorrect session routing/bindings), and the new config schema appears inconsistent with the provided example (risking config validation failures). The remaining concern is whether channels should inherit group defaults for policy decisions. - src/telegram/bot-message-context.ts, src/telegram/bot-handlers.ts, src/config/zod-schema.providers-core.ts <!-- greptile_other_comments_section --> <sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub> **Context used:** - Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8)) - Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13)) <!-- /greptile_comment -->

Most Similar PRs