Search code examples
pythonbotsslackslack-api

Is there any way in Slack api to send a message everytime the user starts a new conversation with a bot?


I'm developing a slackbot using python. It's already up and running. But I would like it to send a greeting message everytime someone starts a new conversation with it. Is there any way in slack python api to detect conversation's start?

Haven't tried anything yet.

I want my bot to send a greeting message everytime a new user starts a new conversation with it. Original Slackbot built in slack does this.


Solution

  • I think the event type app_home_opened is what you are looking for.

    This app event notifies your app when a user has entered into the App Home space—that's the place where a user exchanges DMs with your app.

    (...)

    Use the app_home_opened event to begin a friendly onboarding flow from your app, a whimsical welcome message, or a deep-dive into a detailed dialog. Since the app_home_opened event is only sent to your app when a user has already clicked on your app, you can rest assured that your attentions are welcome.