Shiba Bank

How to create a Telegram bot

How to make a Telegram bot with @BotFather: the /newbot command, name and a username ending in bot, the token and how to protect it, commands, buttons and where to run the bot's code.

Updated 2026-10-02 · 5 min read

You create a Telegram bot in a chat with the official bot @BotFather: send it /newbot, give the bot a name and pick a username that ends in bot. BotFather replies with a token — the key your program uses to control the bot. Making a bot costs nothing: Telegram doesn't charge users or developers for the bot platform. But BotFather only registers the bot. For it to answer anyone, you need a program running on your computer or a server.

How to create a bot in BotFather

  1. Open @BotFather and tap Start.
  2. Send the command /newbot.
  3. Enter the bot's name — its display name.
  4. Enter the username — the bot's address, like @my_shop_bot. It must be 5–32 characters, Latin letters, digits and underscores only, and end in bot.
  5. BotFather sends you the token. The bot now exists.
Important

You can change the name later with /setname, but according to Telegram's documentation the username can't be changed after creation — choose it carefully.

The token: what it is and how to keep it safe

A token looks like digits and letters separated by a colon. Whoever has it fully controls the bot, so Telegram's advice is to store it in a secure place and share it only with people who need direct access.

  • Never put the token in public code, on GitHub or in chats.
  • If it leaks, Telegram's documentation names the /token command in BotFather for generating a new one. Then update it everywhere your program uses it.
  • The token is for bots only. api_id and api_hash are different keys for programs that sign in as a user: how to get them.

What to set up in BotFather

/mybots opens an interactive menu of settings for your bots; the same is available in the BotFather Mini App. The look of the bot can also be set with separate commands:

  • /setname — the bot's name.
  • /setdescription — the bot's description, a short text of up to 512 characters.
  • /setabouttext — the "About" info, a shorter text of up to 120 characters.
  • /setuserpic — the bot's profile picture.
  • /setcommands — the list of commands; Telegram suggests them when someone types /.
  • /setjoingroups — whether the bot can be added to groups.
  • /setprivacy — which messages the bot receives in groups.
  • /deletebot — delete the bot and release its username.

Making the bot answer

A bot is a program that talks to Telegram through the Bot API. Every request goes to https://api.telegram.org/bot<token>/METHOD. There are two ways to receive messages, and they are mutually exclusive:

  • getUpdates (long polling): your program asks Telegram for new messages. The easiest start — you don't need a public address.
  • Webhook: Telegram sends messages to your server. It needs HTTPS and one of the ports 443, 80, 88 or 8443.

You can write the code in any language that can make HTTP requests. Popular libraries include aiogram and python-telegram-bot for Python, and grammY and Telegraf for JavaScript. The official tutorial walks through a Java bot: from BotFather to "Hello World". You can run the bot on your own computer while it's switched on, or on a VPS so it works around the clock.

Buttons and commands in a bot

  • Commands are words like /start that the bot handles; the hint list is set with /setcommands.
  • Inline buttons under a message don't send text to the chat: they send the bot a press or open a link.
  • Reply keyboards show ready-made answers in place of the usual keyboard.
  • Mini Apps are full interfaces that open inside Telegram.

More in the bot features overview.

Payments in a bot

Digital goods and services in bots are paid for with Telegram Stars: the invoice uses the currency XTR, and no payment provider is needed. How to set it up is in accepting Stars in your bot; Stars the bot has collected are withdrawn through Fragment — how to withdraw Stars from a bot.

Tip

Need your program to buy Stars or Premium for its users? The Shiba Bank bot has an API for that: Telegram Stars API.

Frequently asked questions

How do I create a Telegram bot without coding?

You can register a bot in a minute through @BotFather, but to make it do anything you need code. Telegram itself notes that creating a bot takes at least some programming skills.

How much does it cost to create a Telegram bot?

Nothing: Telegram doesn't charge users or developers for the bot platform. You only pay for your own server if you host the bot there.

What is BotFather?

Telegram's official bot for creating bots and managing them: name, description, picture, commands and token.

How do I get a BotFather token?

The token arrives right after /newbot. If it leaks, the /token command in BotFather issues a new one.

What username can a bot have?

5–32 characters: Latin letters, digits and underscores, and it must end in bot, for example my_shop_bot.

How do I add buttons to a Telegram bot?

Buttons are defined in the bot's code: inline buttons under a message and reply keyboards. The command list for the / menu is set in BotFather with /setcommands.

Everything inside Telegram

Open the bot
QR code of the link to Telegram

Open in Telegram

Point your phone's camera at the code

Open in Telegram Desktop

The Shiba Bank window opens in Telegram.A chat with the bot @barboskich_stars_bot opens.Telegram will ask you to pick a group and give the bot admin rights.