Telegram Bot Creator

A Telegram bot is an account run by your code instead of a person: you create it for free with @BotFather, and your program answers its messages through the Telegram Bot API. This creator walks you through BotFather, checks your username and token, finds your chat ID, and gives you ready-to-run Python or Node.js code.

Step 1: Create the bot in BotFather

  1. 1

    Open BotFather

    In Telegram, open @BotFather (look for the blue verified check) and tap Start.

    Open @BotFather
  2. 2

    Send /newbot

    BotFather asks for a display name first. This is what people see in chats, and it can be anything, like Weather Helper.

  3. 3

    Pick a username

    Next comes the username people search for. It must end in bot. Check yours below before you send it; BotFather tells you if it is already taken.

  4. 4

    Copy the token

    BotFather replies with a token like 123456789:AAH... It is the bot's password. Paste it into your .env file and the checker below, and nowhere else.

  5. 5

    Polish the profile

    Optional: /setdescription (shown before someone starts the bot), /setabouttext (profile bio), /setuserpic (photo) and /setcommands (the / menu).

  6. 6

    Run the starter code

    Download the files below, paste the token into .env, and start the bot. Then open your bot in Telegram and send /start.

Step 2: Check your bot token

Your browser sends the token straight to api.telegram.org to call getMe. It is never sent to NitroClaw or saved, and it is cleared when you leave the page.

Anyone with your token controls your bot. Never commit it or post it in a chat. If it leaks, send /revoke to BotFather to get a new one.

Step 3: Build your command menu

These show up when people type / in your bot's chat. The starter code sets them for you, or paste the list into BotFather after /setcommands.

start - Start the bot
help - Show what this bot can do

Step 4: Run the starter code

An echo bot with /start, /help and your commands. Replace the echo handler with your own logic. Uses python-telegram-bot 22, Python 3.10+.

import os

from dotenv import load_dotenv
from telegram import BotCommand, Update
from telegram.ext import Application, ApplicationBuilder, CommandHandler, ContextTypes, MessageHandler, filters

load_dotenv()

COMMANDS = [
    BotCommand("start", "Start the bot"),
    BotCommand("help", "Show what this bot can do"),
]


async def start(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
    name = update.effective_user.first_name if update.effective_user else "there"
    await update.message.reply_text(f"Hi {name}! Send me any message and I will echo it back. Try /help.")


async def help_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
    await update.message.reply_text("/start - Start the bot\n/help - Show what this bot can do")


# Anything that is not a command gets echoed. Replace this with your own logic, such as an AI reply.
async def echo(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
    await update.message.reply_text(update.message.text)


async def set_menu(app: Application) -> None:
    # Fills the menu users see when they type / (the same as /setcommands in BotFather).
    await app.bot.set_my_commands(COMMANDS)


def main() -> None:
    app = ApplicationBuilder().token(os.environ["TELEGRAM_BOT_TOKEN"]).post_init(set_menu).build()
    app.add_handler(CommandHandler("start", start))
    app.add_handler(CommandHandler("help", help_command))
    app.add_handler(MessageHandler(filters.TEXT & ~filters.COMMAND, echo))
    # Long polling: the bot asks Telegram for new messages, so it works on your laptop with no public URL.
    print("Bot is running. Press Ctrl+C to stop.")
    app.run_polling(allowed_updates=Update.ALL_TYPES)


if __name__ == "__main__":
    main()
cp .env.example .env   # then paste your token into .env
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
python bot.py

Save the files in one folder. Browsers may save .env.example and .gitignore without the leading dot; rename them if so.

Polling or webhook?

Long polling

Your bot keeps asking Telegram for new messages. It works on a laptop or any server with no public URL or HTTPS certificate, which makes it the easiest way to start. The starter code uses it.

Webhook

Telegram sends each new message to an HTTPS URL you register with setWebhook. It suits serverless hosting and busy bots, but needs a public HTTPS endpoint. A bot uses one or the other: while a webhook is set, polling fails with a 409 error until you call deleteWebhook.

Troubleshooting

The bot does not answer at all

Make sure the script is still running and printed that it is online. Run the token checker: if it shows a webhook URL, polling cannot receive messages, so remove the webhook or run your webhook server instead.

Error 401 Unauthorized

The token is wrong or was revoked. Copy it again from BotFather with /token, or make a new one with /revoke, and update .env.

Error 409 Conflict

Two copies of the bot are polling with the same token, or a webhook is set. Stop the other copy (an old terminal, a server or a hosting service), or delete the webhook.

The bot ignores normal messages in a group

Privacy mode is on by default, so in groups the bot only sees commands, replies to its own messages and mentions. Turn it off with /setprivacy in BotFather, then remove the bot from the group and add it again.

The / command menu is empty

The starter code fills the menu each time it starts. You can also paste the command list from this page into BotFather after /setcommands. Telegram apps can take a moment to refresh it.

I cannot find my chat ID

Send your bot a message first, then use the chat ID finder. Telegram keeps undelivered updates for 24 hours, and the finder cannot read them while a webhook is set or another copy of the bot is consuming them.

Checked against the Telegram Bot API, python-telegram-bot 22.8 and grammY 1.46 on November 16, 2026. Sources: Telegram bot features (BotFather), Telegram Bot API, python-telegram-bot, grammY. Not affiliated with Telegram.

Telegram bot FAQ

How do I make a Telegram bot?

Open @BotFather in Telegram, send /newbot, choose a display name and a username that ends in bot, and copy the token it gives you. Then run bot code, such as a Python python-telegram-bot or Node.js grammY script, that uses the token to receive and answer messages.

Is a Telegram bot free?

Yes. Creating a bot with BotFather and using the Telegram Bot API is free. The only cost is somewhere to run the code: your own computer works while it is on, and a server or hosting service keeps the bot online all the time.

Can a Telegram bot message me first?

No. A bot can only message a user after that user has started it by tapping Start or sending /start. In groups and channels, the bot can post once it has been added, and in channels it must be an admin.

Why is my Telegram bot not responding?

Usually the bot script is not running, the token is wrong or revoked, a webhook is set while the code uses polling, or two copies are running with the same token. In groups, privacy mode also hides normal messages from bots. The token checker on this page shows the bot's identity and webhook status.

How do I make my Telegram bot an AI assistant?

Replace the echo handler in the starter code with a call to an AI model and reply with its answer. You will also need to keep conversation history, limit who can use it, and keep the bot online. NitroClaw does all of this for you with a hosted AI assistant that connects to Telegram.

Related free tools

Skip the code: get an AI assistant on Telegram in 2 minutes

NitroClaw hosts a dedicated OpenClaw AI assistant that chats with you on Telegram, with no server to keep online.

Explore NitroClaw