Composition objects can be used inside of block elements and certain message payload fields. They are simply common JSON object patterns that you'll encounter frequently when building blocks or composing messages.
Our guide to Block Kit in app surfaces shows you where you can use blocks.
The lists of fields and values below describe the JSON that apps can use to generate each object:
An object containing some text, formatted either as plain_text
or using mrkdwn
, our proprietary contribution to the much beloved Markdown standard.
Field | Type | Required? | Description |
---|---|---|---|
type |
String | Yes | The formatting to use for this text object. Can be one of plain_text or mrkdwn . |
text |
String | Yes | The text for the block. This field accepts any of the standard text formatting markup when type is mrkdwn . The minimum length is 1 and maximum length is 3000 characters. |
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 . |
{
"type": "mrkdwn",
"text": "A message *with some bold text* and _some italicized text_."
}
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.
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 plain text -only 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. |
style |
String | No | Defines the color scheme applied to the confirm button. A value of danger will display the button with a red background on desktop, or red text on mobile. A value of primary will display the button with a green background on desktop, or blue text on mobile. If this field is not provided, the default value will be primary . |
{
"title": {
"type": "plain_text",
"text": "Are you sure?"
},
"text": {
"type": "plain_text",
"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!"
}
}
An object that represents a single selectable item in a select menu, multi-select menu, checkbox group, radio button group, or overflow menu.
Field | Type | Required? | Description |
---|---|---|---|
text |
Object | Yes | A text object that defines the text shown in the option on the menu. Overflow, select, and multi-select menus can only use plain_text objects, while radio buttons and checkboxes can use mrkdwn text objects. Maximum length for the text in this field is 75 characters. |
value |
String | Yes | A unique string value that will be passed to your app when this option is chosen. Maximum length for this field is 75 characters. |
description |
Object | No | A plain_text only text object that defines a line of descriptive text shown below the text field beside the radio button. Maximum length for the text object within 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. |
{
"text": {
"type": "plain_text",
"text": "Maru"
},
"value": "maru"
}
Provides a way to group options in a select menu or multi-select menu.
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. |
"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"
}
]
}
]
Determines when a plain-text input element will return a block_actions
interaction payload.
Field | Type | Required? | Description |
---|---|---|---|
trigger_actions_on |
String[] | No | An array of interaction types that you would like to receive a block_actions payload for. Should be one or both of:on_enter_pressed — payload is dispatched when user presses the enter key while the input is in focus. Hint text will appear underneath the input explaining to the user to press enter to submit.on_character_entered — payload is dispatched when a character is entered (or removed) in the input. |
{
type: "input",
dispatch_action: true,
element: {
type: "plain_text_input",
multiline: true,
dispatch_action_config: {
trigger_actions_on: ["on_character_entered"]
}
},
label: {
type: "plain_text",
text: "This is a multiline plain-text input",
emoji: true
}
}
Provides a way to filter the list of options in a conversations select menu or conversations multi-select menu.
Field | Type | Required? | Description |
---|---|---|---|
include |
String[] | No | Indicates which type of conversations should be included in the list. When this field is provided, any conversations that do not match will be excluded You should provide an array of strings from the following options: im , mpim , private , and public . The array cannot be empty. |
exclude_external_shared_channels |
Boolean | No | Indicates whether to exclude external shared channels from conversation lists. This field will not exclude users from shared channels. Defaults to false . |
exclude_bot_users |
Boolean | No | Indicates whether to exclude bot users from conversation lists. Defaults to false . |
Please note that while none of the fields above are individually required, you must supply at least one of these fields.
{
"type": "conversations_select",
"placeholder": {
"type": "plain_text",
"text": "Select a conversation",
"emoji": true
},
"filter": {
"include": [
"public",
"mpim"
],
"exclude_bot_users" : true
}
}
In iOS, the placeholder text is replaced with "0 selected" when there are no selected conversations.
In iOS, there are UI inconsistencies when users select items in multi-select menus.
Contains information about a workflow.
Field | Type | Required? | Description |
---|---|---|---|
trigger |
Object | Yes | A trigger object that contains information about a workflow's trigger. |
{
"trigger": {
"url": "https://slack.com/shortcuts/Ft012KXZK1MZ/8831723c452aac3e87c6d3219bebd44c",
"customizable_input_parameters": [
{
"name": "input_parameter_a",
"value": "Value for input param A"
},
{
"name": "input_parameter_b",
"value": "Value for input param B"
}
]
}
}
Contains information about a trigger.
Field | Type | Required? | Description |
---|---|---|---|
url |
String | Yes | A link trigger URL. Must be associated with a valid trigger. |
customizable_input_parameters |
Object[] | No | An array of input parameter objects. Each specified name must match an input parameter defined on the workflow of the provided trigger (url), and the input parameter mapping on the trigger must be set as customizable: true . Each specified value must match the type defined by the workflow input parameter of the matching name. |
The values used for these customizable_input_parameters
may be visible client-side to end users. You should not share sensitive information or secrets via these input parameters.
{
"url": "https://slack.com/shortcuts/Ft012KXZK1MZ/8831723c452aac3e87c6d3219bebd44c",
"customizable_input_parameters": [
{
"name": "input_parameter_a",
"value": "Value for input param A"
},
{
"name": "input_parameter_b",
"value": "Value for input param B"
}
]
}
Contains information about an input parameter.
Field | Type | Required? | Description |
---|---|---|---|
name |
string | Yes | The name of the input parameter. |
value |
string | Yes | The value of the input parameter. |
{
"name": "input_parameter_a",
"value": "Value for input param A"
}