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.

Function type: Output

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.

Data type: String

webhookID

Discord webhook ID.

Data type: String

username

Override the Discord webhook’s default username.

Data type: String

content

Message to send to Discord (2000 character limit).

Data type: String

avatar_url

Override the Discord webhook’s default avatar.

Data type: String

Examples

Send the last reported status to Discord
import "contrib/chobbs/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


New! Cloud or OSS?

InfluxDB OSS 2.0 now generally available!

InfluxDB OSS 2.0 is now generally available and ready for production use. See the InfluxDB OSS 2.0 release notes.

For information about upgrading to InfluxDB OSS 2.0, see: