【问题标题】:How do I post messages to arbitrary channels in Slack using the API?如何使用 API 将消息发布到 Slack 中的任意通道?
【发布时间】:2017-09-29 04:26:58
【问题描述】:

我有一些系统想要获取一些数据并将其发布到我们 Slack 实例中的任意通道。我不想为每个频道创建单独的 webhook URL,因为我事先不知道这些消息可能需要去哪里。 Slack 的网站上似乎存在相互冲突的文档。有一个例子:curl -X POST \ --data-urlencode 'payload={"text": "This is posted to #general and comes from *monkey-bot*.", "channel": "#general", "link_names": 1, "username": "monkey-bot", "icon_emoji": ":monkey_face:"}' \ https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX 包含一个“通道”键,但在上面它说You cannot override the default username, icon, or channel for incoming webhooks attached to Slack apps. Instead, these values will stubbornly inherit from the associated Slack app configuration.

我认为应该采用传入的 Webhook 方法,特别是因为我想要它提供的增强的格式化功能,但我承认,我对所有不同的编程方式进行交互有点困惑松弛。

我错过了什么吗?还有其他方法可以解决这个问题吗?

【问题讨论】:

    标签: slack-api


    【解决方案1】:

    事实证明,Web API 是要走的路。它确实允许增强格式并可以发布到任意频道。

    【讨论】:

      猜你喜欢
      • 2022-01-12
      • 1970-01-01
      • 2020-03-20
      • 1970-01-01
      • 2021-11-08
      • 2021-08-08
      • 2021-06-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多