docs-v2/content/flux/v0.x/stdlib/contrib/sranka/teams/message.md

1.7 KiB

title description aliases menu weight introduced
teams.message() function The `teams.message()` function sends a single message to a Microsoft Teams channel using an [incoming webhook](https://docs.microsoft.com/microsoftteams/platform/webhooks-and-connectors/how-to/add-incoming-webhook).
/influxdb/v2.0/reference/flux/stdlib/contrib/teams/message/
/influxdb/cloud/reference/flux/stdlib/contrib/teams/message/
flux_0_x_ref
name parent
teams.message teams
202 0.70.0

The teams.message() function sends a single message to a Microsoft Teams channel using an incoming webhook.

import "contrib/sranka/teams"

teams.message(
    url: "https://outlook.office.com/webhook/example-webhook",
    title: "Example message title",
    text: "Example message text",
    summary: "",
)

Parameters

url

Incoming webhook URL.

title

Message card title.

text

Message card text.

summary

Message card summary. Default is "". If no summary is provided, Flux generates the summary from the message text.

Examples

Send the last reported status to a Microsoft Teams channel
import "contrib/sranka/teams"

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

teams.message(
    url: "https://outlook.office.com/webhook/example-webhook",
    title: "Disk Usage",
    text: "Disk usage is: *${lastReported.status}*.",
    summary: "Disk usage is ${lastReported.status}",
)