Configure Telegram Bot  Step by Step Guide ▷ 2021

To configure a chatbot on Telegram and learn to use all the Botfather commands, it will be necessary that you continue reading until the end. We recommend that you pay attention to every detail.

The first thing you will see is how to set up a Bot with Botfather to get the token and thus be able to integrate it with the Telegram Bots API. You will also be able to know the steps to configure the username and change the profile photo of the Bot.

But this is not all you will find we have prepared a list with all the alternative tools to Botfather to program your own chatbot. Let’s get started.

Learn step by step how to configure your Bot in Telegram’s Botfather like an expert

To configure your first Bot in Telegram Messenger you will need to work with the Telegram Bot API. This is a platform that contains the processes and protocols that interact between the messaging programming codes and the software you want to create. For this Botfather is used, which is a Bot that belongs to Telegram and that controls all the robots that work within the courier.

For this reason, we will show you below the step by step that you must do to avoid making mistakes and successfully configure your Bot in the Botfather:

Generate Token

Generate Token

The token is a code that you can obtain from the Botfather to access the Telegram Bot API. In this way you will be able to integrate both platforms (Telegram and your Bot) so that they interact correctly within the messaging. You must bear in mind that the token is a number that you must save and not share with anyone, since anyone who has access to this code You can have control of your Bot.

To obtain the token of your Bot follow this process:

  • The first thing you should do is open Telegram and go to the upper left column of the screen. Inside the search bar writes Botfather and click on the first option that appears in the list of results.
  • The previous step for you to enter the interface of Botfather, so you will be in a position to use its commands. The first thing you are going to have to do Is to write /newbot, since this command indicates that you want to create a new button.
  • You will have to choose a name that is not in use. When approved, Botfather will send you a message congratulating you on your new Bot. It will also include the link to find the Bot and the description will appear. “Use this token to access the HTTP API:”, so you must copy the token and keep it in a safe place.

Configure bot username

Once you enter Botfather and you write /newbot The token will appear and the options will be enabled so that you can choose the name of your Bot. You must bear in mind that the name is different from the robot’s username, since the latter must contain the word Bot between the 32 characters.

Therefore, the process that you should do is the following:

  • Sign in to the writing pad and choose the command /setname.
  • Then, the Bot will tell you to choose a name to change the one you already have. As in this case it is the first time that you are going to enter the name, you will have to write the one that suits you best. You must be careful because you have to choose some denomination that is not in use.
  • Once you have done the job correctly, you must send it by pressing the icon located at the end of the writing pad.

Change bot profile photo

Change bot profile photo

To add a profile photo you will have to enter Botfather and follow this guide:

  • Write the command /setuserpic. This will bring up the writing menu and you can click on the clip icon on the left.
  • Then, the image browser will open for you to choose a file from a photo.
  • When you have chosen it, you will have to press on To accept. If you did these steps correctly, the Bot will accept your image and you will already have the Bot’s profile photo configured.

Set bot description

The description of the Bot is the definition of tasks that the Bot can perform. This legend will appear before the user joins or activates the Bot once they find it on Telegram. Within the description it is possible to include web page links to explain any additional information in greater detail.

To add the description, do this step by step:

  • Login Botfather.
  • Head the bottom of the screen and writes /setdescription.
  • After that, the program will ask you what the Bot you are creating can do.
  • Write the whole description which corresponds and then press Send.

List of all Botfather commands you need to know to create your Bot like a Telegram guru

List of all Botfather commands you need to know to create your Bot like a Telegram guru

So far we have shown four commands you have available to run in Botfather, but these are not the only actions you can do within this graphical interface of the Telegram API.

For this reason, we will show you below all the commands that you have available in the Botfather:

  • /newbot: We already mentioned a little what this command is for, it is an execution that is used to add a new Bot to the Telegram platform. This means that every time you want to incorporate a new robot through the Botfather, you must start with this command.
  • /mybots: It is a Beta version that serves to modify some aspects of the Bot that you already created.
  • /setname: If you want enter the robot’s name for the first time or you want to change it, you must use this tool.
  • /setdescription: As with the previous command, this command it is used every time you want to modify the description of the tasks that the Bot performs. You should also use it when you want to enter the description for the first time.
  • /setabouttext: This command you can choose when you need edit some text parameter of the Bot.
  • /setuserpic: As we mentioned before, this command is used to add or modify a profile photo of the Telegram robot.
  • /setcommands: If what you are looking for is change the command list of your Bot, then you must use this item to work with the Botfather.
  • /deletebot: If for any reason you want to delete the Bot you created, then you will have to choose this command so that it disappears from Telegram.
  • /token: When you use this command you are going to generate an authorization for the use of the token.
  • /revoke: In case you want revoke access to the Bot’s token, you’re going to have to use this command inside the Botfather.
  • /setinline: With this command you will be able to modify the status of online queries of the Bot.
  • /setinlinegeo: This command will help you change the configuration that the Bot has of the online location request.
  • /setinlinefeedback: Thanks to this Botfather tool you will be able to edit all comment settings online from the Bot.
  • /setjoingroups: When you need change the configuration of the possibility of including the Bot within groups, you will have to choose this command to carry out the task.
  • /setprivacy: This Botfather tool will help you to choose if the people who interact with the Bot will be able to receive messages that start with the slash (/) or the Bot can recognize all the conversations that enter the group to which it belongs.
  • /mygames: You can use these commands to edit a games button.
  • /newgame: In order to create a Game Bot, you will need to choose this command to start the process.
  • /listgames: With this tool you can list all the games you have created so far within the Bot.
  • /editgame: It will help you modify some aspects of the Game Bot.
  • /deletegame: If what you are looking for is remove a game from the Bot, then you must use this command within the Botfather.

