Skip to main content

Image element

Fields

FieldTypeDescriptionRequired?
typeStringThe type of element. In this case type is always image.Required
alt_textStringA plain-text summary of the image. This should not contain any markup.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

Usage info

Use the image block if you want a block with only an image in it.

Examples

The image element must be used inside of the section block or the context block.

An example of an image element

{
"blocks": [
{
"type": "section",
"block_id": "section567",
"text": {
"type": "mrkdwn",
"text": "This is a section block with an accessory image."
},
"accessory": {
"type": "image",
"image_url": "https://pbs.twimg.com/profile_images/625633822235693056/lNGUneLX_400x400.jpg",
"alt_text": "cute cat"
}
}
]
}

An image block using slack_file with a url:

{
"blocks": [
{
"type": "section",
"block_id": "section567",
"text": {
"type": "mrkdwn",
"text": "This is a section block with an accessory image."
},
"accessory": {
"type": "image",
"slack_file": {
"url": "https://files.slack.com/files-pri/T0123456-F0123456/xyz.png"
},
"alt_text": "Slack file object."
}
}
]
}

An image block using slack_file with a id:

{
"blocks": [
{
"type": "section",
"block_id": "section567",
"text": {
"type": "mrkdwn",
"text": "This is a section block with an accessory image."
},
"accessory": {
"type": "image",
"slack_file": {
"id": "F01234567"
},
"alt_text": "Slack file object."
}
}
]
}