1
votes

Expected behaviour:

  • When I open direct message (DM) with my bot the im_open event should trigger.

Current behaviour:

  • It does not trigger.

Steps I made:

  • I enabled the 'im:read' scope in 'OAuth & Permissions' as the link mention: https://api.slack.com/events/im_open

  • I added im_open event from 'Event Subscriptions' for Workspace and Bot User.

  • I re-installed the application.

  • I ensured other activated events work, just this doesn't.

  • I test it by simply opening the chat channel with the bot (open up the conversation/channel).

This is my code:

slackEvents.on('im_open', (event: any, body: any, headers: any) => {
  console.log('Test'); // Doesn't work
});

slackEvents.on('message', (event: any, body: any, headers: any) => {
  console.log('Test2'); // Works fine
});

I use the following library: https://www.npmjs.com/package/@slack/events-api

1
I think this event only fires when a new direct message channel is created, e.g. with a new user, not when you re-open an existing one. did you test that? - Erik Kalkoken

1 Answers

2
votes

What you are looking for is probably the app_home_opened event. https://api.slack.com/events/app_home_opened