Learn about the best tools other than Botfather to create and configure a Telegram Bot from scratch

Besides Botfather, you can use other platforms to create your own Bot. Therefore, we will show you below a list with the best tools that you can use to create and configure a Bot in Telegram from scratch and without making mistakes.

Go for it:

@Manybot

Manybot

This is one of the most used tools within Telegram. It is a Bot that will help you create your own program for you to use within the platform. Its use is very simple, you just have to look for it and then go to Botfather to obtain the token and in this way interact with the Telegram Bot API.

Next, you must paste the verification code and choose the button I have copied the API token. After this, you can start with the commands You will find them in Spanish to configure all the actions that your Bot can perform.

Rebot.me

With this tool you can create online a bot to add it to your Telegram account. To do this you must enter their website and then click on the button Create chatbot. The platform will take you to register with your Google username so you can start using the necessary commands.

@Come_Creare_un_Bot

This tool is in Italian and your username is @Come_Creare_un_bot, so you will have to look for it within the Telegram platform to start creating your own Bot. Its commands are quite easy to understand, since you will have to comply Step by Step each component of the configuration.

Micronaut.io

Micronaut framework

This portal it will help you with the basic structure of programming a Bot for Telegram. You can choose a free or paid version to access more tools. To use this framework you will have to enter with your browser and then choose the button LAUNCH, located in the upper right corner of the screen.

Then you can choose the programming language and other aspects that will help you to manage the creation of the Bot more easily. It is important that you have some programming knowledge.

Linux

This operating system will help you create your own Telegram Bot using Python. While this option is for slightly more advanced users, you will have no problem creating your own robot by following these instructions. The first thing you should do is enter the terminal and get a repository of the Telegram Bot.

Then you will have to get an additional dependency, so you will have to write:

  • sudo apt install python3-requests
  • sudo apt install python3-future
  • sudo apt install python3-certifi

After this you must make Bot a library to send messages in HTML format:

class IpapBot(Bot):

def __init__(self, token=None, channel_id=None):

if token is None or channel_id is None:

configuration = Configuration()

token = configuration.get('token')

channel_id = configuration.get('channel_id')

__init__(self, token)

channel_id = channel_id

def send_message(self, text):

super(IpapBot, self).send_message(chat_id=self.channel_id,

text=text,

parse_mode=ParseMode.HTML)

Finally, you must install the Bot as follows:

ipapbot -h

Usage: ipapbot [options] arg

Options:

-h, --help show this help message and exit

-c CHANNEL_ID, --set-channel-id=CHANNEL_ID

set channel id where bot will send messages

-m MESSAGE, --message=MESSAGE

send a message to the channel

-p, --print-config Print configuration

-t TOKEN, --set-token=TOKEN

set the TOKEN of the bot

In this way you can add commands to have different services, according to your needs.

Therefore, you will have to configure ipapbot so that the administrator can work:

  • sudo ipapbot -c 1234567 -t XXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXX

Inside the message_start.service file you must copy:

[Unit]

Description=Message for start

[Service]

Type=oneshot

RemainAfterExit=false

ExecStart=/usr/bin/python3 /usr/bin/ipapbot -m "Iniciando"

[Install]

WantedBy=multi-user.target

In the message_stop.service file enter:

[Unit]

Description=Message for stop

[Service]

Type=oneshot

RemainAfterExit=true

ExecStart=/bin/true

ExecStop=/usr/bin/python3 /usr/bin/ipapbot -m "Apagado"

[Install]

WantedBy=multi-user.target

In this way you can choose that the Bot warns you when your computer turns on and off:

sudo systemctl enable message_start

sudo systemctl enable message_stop

sudo systemctl disable message_start

sudo systemctl disable message_stop

sudo systemctl is-enabled message_start

sudo systemctl is-enabled message_stop

If you have any questions, leave them in the comments, we will answer you as soon as possible, and it will also be of great help to more members of the community. Thanks! 😉

Author: Félix Albornoz

I have been working in the technology sector for more than 20 years helping companies and users to develop and train in this field. Always learning new things.

You may be interested:

Rate this post

Leave a Comment