Features
- Send text messages or voice notes to Claudio
- Automatic voice transcription using OpenAI Whisper
- Persistent conversation sessions
- Rate limiting and command timeouts for security
- User authorization by Telegram ID
- Real-time streaming responses
Setup
Create your Telegram bot
Open Telegram and message @BotFather to create a new bot:Follow the prompts to choose a name and username. BotFather will give you a bot token like
1234567890:ABCdefGHIjklMNOpqrsTUVwxyz.Get your Telegram user ID
You need your Telegram user ID to authorize yourself. Message @userinfobot to get your ID.Your ID will look like
123456789.Configure environment variables
Copy the example configuration:Edit
channels/telegram/.env with your values:Configuration
Security settings
.env
Voice transcription (optional)
Enable voice message transcription by adding your OpenAI API key:.env
Without an OpenAI API key, the bot will still work but voice messages won’t be transcribed.
Commands
| Command | Description |
|---|---|
/start | Show welcome message and your user ID |
/help | Display detailed help information |
/new | Start a new conversation (clears context) |
/status | Show bot status and configuration |
/myid | Display your Telegram user ID |
Usage
Send text messages
Just send a message to your bot:Send voice messages
Record and send a voice message. If you’ve configuredOPENAI_API_KEY, the bot will:
- Show ”🎤 Transcribing audio…”
- Display the transcription
- Execute the request
Conversation sessions
The bot maintains conversation context per user. Each message continues the previous conversation unless you use/new.
channels/telegram/bot.py:289-291
Security features
User authorization
Only users listed inALLOWED_USER_IDS can use the bot. Unauthorized users receive:
channels/telegram/bot.py:87-94
Rate limiting
Prevents spam and DoS attacks by limiting requests:- Default: 10 requests per 60 seconds per user
- Configurable via
RATE_LIMIT_REQUESTSandRATE_LIMIT_WINDOW - Users exceeding the limit see: “⏱️ Rate limit excedido”
channels/telegram/bot.py:64-67
Command timeout
Commands are automatically terminated afterCOMMAND_TIMEOUT seconds (default: 1800 = 30 minutes) to prevent blocking the bot indefinitely.
Source: channels/telegram/bot.py:59
Lock file
Prevents multiple instances of the bot from running simultaneously:channels/telegram/bot.py:112-157
Stopping the bot
Troubleshooting
Bot doesn’t respond
Check that the bot is running:.env.
”Access denied” message
Make sure your user ID is inALLOWED_USER_IDS:
- Use
/myidcommand to get your ID - Add it to
ALLOWED_USER_IDSin.env - Restart the bot
Voice transcription not working
Check:OPENAI_API_KEYis set in.env- OpenAI package is installed:
pip install openai - Check logs for API errors
channels/telegram/bot.py:492-532
Lock file error
If you see “Another instance may be running”:Architecture
ClaudeCodeExecutor to run Claude Code CLI with the -p flag for non-interactive execution and --dangerously-skip-permissions to bypass MCP confirmation prompts.
Source: channels/telegram/bot.py:242-432