# Notifications in Pandora FMS

# Telegram

Pandora FMS integration with a Telegram bot

# Telegram

Step-by-step to integrate with a Telegram bot

<p class="callout info">**NOTE: This guide is under construction.**</p>

<span style="font-weight: 400;">[![TelegramLogo.png](https://pandorafms.com/guides/public/uploads/images/gallery/2020-12/scaled-1680-/telegramlogo.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2020-12/telegramlogo.png)</span>

# <span style="font-weight: 400;">Introduction</span>

<span style="font-weight: 400;">Telegram bots CLI connector for use in Pandora FMS alerts.</span>

# <span style="font-weight: 400;">Compatibility matrix</span>

- <span style="font-weight: 400;">Python3 for source code </span>
- <span style="font-weight: 400;">Linux x64 for compiled</span>

# <span style="font-weight: 400;">Requirements</span>

<span style="font-weight: 400;">The requirements are as follows:</span>

- <span style="font-weight: 400;">A Telegram account to create the bot</span>
- <span style="font-weight: 400;">Add the bot to the notification group</span>
- <span style="font-weight: 400;">Get the group id</span>
- <span style="font-weight: 400;">(only for source code) Have python3 installed on the Pandora server with the module: request.</span>&lt; /li&gt;

# Configuration

## <span style="font-weight: 600;">Creation of the BOT in Telegram</span>

<span style="font-weight: 400;">From a Telegram account you must write</span>*<span style="font-weight: 400;"> /start</span>* <span style="font-weight: 400;"> to the user </span>**BotFather** <span style="font-weight: 400;">([https://telegram.me/botfather](https://telegram.me/botfather))</span> <span style="font-weight: 400;">to create a bot.</span>

<span style="font-weight: 400;">It will return us a series of parameters and instructions that we can make for the creation and manipulation of bots.</span>

[![image-1608158507569.png ](https://pandorafms.com/guides/public/uploads/images/gallery/2020-12/scaled-1680-/image-1608158507569.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2020-12/image-1608158507569.png)

<span style="font-weight: 400;">We will use the option </span>***/newbot*** <span style="font-weight: 400;">with which we will create a new bot.</span>[  ](https://pandorafms.com/guides/public/uploads/images/gallery/2020-12/image-1608158507569.png)<span style="font-weight: 400;">It will ask us the name we want to give our bot, in my case I have selected </span>***Pandora\_FMS\_Test\_bot*** <span style="font-weight: 400;">you can put the one you prefer.</span>

<span style="font-weight: 400;">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. </span>***Pandora\_FMS\_Test\_bot***

<span style="font-weight: 400;">Now it will return us The information about our bot and some instructions for its administration, we will copy and save the API token with which we will authenticate ourselves as that bot</span><span style="font-weight: 400;">  
</span>

<span style="font-weight: 400;">[![PandoraFMS-NTelegram01.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-01/scaled-1680-/pandorafms-ntelegram01.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-01/pandorafms-ntelegram01.png)</span>

# Create a group and add the bot

<span style="font-weight: 400;">To create a group from Telegram simply click on create group and select the users that will be in that group is important that one of those users is our bot to be able to send messages to that specific group also we can simply add the bot to an existing group.</span>

[![PandoraNTelegram02.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-01/scaled-1680-/pandorantelegram02.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-01/pandorantelegram02.png)

# Get the group id to send messages from the CLI

<span style="font-weight: 400;">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 the simplest is to add another bot that extracts that information very easily </span>**GetIDs Bot** <span style="font-weight: 400;">(</span>[<span style="font-weight: 400;">https://t.me/getidsbot</span>](https://pandorafms.com/guides/public/https:%20/t.me/%20getidsbot)<span style="font-weight: 400;">).</span>

<span style="font-weight: 400;">We add it to the group that we want to know the id of and it will give us a series of instructions for its use. But just adding it will give us more. The information we need is the group id.</span>

<span style="font-weight: 400;">[![PandoraFMS-NTelegram03.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-01/scaled-1680-/pandorafms-ntelegram03.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-01/pandorafms-ntelegram03.png)</span>

<span style="font-weight: 400;">Once we have the group id, we copy and save it, we can eliminate this bot from the group if we want, it has already fulfilled the objective of giving us the id.</span>