Repository navigation
feat: Telegram bot integration — per-agent bots with media support (#216) - #234
Merged
Merged
Conversation
) Phase 0: Generalize ChannelMessageRouter — replace 6 Slack-specific hardcodings with adapter method calls (channel_type, get_rate_key, get_session_identifier, get_source_identifier, get_bot_token). Zero behavior change for existing Slack users. Phase 1: Add Telegram as a clean, separate module — TelegramAdapter, webhook transport, encrypted bot token storage, media download with SSRF prevention, API endpoints with owner-gated auth, bot commands (/start, /help, /reset), HTML response formatting with 4096-char splitting, and webhook reconciliation on startup. Closes #216 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ChannelMessageRouter— replaced 6 Slack-specific hardcodings with adapter method calls (channel_type,get_rate_key,get_session_identifier,get_source_identifier,get_bot_token). Zero behavior change for existing Slack users.TelegramAdapter, webhook transport, encrypted bot token storage (AES-256-GCM), media download with SSRF prevention, API endpoints with owner-gated auth, bot commands (/start,/help,/reset), HTML response formatting with 4096-char splitting, and webhook reconciliation on startup.Changes
src/backend/adapters/base.py— 5 new abstract methods onChannelAdaptersrc/backend/adapters/message_router.py— Generalized router, removed Slack helperssrc/backend/adapters/slack_adapter.py— Backward-compatible method overridessrc/backend/adapters/telegram_adapter.py— NEW TelegramAdaptersrc/backend/adapters/transports/telegram_webhook.py— NEW Webhook transportsrc/backend/db/telegram_channels.py— NEW DB operations (encrypted tokens)src/backend/db/migrations.py—telegram_bindings+telegram_chat_linkstablessrc/backend/routers/telegram.py— NEW 5 API endpoints (webhook + CRUD + test)src/backend/services/telegram_media.py— NEW Media download with SSRF preventionsrc/backend/database.py— Telegram delegation methodssrc/backend/main.py— Router registration, transport startup, shutdown hookSecurity
X-Telegram-Bot-Api-Secret-Tokenheaderapi.telegram.orgOwnedAgentByNamedependency/cso --diffaudit: 0 findings above 8/10 confidence gateTest Plan
PUT /api/agents/{name}/telegramwith a valid BotFather token/start,/help,/resetcommands → correct responsesCloses #216
🤖 Generated with Claude Code