I am new to building Slack apps, and I am stumped. I am using Glitch, Bolt, and Socket Mode. I was able to create a message block and successfully send it to users in my workspace. However, I can't seem to receive anything.
I copied the exact code from this official tutorial:
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!');
})();
Here is everything I have tried/checked:
- The app is running in Glitch console
- The env variables are correct
- Socket Mode is enabled
- Enable Events is on
- My Slack App Token has connections:write
- Subscribe to Bot Events is on for all four message. events
- Bot Token Scopes has 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
- Restarted my Slack app and Slack on my desktop
- Typed hello at the bot in its app tab and in a channel I added it to
I initially started by trying to respond to user button clicks, and a caution symbol appeared beside the button. Getting down to basics with the above code hasn't helped--console.log('said hello')
never happens. Please help me; I'm going nuts!