# Notifications dans Pandora FMS

# Telegram

Intégration de Pandora FMS avec un bot Telegram

# Telegram

Étape par étape pour intégrer un bot Telegram

<p class="callout info">**REMARQUE: Ce guide est en cours de 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;">Connecteur CLI du robot Telegram à utiliser dans les alertes Pandora</span>

# <span style="font-weight: 400;">Matrice de compatibilité</span>

- <span style="font-weight: 400;">Python3 pour le code source </span>
- <span style="font-weight: 400;">Linux x64 pour compilé</span>

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

<span style="font-weight: 400;">Les exigences sont les suivantes:</span>

- <span style="font-weight: 400;">Un compte Telegram pour créer le bot</span>
- <span style="font-weight: 400;">Ajouter le bot au groupe de notification</span>
- <span style="font-weight: 400;">Obtenir l'identifiant du groupe</span>
- <span style="font-weight: 400;">(uniquement pour le code source) Avoir python3 installé sur le serveur Pandora avec le module : request.</span>

# Configuration

## <span style="font-weight: 600;">Création du BOT dans Telegram</span>

<span style="font-weight: 400;">Depuis un compte Telegram, vous devez écrire</span>*<span style="font-weight: 400;"> /start</span>*<span style="font-weight: 400;"> à l'utilisateur </span>**BotFather** <span style="font-weight: 400;">([https://telegram.me/botfather](https://telegram.me/botfather))</span> <span style="font-weight: 400;">pour créer un bot.</span>

<span style="font-weight: 400;">Cela nous rendra une série de paramètres et d'instructions que nous pouvons créer pour la création et la manipulation de robots.</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;">Nous utiliserons l'option </span>***/newbot*** <span style="font-weight: 400;">avec lequel nous allons créer un nouveau bot.</span>[  ](https://pandorafms.com/guides/public/uploads/images/gallery/2020-12/image-1608158507569.png)<span style="font-weight: 400;">Il nous demandera le nom que nous voulons donner à notre bot, dans mon cas j'ai sélectionné </span>***Pandora\_FMS\_Test\_bot*** <span style="font-weight: 400;">vous pouvez mettre celui que vous préférez.</span>

<span style="font-weight: 400;">Maintenant, il nous demandera un identifiant utilisateur pour le bot, cela doit se terminer par \_bot, dans ce cas j'utiliserai la même chose. </span>***Pandora\_FMS\_Test\_bot***

<span style="font-weight: 400;">Maintenant, cela nous rendra Les informations sur notre bot et quelques instructions pour son administration, nous copierons et enregistrerons le jeton API avec lequel nous nous authentifierons en tant que bot</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>

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

# Créer un groupe et ajouter le bot

<span style="font-weight: 400;">Pour créer un groupe depuis Telegram, nous devons simplement cliquer sur créer un groupe et sélectionner les utilisateurs qui le feront. être inclus. Dans ce groupe, il est important que l'un de ces utilisateurs soit notre bot pour pouvoir envoyer des messages à ce groupe spécifique. Nous pouvons également simplement ajouter le bot à un groupe existant.</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)

# Obtenir l'identifiant du groupe pour envoyer des messages à partir de la CLI

<span style="font-weight: 400;">Maintenant, nous devons obtenir l'identifiant du groupe dans lequel nous avons ajouté notre bot, il existe différentes manières de le faire, mais la plus simple est d'ajouter un autre bot qui extrait ces informations très facilement </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;">Nous l'ajoutons au groupe dont nous voulons connaître l'identifiant et il nous donnera une série d'instructions pour son utilisation. Mais le simple fait de l'ajouter nous donnera plus. L'information dont nous avons besoin est l'identifiant du groupe.</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;">Une fois que nous avons l'identifiant du groupe, nous le copions et le sauvegardons, nous pouvons éliminer ce bot du groupe si nous le voulons, il a déjà rempli l'objectif de nous donner l'identifiant.</span>