Choosing the right APIs
The Slack platform is composed of several APIs that let you build apps of all shapes and sizes. Generally, these APIs work together but there’s also a bit of overlap that can sometimes be confusing. This section will help you find the right API for your project.
The Real Time Messaging (RTM) API is one of the most basic ways of connecting another application to Slack. Your app connects to Slack’s infrastructure via a websocket, which creates an always-on connection to Slack.
All activity that happens in your workspace — every message in a public channel, every new channel created, every emoji reaction — is pushed through this channel. The traffic can be overwhelming, especially as your team grows, and maintaining those websocket connections can get onerous. For these reasons, we often recommend using other APIs for building your app.
It’s helpful to think of the Events API as an evolution of RTM — instead of creating an always-on connection that gets a firehose of Slack activity, you pick the events you’re interested in receiving and Slack will send them to an endpoint you specify via HTTP.
No more managing websockets or filtering for a specific message. If your app only needs to take action when someone, say, joins a channel or uses an emoji reaction, just subscribe to that event and wait for it to come to you.
If the Events API is how Slack pings your app, the Web API is how your app pongs back to Slack. Often, this will be because you want to take some action on a Slack workspace, such as composing a message or creating a new channel. Other times, it’s because you want to request something directly, such as a list of all the people in a workspace.
The Conversations API is a subset of the Web API, meaning it’s a set of functions you use to call Slack directly. These functions deal specifically with all of the various channel-like objects that can exist in a Slack workspace, specifically public and private channels, shared channels, external shared channels, DMs, and multiparty DMs.
For the most part, these channel-like objects all behave the same (you can list the users in them, for example), however each conversation will have unique attributes, such as how private it is or whether it's shared across workspaces.