What It Does
The Add Telegram skill:- Installs Telegram channel code and dependencies
- Guides through bot creation with @BotFather
- Configures bot token authentication
- Registers chats (DM or groups)
- Optionally enables Agent Swarm support for team sessions
Prerequisites
- NanoClaw base installation complete
- Telegram account
- Access to @BotFather on Telegram
How to Apply
Create Telegram bot
If you don’t have a bot token:
- Open Telegram and search for
@BotFather - Send
/newbotand follow prompts - Bot name: Something friendly (e.g., “Andy Assistant”)
- Bot username: Must end with “bot” (e.g., “andy_ai_bot”)
- Copy the bot token (
123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11)
Apply code changes
The skill runs
npx tsx scripts/apply-skill.ts .claude/skills/add-telegram which:- Adds
src/channels/telegram.ts - Adds unit tests
- Installs
grammydependency - Updates channel registry
Get chat ID
- Open your bot in Telegram
- Send
/chatid- it replies with the chat ID - For groups: add the bot first, then send
/chatidin the group
What Changes
Files Created
src/channels/telegram.ts- Telegram channel implementationsrc/channels/telegram.test.ts- Unit tests (46 tests)groups/telegram_main/- Main chat workspace (if registered as main)
Files Modified
package.json- Addsgrammydependencysrc/channels/index.ts- Imports Telegram channel.env- AddsTELEGRAM_BOT_TOKENdata/env/env- Synced environment for container.nanoclaw/state.yaml- Records skill applicationstore/messages.db- Adds registered chat entries
Dependencies Added
grammy- Telegram Bot API framework
Usage
Main Chat (No Trigger Required)
In your main chat, any message triggers the assistant:Additional Chats (Trigger Required)
In other chats, use the trigger word or @mention:Group Privacy Setting
For group chats where you want the bot to see all messages (not just @mentions):- Open Telegram and search for
@BotFather - Send
/mybotsand select your bot - Go to Bot Settings > Group Privacy > Turn off
- Remove and re-add the bot to the group
Telegram bots run alongside other channels. If you have WhatsApp configured, both channels work simultaneously. The agent auto-enables when
TELEGRAM_BOT_TOKEN is present in .env.Agent Swarms (Teams)
After Telegram setup, you can add Agent Swarm support. This makes each subagent appear as a different bot in group chats, so you can see team conversations. Without Swarm support, Agent Teams still work - they just operate behind the scenes. To enable: Run/add-telegram-swarm after completing Telegram setup.
Troubleshooting
Bot Not Responding
Check:TELEGRAM_BOT_TOKENis set in.envAND synced todata/env/env- Chat is registered:
sqlite3 store/messages.db "SELECT * FROM registered_groups WHERE jid LIKE 'tg:%'" - For non-main chats: message includes trigger pattern
- Service is running:
launchctl list | grep nanoclaw
Bot Only Responds to @Mentions in Groups
Group Privacy is enabled (default). To fix:@BotFather>/mybots> select bot > Bot Settings > Group Privacy > Turn off- Remove and re-add the bot to the group
Getting Chat ID
If/chatid doesn’t work:
- Verify token:
curl -s "https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/getMe" - Check bot is started:
tail -f logs/nanoclaw.log