To implement a slack bot, i need to deal with 'Real Time Messaging API' of slack. It is a WebSocket-based API that allows you to receive events from Slack in real time and send messages as user. more info: https://api.slack.com/rtm
To create a bot for only one team, i need to open one websocket connection and listen it for events.
To make available the slack bot for another team. I need to open a new websocket connection. So,
what should i do to scale my websocket connections for endless teams?
What kind of architecture can handle autoscaling of 1000’s of websockets connections?
Go to api.slack.com/apps, click Create an App, enter a name for your app, and select the correct Slack account where you want to use the new Slack bot. Slack will then show some options to add features to your app. You can add bot users, interactive messages, and more—but each of those requires coding.
Acting as a direct sales channel. These bots integrate with project management software, CRMs and a variety of other processes used to close sales. They also improve visibility between sales, marketing, customer care, and product design, which allows everyone to work towards a common goal.
Click the Slackbot tab, and you'll see an option to add new responses (provided your Slack administrator allows everyone to add new ones). You can put any text you like on the input side (what you type in a message) and output side (how Slackbot will respond).
With slack sockets, you have lots of things to scale:
The other thing to consider is fault-tolerance. Let's say you did sticky load balancing and one of your servers is handling 50 teams. That server is the only one handling those 50 teams so if it goes down then all 50 bots go offline. Alternatively, you can open up multiple sockets per team on separate servers and use a message handling queue so that each message is only responded to once.
So the architecture I would propose is a thin, redundant load balancer for RTM sockets as a first layer, and a reliable message queue underneath that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With