webexteams.message() 函数
webexteams.message()
是用户贡献的函数,由软件包作者维护。
webexteams.message()
使用 Webex 消息 API 向 Webex 发送单条消息。
函数类型签名
(
markdown: A,
roomId: B,
text: C,
token: string,
?url: string,
) => int
有关更多信息,请参阅函数类型签名。
参数
url
Webex API 端点的基本 URL(不带尾部斜杠)。默认为 https://webexapis.com
。
token
(必需)Webex API 访问令牌。
roomId
(必需)要向其发送消息的房间 ID。
text
(必需)纯文本消息。
markdown
(必需)Markdown 格式的消息。
示例
将上次报告的状态发送到 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}**.",
)
此页面是否对您有帮助?
感谢您的反馈!