0
votes

I'm building a Slack application/bot and I want it to be able to welcome user every time one starts a direct message conversation with it.

For that purpose, I set up my Slack application accordingly with the documentation in order to be able to receive the 'im_created' event. Especially, I added the im:read bot scope (and even the im:read workspace scope, just to make sure) and subscribe to this event. But I never received it whereas I could receive all other type of events I needed.

Has someone already been in this case and share with me what I'm missing here ?

1

1 Answers

0
votes

The 'im_created' event should not be relied upon, at least on small workspace. Indeed, this what the Slack support person answered to my request:

"I was initially testing on a workspace that had a lot of users. Then I decided to test on a smaller workspace and there, I was able to replicate what you were seeing. Turns out that on smaller workspace when a user joins the workspace, we automatically open DMs with between that user and about 10 other users. So it's possible that the DM channels with your bot already existed because they were created as soon as the user was added to the workspace, hence no im_created events. I tested some more by inviting new users to my small workspace while listening to the im_created event subscribed at a workspace level (not a bot level). As soon as the new user accessed the workspace what do you know? An im_created event is fired. However, this doesn't work if you subscribe at a bot level."

For this use case (welcoming user when starting conversation with the bot), one should use 'app_home_oppened' event and test if it is the beginning of the conversation with your own backend/data, quoting again the Slack support :

"Any way you cut it, this would not have been the right event for your user case, app_home_opened is the right call."