A bidirectional bridge between AgentChattr and Telegram. Monitor and control your AI coding agents from your phone.
| AgentChattr Web UI | Telegram |
|---|---|
![]() |
![]() |
- Read path: Relays AgentChattr messages to your Telegram chat in real time
- Write path: Send messages from Telegram back to AgentChattr (with @mentions and channel routing)
- Channel routing: Prefix messages with
#channel-nameor use/channel <name>to switch channels - Operator commands:
/status,/channels,/channel <name>,/help - State persistence: Cursor tracking so no messages are lost on restart
Single Python script (~600 lines), no dependencies beyond requests. Registers with AgentChattr as a regular agent via the REST API — no modifications to AgentChattr needed.
Telegram Bot API <--> telegram_bridge.py <--> AgentChattr REST API
(getUpdates) (polling both) (/api/messages, /api/send)
(sendMessage) (/api/register, /api/heartbeat)
- Message @BotFather on Telegram
- Send
/newbotand follow the prompts - Copy the bot token (e.g.,
123456:ABC-DEF...)
- Send any message to your new bot
- Open
https://api.telegram.org/bot<YOUR_TOKEN>/getUpdatesin a browser - Find
"chat":{"id":123456789}— that's your chat ID
pip install -r requirements.txtOption A: Environment variables
export TELEGRAM_BOT_TOKEN="your-bot-token"
export TELEGRAM_CHAT_ID="your-chat-id"
# Optional:
export AGENTCHATTR_URL="http://127.0.0.1:8300"
export POLL_INTERVAL="2"Option B: AgentChattr config.toml
Add a [telegram] section to your existing config.toml:
[telegram]
bot_token = "your-bot-token"
chat_id = "your-chat-id"
agentchattr_url = "http://127.0.0.1:8300"
poll_interval = 2Environment variables always override config.toml values.
# If using config.toml:
python3 telegram_bridge.py --config /path/to/config.toml
# If using env vars:
python3 telegram_bridge.py
# With debug logging:
python3 telegram_bridge.py -vMessages you type in Telegram are forwarded to AgentChattr's default channel (general).
To send to a specific channel, prefix your message:
#discussion Hey team, what's the status?
To change the sticky default channel:
/channel ops-growth
All subsequent messages without a #prefix will go to ops-growth.
@mentions in your Telegram messages are preserved and trigger AgentChattr's agent routing. For example:
@t3 please fix the login bug
| Command | Description |
|---|---|
/status |
Show connected agents and their state |
/channels |
List available channels |
/channel <name> |
Set default channel |
/help |
Show help message |
- Registers with AgentChattr as a regular agent (gets a Bearer token)
- Polls AgentChattr
/api/messagesfor new messages (configurable interval, default 2s) - Polls Telegram
getUpdatesfor operator messages - Formats and relays messages between both platforms
- Persists cursors to a JSON file so no messages are lost on restart
- Sends heartbeats every 5s to keep the bridge's presence alive in AgentChattr
- Deregisters on shutdown (SIGINT/SIGTERM) to free the agent slot
- Python 3.10+
- AgentChattr running locally (or accessible via network)
- A Telegram bot token and chat ID
MIT

