Before I told you how to integrate Grafana Alerts in e-mail or pager duty notifications, let’s make now a Telegram integrations with a bot to receive alerts directly to your public channel/chat.
- Create a new Contact point
Here we need the following information
1.1 Enter a name
1.2 Choose telegram from list
1.3 Insert BOT API Token
1.4 Insert Chat ID of your group/channel or your profile
To get the BOT API Token we need to create our own bot, you can do it with the @BotFather bot
Run, enter the command /newbot
Then enter the name of the bot. username of the bot, which will be displayed in the link. That’s it, the bot is created, we got its API Token.
There are two ways to get a Chat ID (where Grafana will send the notification):
- Our bot
Add the bot to our group/channel and give it admin rights so it can write messages.
The group/channel must be public. After getting Chat ID you can make it private.
Use the online Chat ID identifier. - you can translate site in English
Run our bot, which we created in BotFather, so that we have an open chat with it, where it will send us messages.
Next, find out our profile ID using the @RawDataBot
And put our ID in the Chat ID field in Grafana and send a test message. Save it.
Then go to Notification Policies and edit the Default rule, putting Telegram in the Contact Point line.
That’s it, the configuration is done, now you will get the messages to Telegram when creating the Alerts.
Thanks for your time!