Clear, practical technology insights BSOD Code Lookup · Windows Error Code Lookup · Wi-Fi Troubleshooting · PC Troubleshooting Checklist

How to Create and Configure a Telegram Bot With BotFather

Create a Telegram bot account with BotFather, secure its API token, customize its profile and commands, and test the Bot API correctly.

Table of Contents

BotFather is Telegram's official tool for creating bot accounts and managing their names, descriptions, commands, and API tokens. Creating the account does not make the bot respond automatically: you still need a program or bot-building service that uses the Telegram Bot API.

Create a bot with BotFather

  1. In Telegram, search for @BotFather and open the verified account. Check the username carefully to avoid impersonators.

Finding the verified BotFather account in Telegram

  1. Send /start, then select or send /newbot.

Starting bot creation with BotFather

  1. Enter the display name people will see.

Entering a display name for a Telegram bot

  1. Choose a unique username that ends in bot, such as ExampleSupportBot.
  2. BotFather confirms the account and sends an API token. Store the token in a password manager or secret store; do not paste it into public code, screenshots, or chat messages.

BotFather confirmation and API token

Customize the bot's profile

Send /mybots to BotFather and select the new bot.

Selecting a bot from the BotFather bot list

Choose Edit Bot to change its profile information.

Opening Edit Bot in BotFather

Use the available options to set a display name, description, short About text, and profile picture. Make the description explain what the bot does and what users should send it.

Changing a Telegram bot name

Adding a Telegram bot description

Add a command menu

Use /setcommands, choose the bot, and send one command per line in this format:

start - Start the bot
help - Show available help
settings - Change preferences

The menu describes commands to users; it does not implement them. Your bot code must receive each command and send the appropriate response.

Retrieve or replace the API token

Open /mybots, select the bot, and choose API Token to view or regenerate its token. In a token such as 123456789:AAExample, the numeric part before the colon corresponds to the bot's user ID, but applications should rely on the API response rather than parsing secrets unnecessarily.

Viewing the Telegram bot API token in BotFather

If a token is exposed, revoke it immediately in BotFather and update the application with the replacement. The old token will stop working.

Test the bot token with getMe

Open the bot chat and tap Start. The profile should display the description you configured.

Opening the new Telegram bot's chat

To verify a token from a terminal without putting it in browser history, use an environment variable and the Bot API's getMe method:

curl "https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/getMe"

A valid token returns JSON with "ok": true and the bot's account information. Never publish the command with the real token. Telegram's Bot API documentation explains the response fields.

Connect code before expecting replies

A newly created bot account will not answer messages until an application processes updates. Developers can use long polling with getUpdates for a simple test or configure a secure HTTPS webhook for a deployed service. Do not run both update methods simultaneously.

Before adding the bot to a group, review its privacy-mode and administrator permissions. Grant only the permissions required for its function, validate all user input, and avoid logging message content or identifiers unless necessary.

Useful BotFather management commands

  • /mybots: open the bots you control;
  • /setdescription: set the profile description;
  • /setcommands: define the command menu;
  • /revoke: invalidate the current token and issue another;
  • /deletebot: permanently remove the bot account.
Discussion

Reader Comments 0

Sign in with email or Google to join the discussion.