下面是一个简单的节点松弛应用程序,它向用户显示内置的multi user select
块元素。我想在用户单击输入中的提交按钮时处理该操作,因此我在块中设置了 action_id 并根据文档中的示例添加了一个操作侦听器。
但是,该操作没有被触发;ngrok 显示传入/slack/actions
请求但返回 404。
我在这里想念什么?
const { App } = require('@slack/bolt');
const app = new App({
signingSecret: process.env.SLACK_SIGNING_SECRET,
token: process.env.SLACK_BOT_TOKEN,
});
app.event('app_home_opened', ({ event, say }) => {
say(`Hi <@${event.user}>!`);
const blocks = [{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Pick one or more items from the list"
},
"accessory": {
"type": "multi_users_select",
"action_id": "test_action",
"placeholder": {
"type": "plain_text",
"text": "Select items"
},
}
}];
say({ blocks });
});
app.action('test_action', async(req, res) => {
console.log(req);
console.log(res);
});
app.error(error => {
console.error(error);
});
(async () => {
await app.start(process.env.PORT || 3000);
})();