Slack Message Types
There are various types of message content that can be sent to your users:
Text
{
type: "TEXT",
text: "Hello World!",
ephemeral: "ephemeral",
replaceOriginal: true
}
Property | Description | Required |
---|---|---|
type | TEXT | Y |
text | String | Y |
ephemeral | Set “in_channel” or “ephemeral”; Defaults to “in_channel” | N |
replaceOriginal | Set "true" or "false" ; Defaults to "false" | N |
Image
{
type: "IMAGE",
url: "http://image.png",
text: "Some title",
ephemeral: "ephemeral",
replaceOriginal: true
}
Property | Description | Required |
---|---|---|
type | IMAGE | Y |
url | URL of the image file | Y |
text | String | N |
ephemeral | Set “in_channel” or “ephemeral”; Defaults to “in_channel” | N |
replaceOriginal | Set "true" or "false" ; Defaults to "false" | N |
Tips:
- Image must be a valid image file format, including
.jpg
,.jpeg
,.png
and.gif
- Maximum file size is 25MB
Audio
{
type: "AUDIO",
url: "http://audio.mp3",
ephemeral: "ephemeral",
replaceOriginal: true
}
Property | Description | Required |
---|---|---|
type | AUDIO | Y |
url | URL of the audio file | Y |
ephemeral | Set “in_channel” or “ephemeral”; Defaults to “in_channel” | N |
replaceOriginal | Set "true" or "false" ; Defaults to "false" | N |
Tips:
- Audio must be a valid audio file format, including
.aac
,.flac
,.m4a
,.m4p
,.mp3
,.wav
,.wma
- Maximum file size is 25MB
Video
{
type: "VIDEO",
url: "http://video.mp4",
ephemeral: "ephemeral",
replaceOriginal: true
}
Property | Description | Required |
---|---|---|
type | VIDEO | Y |
url | URL of the video file | Y |
ephemeral | Set “in_channel” or “ephemeral”; Defaults to “in_channel” | N |
replaceOriginal | Set "true" or "false" ; Defaults to "false" | N |
Tips:
- Video must be a valid video file format, including
.mkv
,.gif
,.avi
,.wmv
,.rmvb
,.mp4
,.m4v
,.mpg
,.mpeg
,.3gp
- Maximum file size is 25MB
File
{
type: "FILE",
url: "http://file.pdf",
ephemeral: "ephemeral",
replaceOriginal: true
}
Property | Description | Required |
---|---|---|
type | FILE | Y |
url | URL of the file attachment | Y |
ephemeral | Set “in_channel” or “ephemeral”; Defaults to “in_channel” | N |
replaceOriginal | Set "true" or "false" ; Defaults to "false" | N |
Tips:
- File must be a valid file format, including
.pdf
- Maximum file size is 25MB
Button
{
type: "BUTTON",
text: "What can I do to help?",
buttons: [{
type: "postback",
title: "some title",
payload: "a long payload here"
}],
ephemeral: "ephemeral",
replaceOriginal: true
}
Response Object
Property | Description | Required |
---|---|---|
type | BUTTON | Y |
text | String | Y |
buttons | Array of buttons; only "postback" can be set as button type | Y |
ephemeral | Set “in_channel” or “ephemeral”; Defaults to “in_channel” | N |
replaceOriginal | Set "true" or "false" ; Defaults to "false" | N |
buttons Object
Property | Description | Required |
---|---|---|
type | postback | Y |
title | String | Y |
payload | Custom defined payload triggers | Y |
Attachment
Attachment is a type of secondary content that can be added under primary content to provide further information to your users.
{
type: "ATTACHMENT",
text: "some text",
attachments: [Array of attachments objects],
ephemeral: "ephemeral",
replaceOriginal: true
}
Property | Description | Required |
---|---|---|
type | ATTACHMENT | Y |
text | String | N |
attachments | Array of raw attachment JSON (Advanced implementation only) | N |
ephemeral | Set “in_channel” or “ephemeral”; Defaults to “in_channel” | N |
replaceOriginal | Set "true" or "false" ; Defaults to "false" | N |