telegram.endpoint() function

    The telegram.endpoint() function sends a message to a Telegram channel using data from table rows.

    *Function type: Output*

    For information about retrieving your Telegram bot token and channel ID, see Set up a Telegram bot.

    URL of the Telegram bot endpoint. Default is https://api.telegram.org/bot.

    *Data type: String*

    *Data type: String*

    of the message text. Default is "MarkdownV2".

    *Data type: String*

    Disable preview of web links in the sent message. Default is false.

    *Data type: Boolean*

    A function that builds the object used to generate the POST request. Requires an r parameter.

    *Data type: Function*

    mapFn accepts a table row (r) and returns an object that must include the following fields:

    • text
    • silent

    For more information, see telegram.message() parameters.

    Send critical statuses to a Telegram channel
    1. import "influxdata/influxdb/secrets"
    2. import "contrib/sranka/telegram"
    3. token = secrets.get(key: "TELEGRAM_TOKEN")
    4. endpoint = telegram.endpoint(token: token)
    5. |> range(start: -1m)
    6. |> filter(fn: (r) => r._measurement == "statuses" and status == "crit")
    7. crit_statuses
    8. |> endpoint(mapFn: (r) => ({
    9. channel: "-12345",
    10. text: "Disk usage is **${r.status}**.",
    11. silent: true
    12. })

    Package author and maintainer

    Github:
    InfluxDB Slack: @sranka