Skip to main content

Table block

Fields

FieldTypeDescriptionRequired?
typestringAlways "table".Required
block_idstringA unique identifier for a block. If not specified, a block_id will be generated. You can use this block_id when you receive an interaction payload to identify the source of the action. Maximum length for this field is 255 characters. block_id should be unique for each message and each iteration of a message. If a message is updated, use a new block_id.Optional
rowsarrayAn array consisting of table rows. Maximum 100 rows. Each row object is an array with a max of 20 table cells. Table cells can have a type of raw_text or rich_text.Required
column_settingsarrayAn array describing column behavior. If there are fewer items in the column_settings array than there are columns in the table, then the items in the the column_settings array will describe the same number of columns in the table as there are in the array itself. Any additional columns will have the default behavior. Maximum 20 items. See below for column settings schema.Optional

Schema for column_settings

FieldTypeDescriptionRequired?
alignstringThe alignment for items in this column. Can be left, center, or right. Defaults to left if not defined.Optional
is_wrappedbooleanWhether the contents of this column should be wrapped or not. Defaults to false if not defined.Optional

Usage info

Apps can programmatically publish messages that include a table by providing a table block in the attachments field of a chat.postMessage request. You must include a value for one of either the top-level blocks or text arguments in the message payload.

The column_settings property lets you change text alignment and text wrapping behavior for table columns. In the example below, the first column has text wrapping enabled and the second column right aligned. Use null to skip a column. Tables may include formatted text (bold text, emoji, mentions, hyperlinks, etc.) by replacing the raw_text element with a standard rich_text block type.

One table is allowed per message, which is appended as an attachment to the bottom of the message. Sending more than one table block will result in the error invalid_attachments with response metadata indicating only_one_table_allowed.

Below is an example attachments value that you should send as a URL-encoded string in your request inside the blocks array.

Examples

{
"type": "table",
"column_settings": [
{
"is_wrapped": true
},
{
"align": "right"
}
],
"rows": [
[
{
"type": "raw_text",
"text": "Header A"
},
{
"type": "raw_text",
"text": "Header B"
}
],
[
{
"type": "raw_text",
"text": "Data 1A"
},
{
"type": "rich_text",
"elements": [
{
"type": "rich_text_section",
"elements": [
{
"text": "Data 1B",
"type": "link",
"url": "https://slack.com"
}
]
}
]
}
],
[
{
"type": "raw_text",
"text": "Data 2A"
},
{
"type": "rich_text",
"elements": [
{
"type": "rich_text_section",
"elements": [
{
"text": "Data 2B",
"type": "link",
"url": "https://slack.com"
}
]
}
]
}
]
]
}