Go to Slack

Reference: Composition objects

Composition objects can be used inside of block elements and other parts of a message. They are simply common JSON object patterns that you'll encounter frequently when composing a message.

Our guide to composing rich message layouts shows you where and how to add blocks to messages.

Finally, the enabling interactivity guide will help you adjust your app to allow for the use of these interactive components.

The lists of fields and values below describe the JSON that apps can use to generate each object:


Text object

An object containing some text, formatted either as plain_text or using Slack's "mrkdwn".

Fields

Field Type Required? Description
type String Yes The formatting to use for this text object. Can be one of plain_textor mrkdwn.
text Object Yes The text for the block. This field accepts any of the standard text formatting markup when type is mrkdwn.
emoji Boolean No Indicates whether emojis in a text field should be escaped into the colon emoji format. This field is only usable when type is plain_text.
verbatim Boolean No When set to false (as is default) URLs will be auto-converted into links, conversation names will be link-ified, and certain mentions will be automatically parsed.
Using a value of true will skip any preprocessing of this nature, although you can still include manual parsing strings. This field is only usable when type is mrkdwn.

Example

{
  "type": "mrkdwn",
  "text": "A message *with some bold text* and _some italicized text_."
}

Confirmation dialog object

An object that defines a dialog that provides a confirmation step to any interactive element. This dialog will ask the user to confirm their action by offering a confirm and deny buttons.

Fields

Field Type Required? Description
title Object Yes A plain_text-only text object that defines the dialog's title. Maximum length for this field is 100 characters.
text Object Yes A text object that defines the explanatory text that appears in the confirm dialog. Maximum length for the text in this field is 300 characters.
confirm Object Yes A plain_text-only text object to define the text of the button that confirms the action. Maximum length for the text in this field is 30 characters.
deny Object Yes A plain_text-only text object to define the text of the button that cancels the action. Maximum length for the text in this field is 30 characters.

Example

{
  "title": {
      "type": "plain_text",
      "text": "Are you sure?"
  },
  "text": {
      "type": "mrkdwn",
      "text": "Wouldn't you prefer a good game of _chess_?"
  },
  "confirm": {
      "type": "plain_text",
      "text": "Do it"
  },
  "deny": {
      "type": "plain_text",
      "text": "Stop, I've changed my mind!"
  }
}

Option object

An object that represents a single selectable item in a select menu, multi-select menu or overflow menu.

Fields

Field Type Required? Description
text Object Yes A plain_text only text object that defines the text shown in the option on the menu. Maximum length for the text in this field is 75 characters.
value String Yes The string value that will be passed to your app when this option is chosen. Maximum length for this field is 75 characters.
url String No A URL to load in the user's browser when the option is clicked. The url attribute is only available in overflow menus. Maximum length for this field is 3000 characters. If you're using url, you'll still receive an interaction payload and will need to send an acknowledgement response.

Example

{
    "text": {
        "type": "plain_text",
        "text": "Maru"
    },
    "value": "maru"
}

Option group object

Provides a way to group options in a select menu or multi-select menu.

Fields

Field Type Required? Description
label Object Yes A plain_text only text object that defines the label shown above this group of options. Maximum length for the text in this field is 75 characters.
options Object[] Yes An array of option objects that belong to this specific group. Maximum of 100 items.

Example

"option_groups": [
  {
    "label": {
      "type": "plain_text",
      "text": "Group 1"
    },
    "options": [
      {
        "text": {
            "type": "plain_text",
            "text": "*this is plain_text text*"
        },
        "value": "value-0"
      },
      {
        "text": {
            "type": "plain_text",
            "text": "*this is plain_text text*"
        },
        "value": "value-1"
      },
      {
        "text": {
            "type": "plain_text",
            "text": "*this is plain_text text*"
        },
        "value": "value-2"
      }
    ]
  },
  {
    "label": {
        "type": "plain_text",
        "text": "Group 2"
    },
    "options": [
      {
        "text": {
            "type": "plain_text",
            "text": "*this is plain_text text*"
        },
        "value": "value-3"
      }
    ]
  }
]