teams.endpoint() function

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

The teams.endpoint() function sends a message to a Microsoft Teams channel using data from table rows.

*Function type: Output*

  1. import "contrib/sranka/teams"
  2. teams.endpoint(
  3. url: "https://outlook.office.com/webhook/example-webhook"
  4. )

Parameters

url

Incoming webhook URL.

*Data type: String*

Usage

teams.endpoint is a factory function that outputs another function. The output function requires a mapFn parameter.

mapFn

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:

  • title
  • text
  • summary

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

Examples

Send critical statuses to a Microsoft Teams channel
  1. import "contrib/sranka/teams"
  2. url = "https://outlook.office.com/webhook/example-webhook"
  3. endpoint = teams.endpoint(url: url)
  4. crit_statuses = from(bucket: "example-bucket")
  5. |> range(start: -1m)
  6. |> filter(fn: (r) => r._measurement == "statuses" and status == "crit")
  7. crit_statuses
  8. |> endpoint(mapFn: (r) => ({
  9. title: "Disk Usage"
  10. text: "Disk usage is: **${r.status}**.",
  11. summary: "Disk usage is ${r.status}"
  12. })
  13. )()

Package author and maintainer

Github: @sranka
InfluxDB Slack: @sranka