Slack messages¶
Before we start coding let’s find out how Slack is composing the message. You can always refer to official documentation.
We are only going to cover parts we will use through out the guide, plase refer to full message documentation if needed.
Slack message is a simple JSON object.
{
"text": "A message text",
"blocks": [],
"mrkdwn": true
}
Field | Type | Required? | Description |
---|---|---|---|
text | String | Yes | Text of the message usually used inside notification popups. (not required when using blocks) |
blocks | Array | No | An array of layout blocks, in the same format as described in the layout block guide |
We are going to use a new Slack feature blocks to compose our messages.
Our main block components will be Section Block which is similar to the message.
And Action blocks is used for interactive components like buttons and menus.
Most important block attributes to understand are: type
, block_id
, fields
and elements
.
Please go to the documentation and try it out using a block-kit-builder.
There are other Slack objects we are going to deal with