问题描述
我有一个使用下拉菜单的 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
}
]
}
]
}
解决方法
您可以在附件属性中嵌套块,如下所示:
let slackPost = {
"attachments": [{
"color": message.color,"blocks": [
{
"type": "section","text": {
"type": "mrkdwn","text": myText
}
} // ... some other blocks
]
}]