Glitch中基于Bolt与Socket Mode的Slack App无法接收事件求助
Slack Bolt + Socket Mode无法接收事件(消息无响应)
我是Slack应用开发新手,使用Glitch、Bolt和Socket Mode开发,已成功创建消息块并发送给工作区用户,但无法接收任何事件。
我使用了官方教程中的完整代码:
const { App } = require('@slack/bolt'); const app = new App({ token: process.env.SLACK_BOT_TOKEN, signingSecret: process.env.SLACK_SIGNING_SECRET, socketMode: true, appToken: process.env.SLACK_APP_TOKEN, port: process.env.PORT || 3000 }); // Listens to incoming messages that contain "hello" app.message('hello', async ({ message, say }) => { console.log('said hello') // say() sends a message to the channel where the event was triggered await say(`Hey there <@${message.user}>!`); }); (async () => { // Start your app await app.start(); console.log('⚡️ Bolt app is running!'); })();
以下是我已尝试/检查的所有内容:
- 应用在Glitch控制台中正常运行
- 环境变量配置正确
- 已启用Socket Mode
- 已开启Enable Events
- Slack App Token拥有
connections:write权限 - 已订阅所有四个message相关的Bot Events
- Bot Token Scopes包含
app_mentions:read、channels:history、channels:read、chat:write、chat:write.public、commands、groups:history、im:history、im:read、im:write、incoming-webhook、metadata.message:read、mpim:history、mpim:read、mpim:write、reminders:write、users:read、users:read.email - 已重启Slack应用及桌面端Slack
- 已在应用对话页和添加了机器人的频道中发送hello消息
我最初尝试响应用户按钮点击时,按钮旁出现警告标识。改用上述基础代码后问题仍未解决——console.log('said hello')从未执行,恳请帮助!
内容的提问来源于stack exchange,提问作者Kitty
相关产品推荐
相关产品推荐

