Skip to main content

Configuration

Creation of the BOT on Telegram

From a Telegram® account, you must type /start to the user BotFather to create a  bot.

It will return a series of parameters and instructions available for the creation and manipulation of bots:

image-1626693442412.png

Use the /newbot option to create a new bot.

It will ask for the name, in this case Pandora_FMS_Test_bot , you can use any name you prefer.

Now you will be asked for a user ID for the bot, which must end in _bot. In this case, use the same one as before: Pandora_FMS_Test_bot.

It will now return information about our bot and some instructions for its administration. You must copy and save the API token, which is what we will use to authenticate ourselves as that bot.

image-1629719317095.png 

Create a group and add the bot


To create a group from Telegram, you must click on create group and select the users who will be in that group. It is important that one of those users is our bot in order to send messages to that group  specifically.

You can also simply add the bot to an existing group.

image-1626695074691.png

Obtain the group ID to send messages from the CLI

Now we need to obtain the id of the group where we added our bot. There are different ways to do this. One of the simplest is to add another bot that extracts this information very easily: GetIDs Bot.

We add it to the group we want to know the id of, and it will give a series of instructions for its use. Just by adding it, it provides the information we need (id of the group).

image-1629719396585.png

Once we have the group ID, we copy and save it.

We can remove this GetIDs Bot from the group because it has already fulfilled its purpose of giving us the ID.

Configure Pandora-Telegram CLI


To use Pandora Telegram CLI (source code), you must have Python version 3 and Pip version 3 installed for dependencies.  To install the dependencies, in the package to be downloaded, you will see the file requirements.txt. Go to its directory and run:

pip3 install -r requirements.txt

 

This will download and install the necessary dependencies.

Once the dependencies are installed, run the pandora-telegram-cli.py -h file with the Python interpreter to view its help:

python3 pandora-telegram-cli.py -h
usage: pandora-telegram-cli.py [-h] -m MESSAGE -t TOKEN -c CHAT_ID
Bot telegram cli
optional arguments:
-h, --help show this help message and exit
-m MESSAGE, --message MESSAGE
Message to be send
-t TOKEN, --token TOKEN
Bot token
-c CHAT_ID, --chat_id CHAT_ID
chat id to send messages

 

If we see the help without any errors, then we are ready to use it.