/add-telegram - Telegram Channel Skill
Purpose
Add Telegram as a communication channel for NanoBob.
Prerequisites
- Telegram Bot Token from @BotFather
What This Skill Does
- Creates
src/channels/telegram.tswith Telegram channel implementation - Adds import to
src/channels/index.ts - Updates
.envwithTELEGRAM_BOT_TOKEN - Rebuilds the project
Usage
Inside the claude CLI, run:
/add-telegram
Then follow prompts to:
- Enter your Telegram Bot Token
- Test the connection
- Register groups from Telegram chats
Implementation Details
Channel File: `src/channels/telegram.ts`
import { registerChannel, ChannelOpts } from './registry.js';
import { Telegraf } from 'telegraf';
export class TelegramChannel implements Channel {
// Implementation using Telegraf library
// Handles message reception and sending
// Maps Telegram chat IDs to internal JIDs
}
registerChannel('telegram', (opts: ChannelOpts) => {
const token = process.env.TELEGRAM_BOT_TOKEN;
if (!token) return null;
return new TelegramChannel(opts);
});
Dependencies
Add to package.json:
"telegraf": "^4.16.0"
Environment Variable
TELEGRAM_BOT_TOKEN=your_bot_token_here
Post-Installation
- Run
npm installto install new dependencies - Run
npm run buildto compile TypeScript - Restart NanoBob
- Use
@Bobin your Telegram chats