Slack Event API for Bot Mentions

前端 未结 2 1748
梦毁少年i
梦毁少年i 2020-12-18 15:40

I\'m building a Slack bot using a Slack App. I have managed to authorise and am successfully receiving events via the Event API.

I\'m trying to find out how to listen

2条回答
  •  时光说笑
    2020-12-18 16:02

    Subscribe to the app_mention event instead of the message.channels to receive events mentioning your app/bot.

    Here's an example payload from slack:

    {
        "type": "app_mention",
        "user": "U061F7AUR",
        "text": "<@U0LAN0Z89> is it everything a river should be?",
        "ts": "1515449522.000016",
        "channel": "C0LAN2Q65",
        "event_ts": "1515449522000016"
    }
    

    Subscribe to the message.im also if you want to receive Direct message events.

    More info on the app_mention event - https://api.slack.com/events/app_mention

    Hope that helps :)

提交回复
热议问题