Telegram Alerts

I need help displaying alerts on Telegram. I’m having difficulty understanding how to create a notification endpoint for Telegram.

In the examples I found, they show notification rules, but in order to create a notification rule, I need to create a notification endpoint.

There was a video teaching how to create alerts for Telegram, but this video is private and cannot be accessed.

Thank you in advance.

Let me clarify my issue.

Currently, I am using InfluxDB version 2.1.1, where my alerts are sent to Slack. With the migration to a new server, InfluxDB will be updated to version 2.7.10, and I now need these alerts to be redirected to a group on Telegram.

What I would like to do is keep the entire alert structure I’ve already set up, simply copying the existing configuration and changing only the endpoint from Slack to Telegram. I’ll share some screenshots of my current InfluxDB setup to give a clearer idea of what needs to be adjusted.

Notification Rule:

import "influxdata/influxdb/monitor"
import "slack"
import "influxdata/influxdb/secrets"
import "experimental"
option task = {name: "status", every: 20s, offset: 0s}
slack_endpoint = slack["endpoint"](url: "www.example")
notification = {notification_rule_id: "example", notification_rule_name: "status", notification_endpoint_id: "example", notification_endpoint_name: "Slack Endpoint"}
statuses = monitor["from"](start: -40s)
crit = statuses |> monitor.stateChanges(fromLevel: "ok", toLevel: "crit")
all_statuses = crit |> filter(fn: (r) => r["_time"] >= experimental["subDuration"](from: now(), d: 20s))
all_statuses |> monitor["notify"](data: notification, endpoint: slack_endpoint(mapFn: (r) => ({channel: "", text: "${r._message}", color: if r["_level"] == "crit" then "danger" else if r["_level"] == "warn" then "warning" else "good"})))

Hello @Silvio_Coelho,

This thread might be helpful (its been a long time since ive used that package) and read through the solutions it might be easier than making a telegram.endpoint() function which you’ll need to define if you want to mirror the script you gave me as closely as possible.

So the slack.endpoint function is a factory function that returns a function (slack.message() ) that can be used to send a message to Slack per input row.
See how it works here:

But I believe you could borrow the function definition from slack and alter it to fit the requirements of the telegram message and then use it.