Documentation

webexteams.message() function

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

The webexteams.message() function sends a single message to Webex using the Webex messages API.

import "contrib/sranka/webexteams"

webexteams.message(,
  url: "https://webexapis.com"
  token: "My5uP3rs3cRe7T0k3n",
  roomId: "Y2lzY29zcGFyazovL3VzL1JPT00vYmJjZWIxYWQtNDNmMS0zYjU4LTkxNDctZjE0YmIwYzRkMTU0",
  text: "Example plain text message",
  markdown: "Example [markdown message](https://developer.webex.com/docs/api/basics)." 
)

Parameters

url

Base URL of Webex API endpoint (without a trailing slash). Default is https://webexapis.com.

Data type: String

token

(Required) Webex API access token.

Data type: String

roomId

(Required) Room ID to send the message to.

Data type: String

text

(Required) Plain text message.

Data type: String

markdown

(Required) Markdown formatted message.

Data type: String

Examples

Send the last reported status to Webex Teams
import "contrib/sranka/webexteams"
import "influxdata/influxdb/secrets"

apiToken = secrets.get(key: "WEBEX_API_TOKEN")

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

webexteams.message(
  token: apiToken,
  roomId: "Y2lzY29zcGFyazovL3VzL1JPT00vYmJjZWIxYWQtNDNmMS0zYjU4LTkxNDctZjE0YmIwYzRkMTU0",
  text: "Disk usage is ${lastReported.status}.",
  markdown: "Disk usage is **${lastReported.status}**."
)

Set your InfluxDB URL

Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.