Configuration
Creating a BOT in Telegram
From a Telegram account you must type /start to the user BotFather (https://telegram.me/botfather) to create a bot.
It will return a series of parameters and instructions that we can do for the creation and manipulation of bots.
We will use the /newbot option with which we will create a new bot.
It will ask us the name we want to give to our bot, in my case I have selected Pandora_FMS_Test_bot , but you can put the one you prefer.
Now it will ask us for a user id for the bot, this has to end in _bot in this case I will use the same one. Pandora_FMS_Test_bot.
Now it will return us the information of our bot and some instructions for its administration, we will copy and save the API token that is the one with which we will authenticate us as that bot.
Create a group and add the bot
To create a group from Telegram we simply click on create group and select the users that will be in that group. It is important that one of those users is our bot in order to be able to send messages to that specific group. We can also simply add the bot to an existing group.
Get the id of the group to send messages from the CLI
Now we need to obtain the id of the group in which we have added our bot, there are different ways to do it, but one of the easiest is to add another bot that extracts this information very easily GetIDs Bot (https://t.me/getidsbot).
We add it to the group we want to know the id and it will give us a series of instructions for its use. But just by adding it, it will give us the information we need, which is the group id.
Once we have the id of the group we copy and save it, we can delete this bot from the group if we want, it has already fulfilled the purpose of giving us the id.
group if we want, it has already fulfilled the objective of giving us the id.
Configuring Pandora-Telegram CLI
To use the Pandora Telegram CLI (source code) you must have installed python3 and pip3 for the dependencies.
To install the dependencies, in the package you download you will see the requirements.txt file, we place it in its directory and simply execute it:
pip3 install -r requirements.txt
This will download and install the necessary dependencies.
Once the dependencies are installed we run the pandora-telegram-cli.py -h file with the Python interpreter to see 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 error we are ready to use it.