How to Build a Telegram Bot With Claude Code in an Afternoon
To build a Telegram bot with Claude Code in an afternoon, follow the Bot in an Afternoon method, our five-step approach at Claude Code Club for going from an idea to a running bot without prior experience. In one breath: decide the one thing the bot does, get a bot token, let Claude write the handler, run it locally to test, and deploy it so it stays on. A single afternoon is genuinely enough.
A Telegram bot is just a small program that listens for messages and replies. You send it a message, it reads it, it responds. The code that does the reading and replying is called the handler, and Claude Code writes it for you. Your part is to decide what the bot should do and to test it. Everything technical, Claude handles inside the Claude desktop app.
- Decide the one thing the bot does.
- Get a bot token so Telegram knows your bot is real.
- Let Claude write the handler that reads messages and replies.
- Run it locally to test that it responds the way you want.
- Deploy it so it stays on even when your computer is off.
Step One: Decide the One Thing the Bot Does
Start by deciding the one thing your bot does. One job, said in a sentence: send me the weather every morning, reply with a random quote when I say quote, or forward every message to a group. A bot with one clear job is a bot you can finish in an afternoon. If your idea needs the word and, you are describing two bots. Pick the one that matters most and build that first.
You can always add more later. The point of the afternoon is to get one working bot end to end, from idea to running, so you learn the whole path. A tiny bot that reliably does one thing teaches you far more than an ambitious bot that never quite runs. Choose the smallest useful version of your idea.
Step Two: Get a Bot Token
Then get a bot token. Telegram has a built-in way to create a new bot inside the app itself: you message its official bot-creation assistant, give your bot a name, and it hands you a token. That token is a long string of letters and numbers that proves your bot is really yours. Copy it somewhere private. Ask Claude Code to walk you through the exact steps if you get stuck.
Treat the token like the key to your bot, because that is exactly what it is. Store it somewhere only you can see, such as a private notes file or a password manager. You will hand it to your project in a safe way in a later step, so for now the only job is to keep it out of any place that other people can read.
- Create the bot inside Telegram using its official bot-creation assistant.
- Give your bot a name and receive your token.
- Copy the token somewhere private, never in a public place.
- Do not paste the token into any public chat or repository.
Step Three and Four: Let Claude Write the Handler, Then Run It Locally
Next, let Claude write the handler. The handler is the code that listens for messages and decides how to reply, and it is the heart of your bot. Tell Claude Code your bot's one job and that you have a token, and ask it to write the handler and set up the project. Claude creates the files and explains how the pieces fit together. You do not need to write any of this code yourself.
Then run it locally to test. Running locally means the bot runs on your own computer for now, so you can message it and see if it replies correctly. Ask Claude Code to start the bot and tell you exactly what to do. Open Telegram, message your bot, and watch it respond. If the reply is wrong, describe the problem to Claude and it adjusts the handler. Test until it behaves.
- Give Claude your bot's one job and confirm your token is stored privately.
- Ask Claude to write the handler and set up the project.
- Run the bot locally with Claude's guidance.
- Message your bot in Telegram and check its replies.
- Describe any wrong behavior to Claude and refine the handler.
Step Five: Deploy It So It Stays On
Finally, deploy it so it stays on. When your bot runs locally, it only works while your computer is on and awake. Deploying means putting it somewhere that runs around the clock, so your bot is always ready to reply. Ask Claude Code to recommend a simple hosting option for a small bot and to walk you through putting it there. Keep your token in the private settings of that host, never in the code.
Once deployed, message your bot again to confirm it still works from its new home. Now you can close your laptop and the bot keeps running. That is the full Bot in an Afternoon: decide the one thing, get a token, let Claude write the handler, run it locally, and deploy it. You started the afternoon with an idea and ended it with a working bot.
- Ask Claude to recommend a simple hosting option for a small bot.
- Store your token in the host's private settings, not in the code.
- Deploy the bot with Claude's step-by-step guidance.
- Message the bot again to confirm it runs from its new home.
When your bot is live, come share it in the Claude Code Club community and tell us the one job it does. Someone will want to build the same thing, and your afternoon becomes their starting point. If you hit a wall on tokens or deployment, ask in the community and we will get you unstuck. ⚡
Frequently asked questions
What is the Bot in an Afternoon method?
The Bot in an Afternoon is a five-step Claude Code Club method for building a Telegram bot: decide the one thing the bot does, get a bot token, let Claude write the handler, run it locally to test, and deploy it so it stays on. It is designed so a beginner can go from idea to a running bot in a single afternoon.
Do I need coding experience to build a Telegram bot with Claude Code?
No. You decide what the bot does and Claude Code writes the handler and sets up the project for you. Your job is to describe the one job, test the bot in Telegram, and keep your token private.
What is a bot token and where do I get one?
A bot token is a long string that proves a bot belongs to you, and it works like a password for your bot. You get one inside Telegram by messaging its official bot-creation assistant, naming your bot, and receiving the token. Store it somewhere private and never share it.
How do I keep my bot token safe?
Never paste your token into a public chat, a public repository, or anything others can see, because anyone with it can control your bot. Ask Claude Code to store it in an environment file separate from the code, and keep it out of screenshots. If it ever leaks, issue a new token from Telegram's bot assistant.
What does it mean to run the bot locally?
Running locally means the bot runs on your own computer while you test it, so you can message it and confirm it replies correctly. It only works while your computer is on. Once it behaves the way you want, you deploy it so it runs around the clock.
Why do I need to deploy the bot?
A bot running locally stops the moment your computer sleeps or shuts down. Deploying it means putting it on a host that runs continuously, so your bot is always ready to reply. Ask Claude Code to recommend a simple hosting option and to store your token in the host's private settings.
Last reviewed by David Iya on July 4, 2026


