1

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!

Kitty
  • 89
  • 10

1 Answers1

0

Solved the problem. Simply turned off Socket Mode.

Steps for others:

  • Go to Settings -> Socket Mode and switch it off
  • Make sure your code does not have socketMode: true,
  • Get your Glitch URL by clicking on Share
  • Follow the popup that tells you where you need to use a URL now (for me it was Event Subscriptions and Slash Commands; also Interactivity, which it didn't say) and paste it, adding /slack/events to the end (for Bolt)
  • You can use the examples/actions.js in Glitch for an easy test
Kitty
  • 89
  • 10