Image block
Fields
Field | Type | Description | Required? |
---|---|---|---|
type | String | The type of block. For an image block, type is always image . | Required |
alt_text | String | A plain-text summary of the image. This should not contain any markup. Maximum length for this field is 2000 characters. | Required |
image_url | String | The 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_file | Object | A Slack image file object that defines the source of the image. | Optional |
title | Object | An 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_id | String | A 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 image block using image_url
:
{
"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."
}
An image block using slack_file
with a url
:
{
"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."
}
An image block using slack_file
with a id
:
{
"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."
}