Slack bot that responds to all public messages?

576 Views Asked by At

I am creating a Slack app that listens for a type of message (ie. one that starts with the word "bot") from a user in any public channel, and responds to that with an action.

I can manage all of this using the Events API, but the delay on each request is unusably slow. If I use the RTM websocket API, the response would be near instant.

However, the RTM API rate limits connections to one user per minute. An app with 120 users would take 2 hours to start up.

Is there a way I can create one connection per workspace? Ideally this would combine all messages sent in that team and I would filter extraneous messages out later.

Things I've tried:

  • adding the bot to every channel in the workspace. This is not very practical.

Thank you in advance!

1

There are 1 best solutions below

1
On

This is the scenario the app_mention event was created to solve. The app_mention allows your app to behave like other users in a workspace — when they are mentioned, the user has the option to invite the bot into channel. If the bot is invited in, your app receives the message and can respond accordingly.