Telegram endpoint does not work when used with monitor.notify

Hi here :slight_smile:

I’m using InfluxDB 2.6 OSS in my homelab and I’m currently setting up monitoring for my home network using InfluxDBv2 alerting features. For now I’ve setup a few checks and I’m trying to report critical events using Telegram. I’m using OSS version, so no Telegram endpoint available in the UI. So I wrote the following task:

import "influxdata/influxdb/monitor"
import "influxdata/influxdb/secrets"
import "contrib/sranka/telegram"
import "date"

option task = {name: "Notify on Telegram", every: 6m, offset: 20s}

notification = {
    _notification_rule_id: "0000000000000001",
    _notification_rule_name: "Notify on Telegram",
    _notification_endpoint_id: "0000000000000002",
    _notification_endpoint_name: "Notify on Telegram",
}

telegramToken = secrets.get(key: "TELEGRAM_TOKEN")
telegramChatID = secrets.get(key: "TELEGRAM_CHAT_ID")

telegramEndpoint =
    telegram.endpoint(token: telegramToken, url: "https://api.telegram.org/bot")(
        mapFn: (r) =>

            ({
                channel: telegramChatID,
                silent: false,
                text: "*Notification triggered by check ${r._check_name}*: ${r._message}",
            }),
    )

monitor.from(start: -6m)
    |> filter(fn: (r) => r["_level"] == "crit")
    |> filter(fn: (r) => r["_time"] >= date.sub(from: now(), d: 7m))
    |> monitor.notify(data: notification, endpoint: telegramEndpoint)

But… it does not work. I’ve confirmed that token and chat id stored in secrets are correct by trying to send a test message using telegram.message and it works.

In the notifications history view, one can see that there are attempt to send notifications but there’s this warning icon on the right:

Right now I don’t see anything obviously wrong in my code, but I might be blind. Any idea or advices to help debugging ?

PS: I’m running Influxdb2 in docker using the official image.

Thanks.

Nobody having similar issue nor solution ? :sleepy:

Ok, so in case somebody else faces the same issue : “.” is a reserved character in Telegram Markdown v2…

When the message contains at least one “.”, Telegram refuses it. All “.” have to be replaced with “\.” before sending.