Node.js Slack API—单击按钮时从同一消息中获取其他组件的值
我有一条互动信息:Node.js Slack API—单击按钮时从同一消息中获取其他组件的值,node.js,express,slack,slack-api,Node.js,Express,Slack,Slack Api,我有一条互动信息: [ { "type": "section", "text": { "type": "mrkdwn", "text": "The number of items you want to see (Top X)" }, "accessory": { "type": "static_select", "placeh
[
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "The number of items you want to see (Top X)"
},
"accessory": {
"type": "static_select",
"placeholder": {
"type": "plain_text",
"text": "X",
"emoji": true
},
"options": [
{
"text": {
"type": "plain_text",
"text": "1",
"emoji": true
},
"value": "1"
}
]
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "The criteria you want to group by"
},
"accessory": {
"type": "static_select",
"placeholder": {
"type": "plain_text",
"text": "Select a criteria",
"emoji": true
},
"options": [
{
"text": {
"type": "plain_text",
"text": "criteria1",
"emoji": true
},
"value": "criteria1"
}
]
}
},
{
"type": "actions",
"elements": [
{
"type": "button",
"text": {
"type": "plain_text",
"text": "Fetch P&L",
"emoji": false
}
}
]
}
]
当用户单击按钮时,如何获取用户在2个下拉菜单中选择的值
这不是我从Slack得到的有效载荷。我正在使用
NodeJS
库与express
应用程序中的Slack进行通信,我希望有一个同样使用这些库的解决方案。Slack UI的工作方式与标准HTTP表单略有不同
每个交互组件(例如选择或按钮)都是独立的,当用户单击它时,Slack将向您的应用程序发送一个仅包含该组件信息的请求
要组合多个交互式组件,有两个选项:
- 您可以分多个步骤进行查询。因此,您首先发送一条消息,询问物品的数量。然后用户做出选择,你的应用程序就会收到Slack的请求。然后,您的应用程序将替换该消息并询问条件。等等
- 或者你也可以用一个。这将显示为模式窗口,允许您在一个步骤中查询多达5个元素