Slack has become transformational software for many companies, both large and small. At the core of Slack’s success is its ability to deliver realtime messaging and to integrate with multiple different platforms quickly and easily.

To power these integrations, Slack has built a robust realtime websocket-based API (RTM API) hat allows you to receive events from Slack in real time and send messages as users.

Almost everything that happens in Slack will result in an event being sent to all connected clients. The simplest event is a message sent from a user:

{
    "type": "message",
    "ts": "1358878749.000002",
    "user": "U023BECGF",
    "text": "Hello"
}

Every event has a type property which describes the type of event.  In an event-driven API, we can look at a new message as a significant change in state, that will trigger an event to be sent.

Here’s a diagram from Amazon on Slack’s AWS architecture:

Resources

Slack Real Time Messaging API

Slack Developer Kit for Node.js 

Slack for Go

Slack for Python

SmartSlack Realtime

AWS Slack Case Study