Documentation

discord.send() function

The discord.send() function is a user-contributed function maintained by the package author and can be updated or removed at any time.

The discord.send() function sends a single message to a Discord channel using a Discord webhook.

import "contrib/chobbs/discord"

discord.send(
    webhookToken: "mySuPerSecRetTokEn",
    webhookID: "123456789",
    username: "username",
    content: "This is an example message",
    avatar_url: "https://example.com/avatar_pic.jpg",
)

Parameters

webhookToken

Discord webhook token.

webhookID

Discord webhook ID.

username

Override the Discord webhook’s default username.

content

Message to send to Discord (2000 character limit).

avatar_url

Override the Discord webhook’s default avatar.

Examples

Send the last reported status to Discord
import "influxdata/influxdb/secrets"

token = secrets.get(key: "DISCORD_TOKEN")

lastReported =
    from(bucket: "example-bucket")
        |> range(start: -1m)
        |> filter(fn: (r) => r._measurement == "statuses")
        |> last()
        |> findRecord(fn: (key) => true, idx: 0)

discord.send(
    webhookToken: token,
    webhookID: "1234567890",
    username: "chobbs",
    content: "The current status is \"${lastReported.status}\".",
    avatar_url: "https://staff-photos.net/pic.jpg",
)

Package author and maintainer

Github: @chobbs
InfluxDB Slack: @craig

Package author and maintainer

Github: @chobbs
InfluxDB Slack: @craig


Was this page helpful?

Thank you for your feedback!


Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.