【问题标题】:Extend slack bot menu color bar across full message (node, slack block kit, slack api)在完整消息中扩展 slack bot 菜单颜色条(节点、slack 块套件、slack api)
【发布时间】:2021-06-21 02:06:46
【问题描述】:

我有一个使用下拉菜单的 Slack 机器人,它的侧面有一个颜色条。 查看我所拥有的屏幕截图 here in the green circle

我希望栏扩展整个消息like this image
注意:此图像经过编辑以显示红色条的示例(并且因为实际的 slack bot 消息并不重要)

我的代码有类似的东西

    let slackPost = {
        "blocks": [
            {
                "type": "section",
                "text": {
                    "type": "mrkdwn",
                    "text": myText
                }
            } // ... some other blocks
        ],
        "attachments": [
            {
                "text": menuTitle,
                "color": menuBarColor,
                "attachment_type": "default",
                "actions": [
                    {
                        "name": menuName,
                        "text": menuPlaceHolder,
                        "type": "select",
                        "options": menuOptions   
                    }
                ]
            }
        ]
    }

【问题讨论】:

    标签: slack slack-api slack-block-kit


    【解决方案1】:

    您可以在附件属性中嵌套块,如下所示:

    let slackPost = {
      "attachments": [{
        "color": message.color,
        "blocks": [
          {
            "type": "section",
            "text": {
              "type": "mrkdwn",
              "text": myText
            }
          } // ... some other blocks
        ]
       }]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-01-12
      • 1970-01-01
      • 2017-07-12
      • 1970-01-01
      • 1970-01-01
      • 2022-12-10
      • 2018-06-30
      • 1970-01-01
      相关资源
      最近更新 更多