How to Create and Configure a Telegram Bot in a few minutes?

Updated: May 7

Create a new bot, get the token, and get ready in a few mins⚡

The practical commands of Telegram @BotFather.

A bot is a program that automatically executes repetitive tasks through commands or functions, which may or not be received from the outside, i.e., it is capable of interaction changing its state in response.

Telegram has an important feature that gives you the possibility to use bots as an automated users to answer questions, play games, watch movies, listen to music, and more…

You can use these bots on your own, create and customize them with the help of The Bot Father:



How do I create a bot?

To enter into the bot world, it is necessary to define:

  • Service

  • The Req’s

  • Idea or functionality

  • Language/Framework

  • And the Telegram API.

After that, the first step is to search inside Telegram App for @BotFather user, and start it:

We will see a list of BotFather commands, choose /newbot to create our bot.

You can also find the list at or using the command: bots.setBotCommands.

To configure, we first need to assign a name and a username. This last will be compared to all bots because it must be unique (you can optionally add an image, description, color, ...). And then, Telegram will give you an authorization token to implement the Bot API so you will need to copy and save it in a safe place.

Visit to find a bots list grouped by programming language, which currently works as templates for new projects. In the next example, we will try a simple one: Telegraf.

There are the steps:

If there is an error with the player, you can watch the video at the following LINK.

How do I code a bot?

Let's add Telegraf to our new empty project. On the telegraf GitHub documentation, we find the installation guide.

npm install telegraf

The package.json file should be the telegraf dependence over version 3.*. In this same file, we add the script starts:

“scripts”: {
    “start”: “node app.js”

With this, the bot starts listening for commands and launching. Copy the following example and paste it on the app.js file:

const { Telegraf } = require('telegraf')
const bot = new Telegraf(BOT_TOKEN)
bot.start((ctx) => ctx.reply('Welcome')) => ctx.reply('Send me a sticker'))
bot.on('sticker', (ctx) => ctx.reply('👍'))
bot.hears('hi', (ctx) => ctx.reply('Hey there'))

Also, add the bot token:

const BOT_TOKEN = '2017624392:AAHnTbFHAwDYMspPO8PAlaCvm...'

Now in the telegram search bar look for Melt Test bot and test if it’s working properly.

Understanding what we did, the commands in app.js are built-in Telegraf, and the telegram API so its operation is easily implemented just by installing and importing.

If there is an error with the player, you can watch the video at the following LINK.

Global commands

The remaining commands are pretty self-explanatory:

  • bot.start, /start Begins interaction with the user, and can reply to a message: ctx.reply('Welcome')

  •, /help Returns a help message, a list of commands, or a short text: ctx.reply('Send me a sticker')

  • bot.on Request action and it is used to give light answers.

  • bot.hears In case of, and given by conditions, one or more depending on the request.

Edit bots

  • setname Change your bot's name.

  • setdescription Change the bot's description, a short text of up to 512 characters, describing your bot.

  • setabouttext Change the bot's about info, an even shorter text of up to 120 characters.

  • setuserpic Change the bot's profile pictures. It's always nice to put a face to a name.

  • setcommands Change the list of commands supported by your bot. Users will see these commands as suggestions when they type / in the chat with your bot. Each command has a name that must start with a slash ‘/’, with no more than 32 chars, and is case-insensitive.

  • deletebot Delete your bot and free its username.

Edit settings

  • setinline Toggle inline mode for your bot.

  • setinlinegeo Request location data to provide location-based inline results.

  • setjoingroups Toggle whether your bot can be added to groups or not, and process private messages.

  • setprivacy Set which messages your bot will receive when added to a group. With privacy mode disabled, the bot will receive all messages. We recommend leaving privacy mode enabled. You will need to re-add the bot to existing groups for this change to take effect.

If there is an error with the player, you can watch the video at the following LINK.

Advantages of using a Telegram Bot

  • Inline mode: Users can interact with your bot via inline queries straight from the text input field in any chat, then the bot can return some results.

  • Payment platform: Works to accept payments from Telegram users:

  1. Create invoices that can be forwarded.

  2. Send invoices to any chat, groups, and channels.

  3. Allow tips from users with preset and custom amounts.

  4. Accept payments from users on mobile or desktop apps.

  5. You can try @ShopBot to create a test invoice...

  • Gaming platform: Bots can offer their users HTML5 games to play solo or to compete in groups or one-on-one chats.

Also, the platform allows your bot to keep track of high scores for every game played in every chat. The games can be anything from simple arcades and puzzles to multiplayer 3D-shooters or real-time strategy games. Check out the @gamee bot for more info.

Commands to Manage Games

  1. newgame — create a new game.

  2. listgames — get a list of your games.

  3. editgame — edit a game.

  4. deletegame — delete an existing game.

  • Keyboards: Sometimes you want a custom keyboard with predefined reply options (see ReplyKeyboardMarkup). Telegram currently supports text and emoji for your buttons.

Inline keyboards support buttons that work behind the scenes: callback buttons, URL buttons, and switch to inline buttons, like @music, URL button, @vote, @like...

That's it for the introduction, we hope you liked it!


¡Thanks for reading!

📍 Connect with us on instagram👇


Join our newsletter to receive information about latest technologies trends and job offers

Thanks for subscribing!