An overview of message composition

The message is at the core of how you communicate in Slack and apps also use messages to interact with your team members.

In this overview, we'll outline the core concepts needed to compose messages. We'll also introduce the visual tools you need to make your app's messages compelling and memorable.

These are developer instructions covering content posted to Slack via APIs. For user instructions on message formatting in Slack clients, consult this help center article.

Basic message structure

You can send postal mail in the United States using lots of different mail carriers, but each carrier uses the same standardized format for addresses.

Similarly, there are multiple ways for Slack apps to send messages, but all of them use the same message format.

The contents of a message are determined by a JSON object that we call the message payload. Using these fields together to choose the message's appearance and interactive functionality is what we call message composition.

You can read our reference guide to message payloads to see the basic structure of message JSON objects.

Our guide to sending messages elaborates on the payload fields that control things like the destination or visibility of app-published messages.

In this guide, however, we'll focus purely on message composition, starting with how you can format text.

Text formatting

A message with basic formatting

The base message is a plain, unformatted string of text --- just like this paragraph.

You can easily introduce a bit of boldness or some emphasis to make those messages easier to read and understand. You might also want to include some inline code, add an emoji πŸ’‘, or lay things out in a list:

  1. Add some bold text
  2. Add some italicized text
  3. Add some inline code

To accomplish this formatting and more, Slack apps can use a markup style in message text called mrkdwn.

Read our formatting text for app surfaces guide to learn more.

Advanced formatting

A message with advanced formatting

Beyond changing the appearance of text, there are also parsing options that can turn text into something more useful.

You can use special sequences of characters to:

Read our advanced formatting guide to learn more about these options.

Complex message layouts

A complex message layout that uses blocks

Messages don’t have to be just text notifications, though. They can include rich formatting and complex user interfaces. To create these types of messages, you’ll use a UI framework we call Block Kit. These powerful building blocks for messages allow you to build complete workflows right inside Slack, that work just as well on our mobile devices as they do on your desktop, without any additional code or configuration.

As the name implies, you build messages out of individual (or groups of) pre-defined blocks such as text, thumbnail images, dividers, and interactive elements like buttons, dropdown menus, and date pickers. Even with a relatively small number of starting blocks, it's possible to customize interfaces unique to the needs of your workflow.

Block Kit UI's are defined as JSON. We also have a tool called Block Kit Builder for creating sample messages that will generate the corresponding JSON automatically. This is great for letting anyone on your team sketch out some ideas for messages and then copy and paste the resulting JSON.

Learn how to use these features to maximise your messaging magic by reading our guide to using blocks in message layouts.

Block Kit also opens your app's messages up to possible participation, with interactive components that enable workflows and integrations to be stitched right into the message.

Read more about these in our separate overview of making messages interactive.

Secondary message content

This feature is a legacy part of messaging functionality for Slack apps. We recommend you try to stick with Block Kit as above.

A complex message layout with secondary content attached

Sometimes your app will want to include content that isn't quite as vital as the rest of the message. There's a way to make this distinction visual: using message attachments.

Attachments allow you to include basic text, or complex block layouts, in a less urgent, secondary message section.

Read our guide to attaching secondary content to learn more.