Text Your AI From Anywhere: A Telegram Bridge to Claude
You're on a bike ride. You have an idea. "Pull this week's invoices from Zoho, see which are over 30 days, draft follow-ups for each and remind me to review them when I get home in 20 minutes."
If your AI lives on your laptop, that idea dies at the end of your driveway. Unless you build it a phone number.
A few weeks ago I wired Claude into a Telegram bot. Now my AI assistant — same vault, same memory, same connections to my email and CRM and calendar — is in my pocket. I text it from anywhere. It works while I'm gone. When I get home it's already done.
Here's how to build the whole thing.
What you're actually building
Three pieces:
- A dedicated machine that's always on. A Mac mini stashed somewhere in your house works great. It runs Claude Code and keeps your bot alive 24/7.
- A Telegram bot. It's just a chat. You text the bot, it forwards the message to Claude on the always-on machine, Claude does the work, and texts you back.
- A persistent Claude session. Every message you send continues the same conversation — so your AI remembers what you talked about yesterday, what's in your vault, what's on your calendar.
The result: a persistent assistant you can text like a person.
What you'll need
- A Mac (mini, laptop, whatever) you can leave running. I use a Mac mini sitting on a shelf.
- Claude Code installed and logged in. (Covered in this post.)
- A Telegram account.
- About an hour. Most of it is waiting on installs.
You do not need to be a developer. Below, you'll find prompts you can paste into Claude on the machine itself, and Claude will walk you through each step.
Step 1: Pick your always-on machine
Two options:
- Use the Mac you already have. Fine for testing. Annoying long-term because you'll close the lid and the bot dies.
- Get a dedicated Mac mini. Even an old refurbished one works. Set it on a shelf, plug it in, never touch it again.
I went with a Mac mini. It's around $600 used, draws barely any power, and lives behind my TV.
You don't need a monitor for it long-term — once it's set up, you'll screen-share from your laptop when you need to. (Search "Mac headless setup" if you want to skip the keyboard/mouse step.)
Step 2: Keep the machine awake forever
This is the part most people get wrong. macOS will sleep eventually no matter what you do unless you tell it not to.
Install Amphetamine (free, from the Mac App Store). Open it, click "Start New Session → Indefinite." Done. Your machine will never sleep again until you tell it to.
Also: System Settings → Lock Screen → Turn display off after: 5 min. Never put computer to sleep: ON.
You want this thing alive even if your power flickers.
Step 3: Create your Telegram bot
This part is fast and visual, no command line needed.
- Open Telegram, search for @BotFather.
- Send /newbot. Pick a name (anything) and a username (must end in
bot). - BotFather replies with a bot token — a long string starting with numbers. Copy and save it somewhere safe. This is your bot's password.
Step 4: Get your Telegram user ID
This is so the bot only listens to you — not random people who find it.
- In Telegram, search for @userinfobot.
- Send any message. It replies with your numeric user ID. Copy it.
Step 5: Wire up the bridge
This is where you save 90% of the time by handing the work to Claude itself.
On your always-on Mac, open Terminal and start a Claude session in your home folder. Then paste this prompt:
I want to build a Telegram bot in Python that pipes incoming messages to my Claude CLI and posts the responses back. The bot should:
1. Live in a folder I'll call
~/Code/AI-Bot/telegram/2. Use python-telegram-bot for the Telegram side 3. For each incoming message, spawnclaude --print --output-format json --resume <session_id>against my vault folder (I'll tell you the path) 4. Persist session IDs to astate.jsonfile so the conversation continues across restarts 5. Only accept messages from a Telegram user ID I configure 6. Load my bot token and user ID from a.envfileWalk me through it one step at a time. Stop and wait for me at each step.
Claude will write the bot, create the Python virtual environment, install dependencies, and set up your .env file. Have your bot token and Telegram user ID ready to paste in.
Test it: run the bot in the terminal, message your bot in Telegram, and confirm it replies. If it does, you've already got the core working.
Step 6: Run the bot as a background service
You don't want to leave a terminal window open forever. Tell macOS to run the bot in the background, auto-start it at login, and restart it if it crashes.
Paste this prompt into the same Claude session:
Set up the Telegram bot from Step 5 as a launchd service on macOS so it auto-starts at login and auto-restarts on crash. Walk me through:
1. Writing the .plist file 2. Copying it to
~/Library/LaunchAgents/3. Loading it with launchctl 4. Where to find the logs so I can troubleshoot
After that, you can close the terminal, reboot the Mac, walk away. The bot stays up.
Step 7: (Optional but recommended) tmux for live attach
Here's a trick: sometimes you want to take over the conversation from your laptop. You're texting back and forth from the bike, you get home, you want to see the full thread on a big screen and keep going.
Run your Claude session inside tmux on the always-on Mac. Then from any other machine, SSH in and tmux attach to pick up exactly where you left off.
Paste this prompt:
I want to run my Claude session inside a persistent tmux session named
dexon this Mac. Set it up so I can SSH from my laptop andtmux attach -t dexto take over the live conversation. Cover installing tmux, starting the session, enabling SSH on this Mac, and the attach command I'll use from my laptop.
Now your AI is in your pocket and on every screen you own.
Lock it down
Your bot can do anything Claude can do — which means anything you've connected via MCPs. Treat it accordingly:
- Auth gate: only your Telegram user ID gets a response. Step 5's prompt handled this — verify it.
- Permission mode: keep your vault's
.claude/settings.jsonset to ask for sensitive write actions (sending emails, posting to Slack, moving money). The bot runs non-interactively, so ask becomes a soft deny — the bot tells you "I tried to send this email but it needs approval; tap the laptop to confirm." Safer than auto-yes. - Don't share the bot token. Treat it like a password. If it leaks, regenerate via BotFather.
What it feels like to actually use this
A few months in:
- I draft client follow-ups from the airport
- I have my bot respond to slacks and emails and setup appointments for me
- I capture ideas straight into my vault without breaking stride
- I tell it to summarize my Gmail backlog by sender during errands
- I architect projects out loud during workouts and read the writeup later
The bottleneck used to be "am I at my desk." Now it's just "do I have a thought."
If you'd rather have one built for you
This is the kind of thing I build for executives — your tools, your voice, in your pocket. If you want a similar setup wired into your stack — your email, your CRM, your calendar — that's literally Executive AI Coaching. Start with a One Hour AI Setup if you're not sure where to begin and we'll figure it out together.
Newsletter
AI Tips for Small Business
Practical automations, Notion strategies, and AI tools — straight to your inbox.
Work With Me
Ready to Automate Your Business?
Free assessment call. Find out where you're losing time or could be generating more revenue.
Book a Free Assessment Call →