Skip to main content

Image block

Fields​

FieldTypeDescriptionRequired?
typeStringThe type of block. For an image block, type is always image.Required
alt_textStringA plain-text summary of the image. This should not contain any markup. Maximum length for this field is 2000 characters.Required
image_urlStringThe URL for a publicly hosted image. You must provide either an image_url or slack_file. Maximum length for this field is 3000 characters.Optional
slack_fileObjectA Slack image file object that defines the source of the image.Optional
titleObjectAn optional title for the image in the form of a text object that can only be of type: plain_text. Maximum length for the text in this field is 2000 characters.Optional
block_idStringA unique identifier for a block. If not specified, one will be generated. 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

Usage info​

An image block, designed to make those cat photos really pop. Supported file types include png, jpg, jpeg, and gif.

Examples​

The following three examples show different ways to get the following result:

An example of an image block

Example 1: An image block using image_url:

{
"blocks": [
{
"type": "image",
"title": {
"type": "plain_text",
"text": "Please enjoy this photo of a kitten"
},
"block_id": "image4",
"image_url": "http://placekitten.com/500/500",
"alt_text": "An incredibly cute kitten."
}
]
}

View in Block Kit Builder (opens in new tab)


Example 2: An image block using slack_file with a url:

{
"blocks": [
{
"type": "image",
"title": {
"type": "plain_text",
"text": "Please enjoy this photo of a kitten"
},
"block_id": "image4",
"slack_file": {
"url": "https://files.slack.com/files-pri/T0123456-F0123456/xyz.png"
},
"alt_text": "An incredibly cute kitten."
}
]
}

View in Block Kit Builder (opens in new tab)


Example 3: An image block using slack_file with a id:

{
"blocks": [
{
"type": "image",
"title": {
"type": "plain_text",
"text": "Please enjoy this photo of a kitten"
},
"block_id": "image4",
"slack_file": {
"id": "F0123456"
},
"alt_text": "An incredibly cute kitten."
}
]
}

View in Block Kit Builder (opens in new tab)