A Telegram bot that bridges messages to Claude Code, giving your team an AI assistant accessible via Telegram.
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txtCopy the example and fill in your values:
cp .env.example .env| Variable | Description |
|---|---|
TELEGRAM_BOT_TOKEN |
Bot token from @BotFather |
ALLOWED_CHAT_IDS |
Comma-separated Telegram chat IDs authorized to use the bot |
Create a CLAUDE.md file in the project root. This is the system prompt that defines your assistant's personality, capabilities, and instructions. It is loaded by Claude Code on every session.
touch CLAUDE.mdWrite your assistant's instructions here — role, tone, team info, tool usage, response format, etc.
The bot logs daily conversation history to conversations/ as markdown files (YYYY-MM-DD.md). Create the directory:
mkdir conversationsThese logs are used for context recall across sessions.
When users send images via Telegram, the bot saves them to images/. Create the directory:
mkdir imagesIf your assistant needs MCP tools (e.g. Telegram API access), create an mcp_config.json with your MCP server definitions.
python bot.pyAdditional settings can be configured via environment variables or in config.py:
| Setting | Default | Description |
|---|---|---|
CLAUDE_CLI_PATH |
/opt/homebrew/bin/claude |
Path to Claude Code CLI |
CLAUDE_WORKING_DIR |
Current directory | Working directory for Claude sessions |
CLAUDE_MODEL |
sonnet |
Claude model to use |
MAX_BUDGET_USD |
1.0 |
Max budget per session in USD |
SESSION_TTL_HOURS |
24 |
Session timeout in hours |
MCP_CONFIG_PATH |
./mcp_config.json |
Path to MCP server config |
POLL_TIMEOUT |
25 |
Telegram polling timeout in seconds |