- Python 3.11+ -- Download here
- Telegram Bot Token -- Get one from @BotFather
- Claude Authentication -- Choose one method below
- For source installs: Poetry
The bot uses the Claude Code Python SDK. Choose your authentication method:
Uses the SDK with your existing Claude CLI credentials.
# 1. Install Claude CLI (https://claude.ai/code)
# 2. Authenticate
claude auth login
# 3. Verify
claude auth status
# Should show: "You are authenticated"
# No ANTHROPIC_API_KEY needed — SDK uses CLI credentialsUses the SDK with a direct API key, no CLI auth needed.
# 1. Get your API key from https://console.anthropic.com/
# 2. Configure bot
ANTHROPIC_API_KEY=sk-ant-api03-your-key-hereChoose your preferred installation method:
# Using uv (recommended — installs in an isolated environment)
uv tool install git+https://github.com/RichardAtCT/claude-code-telegram@v1.3.0
# Or using pip
pip install git+https://github.com/RichardAtCT/claude-code-telegram@v1.3.0
# Track the latest stable release
pip install git+https://github.com/RichardAtCT/claude-code-telegram@latestDon't have uv? Install it with
curl -LsSf https://astral.sh/uv/install.sh | sh.
git clone https://github.com/RichardAtCT/claude-code-telegram.git
cd claude-code-telegram
make devImportant: Always install from a tagged release, not
main, for stability.
cp .env.example .env
nano .envRequired Configuration:
TELEGRAM_BOT_TOKEN=1234567890:ABC-DEF1234ghIkl-zyx57W2v1u123ew11
TELEGRAM_BOT_USERNAME=your_bot_username
APPROVED_DIRECTORY=/path/to/your/projects
ALLOWED_USERS=123456789 # Your Telegram user ID- Message @userinfobot on Telegram
- It will reply with your user ID number
- Add this number to your
ALLOWED_USERSsetting
make run-debug # Recommended for first run
make run # Production- Find your bot on Telegram (search for your bot username)
- Send
/startto begin - Try asking Claude a question about your project
- Use
/statusto check session info
The bot includes an event-driven platform for webhooks, scheduled jobs, and proactive notifications. All features are disabled by default.
Enable to receive external webhooks (GitHub, etc.) and route them through Claude:
ENABLE_API_SERVER=true
API_SERVER_PORT=8080-
Generate a webhook secret:
openssl rand -hex 32
-
Add to your
.env:GITHUB_WEBHOOK_SECRET=your-generated-secret NOTIFICATION_CHAT_IDS=123456789 # Your Telegram chat ID for notifications -
In your GitHub repository, go to Settings > Webhooks > Add webhook:
- Payload URL:
https://your-server:8080/webhooks/github - Content type:
application/json - Secret: The secret you generated
- Events: Choose which events to receive (push, pull_request, issues, etc.)
- Payload URL:
-
Test with curl:
curl -X POST http://localhost:8080/webhooks/github \ -H "Content-Type: application/json" \ -H "X-GitHub-Event: ping" \ -H "X-GitHub-Delivery: test-123" \ -H "X-Hub-Signature-256: sha256=$(echo -n '{"zen":"test"}' | openssl dgst -sha256 -hmac 'your-secret' | awk '{print $2}')" \ -d '{"zen":"test"}'
For non-GitHub providers, use Bearer token authentication:
WEBHOOK_API_SECRET=your-api-secretSend webhooks with:
curl -X POST http://localhost:8080/webhooks/custom \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-api-secret" \
-H "X-Event-Type: deployment" \
-H "X-Delivery-ID: unique-id-123" \
-d '{"status": "success", "environment": "production"}'Enable to run recurring Claude tasks on a cron schedule:
ENABLE_SCHEDULER=true
NOTIFICATION_CHAT_IDS=123456789 # Where to deliver resultsJobs are managed programmatically and persist in the SQLite database.
Enable voice message support with automatic transcription:
ENABLE_VOICE_MESSAGES=trueChoose your transcription provider:
Mistral Voxtral (default):
VOICE_PROVIDER=mistral
MISTRAL_API_KEY=your-mistral-api-keyOpenAI Whisper:
VOICE_PROVIDER=openai
OPENAI_API_KEY=your-openai-api-keyIf you installed via pip/uv, make sure voice extras are installed:
pip install "claude-code-telegram[voice]"Optionally override the transcription model with VOICE_TRANSCRIPTION_MODEL (defaults to voxtral-mini-latest for Mistral, whisper-1 for OpenAI).
Configure which Telegram chats receive proactive notifications from webhooks and scheduled jobs:
NOTIFICATION_CHAT_IDS=123456789,987654321| Feature | SDK + CLI Auth | SDK + API Key |
|---|---|---|
| Performance | Best | Best |
| CLI Required | Yes | No |
| Streaming | Yes | Yes |
# Set to a specific project directory, not your home directory
APPROVED_DIRECTORY=/Users/yourname/projects# Whitelist specific users (recommended)
ALLOWED_USERS=123456789,987654321
# Optional: Token-based authentication
ENABLE_TOKEN_AUTH=true
AUTH_TOKEN_SECRET=your-secret-key-hereRATE_LIMIT_REQUESTS=10
RATE_LIMIT_WINDOW=60
RATE_LIMIT_BURST=20
CLAUDE_MAX_COST_PER_USER=10.0DEBUG=true
DEVELOPMENT_MODE=true
LOG_LEVEL=DEBUG
ENVIRONMENT=development
RATE_LIMIT_REQUESTS=100
CLAUDE_TIMEOUT_SECONDS=600If you're running the bot on a remote Mac Mini (or any Mac accessed via SSH), Claude Code's OAuth tokens stored in the macOS keychain will be inaccessible because the keychain is locked in SSH sessions. This causes Claude invocations to fail silently or with authentication errors.
The simplest fix is to unlock the keychain before starting the bot:
make run-remoteThis prompts for your keychain password, then starts the bot in a detached tmux session that persists after SSH disconnect. Manage the session with:
make remote-attach # View logs
make remote-stop # Kill the botAdd this to your ~/.zshrc or ~/.bash_profile so the keychain unlocks automatically on SSH login:
if [ -n "$SSH_CONNECTION" ] && [ -z "$KEYCHAIN_UNLOCKED" ]; then
security unlock-keychain ~/Library/Keychains/login.keychain-db
export KEYCHAIN_UNLOCKED=true
fiBy default the keychain re-locks after a short idle period. Set it to 8 hours:
security set-keychain-settings -t 28800 ~/Library/Keychains/login.keychain-dbBypass the keychain entirely by using a direct API key (Option B in the authentication section above). Set ANTHROPIC_API_KEY in your .env and the keychain is never consulted.
# Check your bot token
echo $TELEGRAM_BOT_TOKEN
# Verify user ID (message @userinfobot)
# Check bot logs
make run-debugSDK + CLI Auth:
claude auth status
# If not authenticated: claude auth loginSDK + API Key:
# Verify key starts with: sk-ant-api03-
echo $ANTHROPIC_API_KEY# Check approved directory exists and is accessible
ls -la /path/to/your/projectsENVIRONMENT=production
DEBUG=false
LOG_LEVEL=INFO
RATE_LIMIT_REQUESTS=5
CLAUDE_MAX_COST_PER_USER=5.0
SESSION_TIMEOUT_HOURS=12
ENABLE_TELEMETRY=true- Documentation: Check the main README.md
- Configuration: See configuration.md for all options
- Security: See SECURITY.md for security concerns
- Issues: Open an issue