Messages are the oxygen that keeps conversations alive. They have many shapes and sizes, varying levels of complexity. They can exist merely to notify, or they can invite and await response.
The core functionality of most Slack apps will involve the publication or consumption of messages. In this overview we're going to give you a quick trip through the basics of doing these things, and an introduction to all the terminology that surrounds messaging.
These instructions pertain to content posted programmatically to Slack. For instructions on sending and reading messages within Slack itself, consult this help center article.
There can be a huge variation in how messages appear. For example, this is a message:
And so is this:
At a basic level, messages are simply a series of attributes which describe and contain content.
Apps also have access to a range of composition and interactivity options for controlling the look and feel of messages. You can read the overview guides for those topics to get a better sense of what is possible, but for now let's learn about the environment that messages exist in.
In Slack, messages inhabit conversations. A conversation is a catch all term that covers public channels, private channels, direct message conversations, and group (or multi-party) direct message conversations.
Different conversations will have varying levels of visibility and publishing permission, which is important when you're trying to create messages programmatically, we'll cover this more in our sending messages guide.
While most messages will be visible to everyone within the conversation they're published in, apps also have the ability to show a message temporarily to one specific user.
These are called ephemeral messages, and in most other respects they're like any other message - composed in the same way, published in much the same way, and viewed within the same types of conversations in Slack.
The only differences are that only one user within that conversation will see them, and that they do not persist across reloads, between desktop and mobile apps, or across sessions.
Use ephemeral messages when you want to send someone a context-sensitive message that isn't suitable for the wider conversation. For example, if a user invokes one of your app's slash commands that performs some action on a third-party service, an ephemeral message might be the most suitable way to inform that user of the success of the action.
Ephemeral messages should only ever be sent in response to some user action, they must never be unexpected or unsolicited. If you want to send a message to a specific user in any other situation, send them a DM.
Due to their ghostly nature ephemeral messages cannot be retrieved via our APIs, nor will they show up in interaction payloads.
Deleting or updating ephemeral messages is a bit more complicated — you can do it, but only in response to an interaction with the message itself. Read our guide to learn more about deleting or updating messages in response to interactions.
Most messages stand alone, seen or unseen, inside a conversation. Some messages, however, generate such conversation that replies erupt forth, forming a thread in their wake.
Slack apps can read and write messages in threads with ease. Before we explain how, let's tread some thread terminology:
To learn how your app can spot and retrieve threaded messages, read our retrieving messages guide. Or if you want to find out how to publish messages as threaded replies, read our sending messages guide.