Configure Telegram for Alerting
Use the Grafana Alerting - Telegram integration to send Telegram notifications when your alerts are firing.
Before you begin
Telegram bot API token and chat ID
To integrate Grafana with Telegram, you need to obtain a Telegram bot API token and a chat ID (i.e., the ID of the Telegram chat where you want to receive the alert notifications).
Set up your Telegram bot
Create a Telegram bot. You can associate this bot to your chats and perform different actions with it, such as receiving alerts from Grafana.
To set up the bot, complete the following steps.
- Open the Telegram app on your device.
- Find the Telegram bot named BotFather.
- Type or press
/newbot
. - Choose a name for the bot. It must end in bot or _bot. E.g. “my_bot”.
- Copy the API token.
Chat ID
Add the bot to a group chat by following the steps below. Once the bot is added to the chat, you will be able to route your alert notifications to that group.
In the Telegram app, open a group or start a new one.
Search and add the bot to the group.
Interact with the bot by sending a dummy message that starts with “
/
”. E.g./hola @bot_name
.To obtain the chat ID, send an HTTP request to the bot. Copy the below URL and replace
{your_bot_api_token}
with your bot API token.https://api.telegram.org/bot{your_bot_api_token}/getUpdates
Paste the URL in your browser.
If the request is successful, it will return a response in JSON format.
... "chat": { "id": -4065678900, "title": "Tony and Hello world bot", "type": "group", ...
Copy the value of the
“id”
that appears under“chat”
.
Procedure
To create your Telegram integration in Grafana Alerting, complete the following steps.
- Navigate to Alerts & IRM -> Alerting -> Contact points.
- Click + Add contact point.
- Enter a contact point name.
- From the Integration list, select Telegram.
- In the BOT API Token field, copy in the bot API token.
- In the Chat ID field, copy in the chat ID.
- Click Test to check that your integration works.
- Click Save contact point.
Next steps
To add the contact point and integration you created to your default notification policy, complete the following steps.
- Navigate to Alerts & IRM -> Alerting -> Notification policies.
- In the Default policy, click the ellipsis icon (…) and then Edit.
- Change the default policy to the contact point you created.
- Click Update default policy.
Note
If you have more than one contact point, add a new child notification policy rather than edit the default one, so you can route specific alerts to Telegram.
Was this page helpful?
Related resources from Grafana Labs
![Getting started with the Grafana LGTM Stack](/static/assets/featured/getting-started-with-grafana-lgtm-stack-amer_featured.png?w=200 200w, /static/assets/featured/getting-started-with-grafana-lgtm-stack-amer_featured.png?w=400 400w)
![Intro to Kubernetes monitoring in Grafana Cloud](/media/webinar/Screenshot-2024-02-12-at-4.09.30-PM.png?w=200 200w, /media/webinar/Screenshot-2024-02-12-at-4.09.30-PM.png?w=400 400w)
![Building advanced Grafana dashboards](/media/webinar/AMER_buildadv_notxt.png?w=200 200w, /media/webinar/AMER_buildadv_notxt.png?w=400 400w)