Overview
The Telegram integration uses the grammy library to connect to Telegram’s Bot API. It supports all core NanoClaw features including group chats, isolated contexts, scheduled tasks, and typing indicators.Features
- Full channel support - Direct messages, group chats, and channels
- Bot commands - Built-in
/chatidcommand for registration - Typing indicators - Shows when the assistant is working
- Concurrent chats - Handle multiple conversations simultaneously
- Flexible deployment - Run alongside WhatsApp or as the only channel
Adding Telegram
Use the/add-telegram skill to add Telegram support:
Choose deployment mode
- Replace WhatsApp - Telegram becomes the only channel
- Alongside - Both WhatsApp and Telegram run simultaneously
Apply code changes
The skill runs
npx tsx scripts/apply-skill.ts .claude/skills/add-telegram which:- Adds
src/channels/telegram.ts(TelegramChannel implementation) - Adds
src/channels/telegram.test.ts(46 unit tests) - Merges multi-channel support into
src/index.ts - Adds Telegram config to
src/config.ts - Installs the
grammyNPM package
Creating a Telegram bot
If you don’t already have a Telegram bot:Create the bot
Send
/newbot and follow the prompts:- Bot name: Something friendly (e.g., “Andy Assistant”)
- Bot username: Must end with “bot” (e.g., “andy_ai_bot”)
Configuration
Environment variables
Add to.env:
Sync to container
The container reads environment fromdata/env/env:
Group privacy settings
By default, Telegram bots only see messages that @mention them or start with/ in group chats.
To let the bot see all messages in groups:
This is optional. If you only want trigger-based responses (via @mentions), leave group privacy enabled.
Build and restart
After configuration:Registering chats
Get chat ID
Register the chat
For your main chat (responds to all messages):Testing the connection
Send a message to your registered Telegram chat:- For main chat: Any message works
- For non-main chats:
@Andy helloor @mention the bot
Check logs
JID format
Telegram chats use thetg: prefix:
- Individual chat:
tg:123456789 - Group chat:
tg:-1001234567890 - Channel:
tg:-1001234567890
Implementation details
The Telegram channel implements theChannel interface:
Troubleshooting
Bot not responding
Check these common issues:Token not configured
Token not configured
Verify
TELEGRAM_BOT_TOKEN is set in .env and synced to data/env/env:Chat not registered
Chat not registered
Check if the chat is in the database:
Service not running
Service not running
Check if NanoClaw is running:
Trigger pattern not matched
Trigger pattern not matched
For non-main chats with
requiresTrigger: true, messages must include the trigger pattern (e.g., @Andy).Bot only responds to @mentions in groups
This is the default Telegram behavior. To change:- Open @BotFather
- Send
/mybotsand select your bot - Bot Settings → Group Privacy → Turn off
- Remove and re-add the bot to the group (required for change to take effect)
Getting chat ID fails
If/chatid doesn’t work:
-
Verify the bot token:
-
Check that NanoClaw is running:
- Make sure the bot is started (it should connect on launch)
Agent swarms (teams)
For advanced team collaboration, you can add Agent Swarm support where each subagent appears as a different bot in the Telegram group:Removing Telegram
To remove the Telegram integration:Revert code changes
- Remove
TelegramChannelimport and creation fromsrc/index.ts - Remove
channelsarray, revert to usingwhatsappdirectly - Remove Telegram config from
src/config.ts
Next steps
Add Discord
Add Discord support to your installation
Add Slack
Add Slack support to your installation
Skills system
Learn more about how skills work