How to use Claude Code from Telegram
Claude Code Web runs in the cloud, so it doesn't need your laptop. With a Telegram bot in front of it, you can reach it from any phone, in a DM or in a group chat. Here's how to set it up in about 5 minutes.
💬 Why Telegram?
Claude Code Web already runs without your computer. What’s missing is a quick way to reach it from wherever you are, and a way to bring other people into the conversation. Telegram covers both:
It’s on your phone
Send a task from the bus, and read the answer later.
Groups
Add Claude to a group chat and your team or friends can ask it things too.
Topics
In a forum group, every topic gets its own Claude session. That’s an easy way to keep separate projects apart.
Other bots
Claude can work with other agents in the same group, like a GrokBot that generates images.
Switchboard is the open-source relay that connects the two. It runs inside Claude Code Web itself, so there’s no server to rent or keep running.
🧰 What you need
- A Claude account with access to Claude Code Web
- A Telegram account
- About 5 minutes
📋 Step 1: Paste the setup line
Open a new session at claude.ai/code and paste:
Set up https://github.com/useswitchboard/switchboard/blob/main/SETUP.md
Claude reads the setup guide and walks you through the rest, one step at a time. The recommended setup is a new cloud environment for the bot, a Haiku router and Opus for the chats.
🤖 Step 2: Make a Telegram bot
Claude asks whether you want a new bot. For a new one:
- Open @BotFather in Telegram and send
/newbot. - Pick a name, then a username that ends in
bot. - Keep the token in BotFather. Don’t paste it into the chat.
- Send
/setprivacy, pick your bot and choose Disable. Without this, the bot doesn’t see @mentions in groups.
Then tell Claude the bot’s username.
🔑 Step 3: Save the token
Claude creates a cloud environment named after your bot, with network access to api.telegram.org. You put the token in yourself:
- Open Claude Code settings → Cloud environments → edit the new environment.
- Under Environment variables, replace
REPLACE_WITH_BOT_TOKENwith your token. Use Environment variables, not Network secrets, and don’t turn on the Telegram plugin there. - Save, and tell Claude.
The token lives only in the environment. The sessions that answer your messages never see it.
🚀 Step 4: Start the router
The router is the session that holds the Telegram connection and opens a session for each chat. You start it yourself, so it can create chat sessions without asking you each time. Claude gives you the prompt and the settings, or a ready-to-start task card:
- Model: Haiku. The router only follows instructions printed by code, so a small model is enough and uses fewer tokens.
- Repo: switchboard.
- Environment: your bot’s environment.
- Permissions: Auto.
If the router asks to approve telegram-relay, approve it once.
When it’s running, Claude tells you.
👑 Step 5: Claim your bot
DM your bot /start before you share its username. The first person to DM it becomes its owner, and only the owner can DM it.
That’s it. Say hi, and you’re talking to Claude Code.
💡 Tips
/new
starts a fresh session for the chat. Use it when you switch to an unrelated task.
/stop
, or the Stop button under “Thinking…”, cancels the current task.
Approvals
Claude can post Approve / Deny buttons before a risky step. Only you can tap them.
Keep the router running
Archiving the router session stops the bot. Chat sessions are tagged telegram, so they’re easy to find in your list.
Groups
Add the bot to a group and @mention it there. To have it join in without being mentioned, send /mode smart in the group. That uses more tokens.
💸 What it costs
Switchboard is free and open source. Claude usage counts toward your own Claude plan: the router on Haiku, and one Opus session per chat by default.
📝 More from the blog
- How to put several AI agents in one Telegram groupMake AI agents work together in a Telegram group. Claude Code asks GrokBot for an image, and your friends' agents join in. A guide to bot-to-bot chats with Switchboard, with loop guards.
- Share one AI agent with your family on TelegramGive your whole household one AI assistant in a Telegram group. Everyone can ask it things, and it remembers the shopping list for all of you. How to set it up with Switchboard.