Skip to content


 Zabbix
 Grafana
 Prometheus
 Threejs and TypeScript
 SocketIO and TypeScript
 Blender Topological Earth
 Sweet Home 3D
 Design Patterns Python
 Design Patterns TypeScript
   
 Course Coupon Codes
Three.js and TypeScript
Kindle Edition
$6.99 $9.99 Paperback 
$22.99 $29.99




Design Patterns in TypeScript
Kindle Edition
$6.99 $9.99 Paperback
$11.99 $19.99




Design Patterns in Python
Kindle Edition
$6.99 $9.99 Paperback
$11.99 $19.99




Create Telegram Contact Point

Video Lecture

Create Telegram Bot Alert Channel Create Telegram Bot Alert Channel Create Telegram Bot Alert Channel

Description

We can also add Telegram as a Contact Point for Alerting.

To do this install the Telegram app on your phone or PC. It will be easiest to set this up on your PC first.

You will need a BOT API Token and Chat ID.

Open Telegram, and create a new Bot by searching for @BotFather and then typing /newbot

Follow the prompts to create a name and username for your bot. The username must end in bot and must be unique.

You will get given a HTTP API token which is your BOT API Token to be used in Grafana. It will be in the form XXXXXXXXX: YYYYYYYYYYYYYYYYYYYYYYYYYYYYY

You then need the Chat ID. To get this, you first need to create a group and then add the new bot to it.

Then press the View Group Info option for the group, click your bot users name in the members list, and press the SEND MESSAGE button.

Then send any message to the user.

Then, in your browser, visit the url https://api.telegram.org/botXXX:YYY/getUpdates (replace the XXX:YYY with the BOT API token you just got from Telegram)

In the JSON response, you should see a node with a message that has the type=group. This node will also have an Id. Copy this Id into the Chat ID field in Grafana.

Now you can test the new Telegram contact point in Grafana using the Test button.

There should be a sample alert from Grafana inside your new Telegram group messages window.

Get Telegram Chat ID

You can also try this tool to get the Chat ID of your Telegram group. Ensure you have created a Group first, added your Bot to it, and sent it at least 1 message. The Chat ID will be extracted from the message data.


    

Troubleshooting

If the getUpdates URL doesn't return a node containing a chat group with an id, then try sending another message with different text.

You can also try,

  • removing your bot from the group,
  • and then re adding your bot to the group,
  • selecting it from the group members list,
  • send it a new message,
  • then try the getUpdates URL again.

Also, if the chat id is a negative number, make sure you copy the negative symbol as well when setting the chat id in the script.

Eg, If chat id = -123456789, occasionally quickly copying and pasting you may forget the - character and copy just 123456789