+ claude-code-telegram

Run Claude Code
from Telegram

A Python bot that bridges Telegram to the Claude Code CLI. Message your bot, it runs Claude on your server, streams results back. Manage your entire VPS from your phone. Inspired by @levelsio.

View on GitHub
What it looks like
claude-server-bot
online
Set up a landing page at telegram.superfun.games
On it. Setting up the site now.
✎ Write /var/www/telegram.superfun.games/index.html
✎ Write /etc/nginx/sites-available/telegram.superfun.games
💻 certbot --nginx -d telegram.superfun.games
💻 netlify-dns add superfun.games A telegram.superfun.games 65.109.173.10
Done. Site live at https://telegram.superfun.games
SSL active, DNS pointing to VPS.
That was this page btw ^

How it works

Your message takes this path:

You send a message in Telegram
Plain text, natural language. "Deploy the new feature" or "check the nginx logs"
Bot validates & authenticates
User whitelist, rate limiting, input sanitization. Only approved users get through.
Claude Code CLI spawns on your server
The bot runs claude --resume <session> -p "your message" as a subprocess with streaming JSON output.
Claude reads, writes, and executes
Full tool access: Read, Edit, Write, Bash, Glob, Grep. It can modify files, run commands, deploy sites.
Results stream back to Telegram
Real-time progress with tool icons. Session persists — pick up where you left off.

Set it up yourself

1

Create a Telegram bot

Message @BotFather on Telegram, run /newbot, and save the token it gives you.

2

Clone and configure

Pull the repo onto your server and set up the environment.

terminal
git clone https://github.com/RichardAtCT/claude-code-telegram.git
cd claude-code-telegram
cp .env.example .env

Edit .env with your bot token, your Telegram user ID, and the path to your claude CLI binary.

3

Key config in .env

.env
# Your Telegram bot token from BotFather
TELEGRAM_BOT_TOKEN=your_token_here

# Your Telegram user ID (only you can use it)
ALLOWED_USERS=your_telegram_id

# Where Claude can operate
APPROVED_DIRECTORY=/root

# Path to claude CLI binary
CLAUDE_CLI_PATH=/root/.local/bin/claude

# Use CLI mode (not SDK)
USE_SDK=false
AGENTIC_MODE=true
4

Install and run

terminal
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
python -m src.main

For production, run it as a systemd service so it survives reboots.

5

Message your bot

Open Telegram, find your bot, and start giving it instructions. It resumes sessions automatically — your conversation context persists across messages.

What you get

Persistent sessions
Sessions auto-resume per project directory. Pick up where you left off.
Real-time streaming
See tool calls as they happen. Read, Edit, Bash — all streamed live to your chat.
Security built in
User whitelist, directory sandboxing, input validation, rate limiting, full audit log.
Full Claude Code power
Same capabilities as the terminal — file ops, shell commands, web search, multi-file edits.

This page was built, deployed, and SSL'd by Claude Code — via Telegram.

Get the code on GitHub