This tutorial, we will be sharing how to integrate Monika with Telegram bots so that when there are Monika incidents or recoveries, you will be notified on your Telegram group.
First, you need a Telegram account. Head over to https://web.telegram.org to create your account. And then, create a new private chat. Search for an account named “BotFather”. After that, do these steps below:
Now the next step is to create a group for the Monika notifications. Create a group in Telegram, and invite your bots into the group. Then, set your bot to be a group administrator.
Now that we have our bot API key and set our bot to be a group administrator, all we need to do is to get the group ID. Invite a new bot to the group called @RawDataBot into your group to get the group ID.
After you have successfully invited the Telegram Bot Raw, you will see the group ID. Save the group ID to somewhere else and don’t forget to kick the Telegram Bot Raw from your group. Now that we have the group ID and bot token, it’s time to integrate it with Monika.
Now that we have our Webhook URL, it’s time to create a configuration called monika.yml
:
notifications:- id: 12f3e1df-3222-4a79-b931-146f964be711type: telegramdata:group_id: "<group_id>"bot_token: <bot_token>probes:- id: 48c828bb-b761-41e7-b360-ba0692ded184name: ''requests:- url: https://github.combody: {}timeout: 10000alerts: []
Let me explain a little bit about this configuration:
notifications
object. There are 3 properties: id
, type
, and data
. Set the id
to any string values, as it is just an identifier. Then, set the type
to telegram
to set the notification channel to Telegram. After that, put your group ID and bot token notifier webhook URL in group_id
and bot_token
keys in the data
object.Now that we have our configuration ready, it’s time to run it with Monika. Go to the directory where you saved the Monika configuration, and run Monika straight away using monika -c monika.yml
Congratulations! Now that you have successfully integrated Monika with Telegram, you will be notified if your website is slow or down.
PT Artha Rajamas Mandiri (Hyperjump) is an open-source-first company providing engineering excellence service. We aim to build and commercialize open-source tools to help companies streamline, simplify, and secure the most important aspects of its modern DevOps practices.
Copyright © 2024 Hyperjump Tech. All Rights Reserved.