Reputation: 783
I want my app to respond to direct messages, but its not posting a reply and I can't find anywhere in the docs how to do it. This is what I have tried:
@app.event("app_mention")
def event_test(body, say, logger):
logger.info(body)
say("What's up?")
@app.event('message')
def respond_message(message, say):
say("Hello there.")
@app.message('knock knock')
def respond_message(message, say):
say("Hello there.")
It responds to @app mention, but doesn't respond to direct message...
Upvotes: 2
Views: 1794
Reputation: 1
The above answers are correct
Also in addition to above, if it is a private channel then you would also need the following permission :
message.groups
It can be added from Add bot user event
under event subscriptions.
Upvotes: 0
Reputation: 2891
Can you confirm that your app have required scopes to listen to 'message' event ?
Required scopes for 'message' event:
channels:history
groups:history
im:history
mpim:history
Here are the details:
https://api.slack.com/events/message
Updating my answer for future use:
https://api.slack.com/apis/connections/events-api
Capturing events requires :
Upvotes: 1
Reputation: 783
I figured it out ~ in addition of adding the required scopes, you also have to toggle settings in the App Configuration -> Event Subscriptions tab... Docs could use some improvement tbh.
Upvotes: 4