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
.
token
(Required) Webex API access token.
roomId
(Required) Room ID to send the message to.
text
(Required) Plain text message.
markdown
(Required) Markdown formatted message.
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}**.",
)
Support and feedback
Thank you for being part of our community! We welcome and encourage your feedback and bug reports for Flux and this documentation. To find support, the following resources are available:
InfluxDB Cloud customers can contact InfluxData Support.