You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

能否借助Slack Web API的chat.postMessage接口使用Bot Kit Builder JSON载荷发送富卡片?

关于Slack chat.postMessage接口发送富卡片消息的说明
  • 直接用Bot Kit Builder的JSON载荷不行,得转成Slack官方的Block Kit格式才能通过chat.postMessage发富卡片。
  • 原因很简单:Slack的Web API只认自己家的Block Kit结构,Bot Kit Builder那套是Bot Framework生态用的格式,两者结构不兼容。
  • 具体操作步骤:
    1. 把Bot Kit Builder里的卡片组件(比如文本块、按钮)对应换成Slack Block Kit里的元素,比如用section块承载文本内容,用actions块放置按钮
    2. 将转换好的Block Kit JSON放到chat.postMessage请求的blocks参数中发送即可
  • 简单请求体示例:
    {
      "channel": "C1234567890",
      "blocks": [
        {
          "type": "section",
          "text": {
            "type": "mrkdwn",
            "text": "*富卡片标题*\n这里是卡片的正文内容"
          }
        },
        {
          "type": "actions",
          "elements": [
            {
              "type": "button",
              "text": {
                "type": "plain_text",
                "text": "点我试试"
              },
              "action_id": "test_button"
            }
          ]
        }
      ]
    }
    

内容的提问来源于stack exchange,提问作者404

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.17 17:15:49