I have a Slack app that has a Bot user, and I want to get notified via the Slack Events API (using @slack/events-api
official NPM package) when a user opens the app's Direct Message window of the Bot User (UC: to send him a welcome message).
Looks like the im_open
event is what i need but somehow it's not triggered.
I configured it in my app's settings:
And then defined the following code:
const { createEventAdapter } = require('@slack/events-api');
const slackEvents = createEventAdapter('some-secret);
slackEvents.on('im_open', async (event) => {
console.log(`Received a im_open event`);
});
const port = 5000;
slackEvents.start(port).then(() => {
console.log(`server listening on port ${port}`);
});
But it's never triggered.
I have listeners for app_mention
and message
events that works fine but this one somehow doesn't.
Any idea why?