A decoration for Slack messages. It is effective for enriching the messages posted by notification bots. The following image is a comparison between without attachment and with attachment.
fallback
A plain text summary for the attachment. According to the documentation, it appears on clients that don't display formatted text, but I haven't come across any clients or scenes that do yet. As the name "fallback" suggests, it's a good idea to specify a summary text of attachments just in case.
"fallback": "This is test attachment",
color
Specify the color of attachments. There are 3 types of presets, and it is also possible to specify by color code.
The colors of the signal, such as blue, yellow, and red, respectively.
It is also possible to specify any color with the color code.
Attachments with no color specified are displayed as follows.
preset
"color": "good",
Color code
"color": "#FFC0CB",
pretext
Specifies the text to appear above the attachments block (the area that appears next to the ↑ color).
If you have text
in the message body as shown in the capture below, it will be indistinguishable.
It is effective when adding multiple attachments.
"pretext": "This is pretext",
author parameters
A set of parameters that specify Author information (starting with ʻauthor_`).
"author_name": "daikiojm",
"author_link": "http://qiita.com/daikiojm",
"author_icon": "https://avatars1.githubusercontent.com/u/10055293?v=3&u=1d1491fc3c27e10e93cc364ee0556a3b768c29b2&s=100"
title
The title of attachment.
"title": "TEST",
title_link
The title link.
"title_link": "http://qiita.com/daikiojm",
text
The body of the attachment.
"text": "test:goode",
Line breaks\at n
"text": "test:goode\ntest2",
fields
It is used when you want to display multiple groups in one attachment. An image that nests attachments inside attachments.
Side-by-side fields (when short is specified)
"fields": [
{
"title": "fields attachment1",
"value": "fields test",
},
{
"title": "fields attachment2",
"value": "fields test",
}
]
short
"fields": [
{
"title": "fields attachment1",
"value": "fields test",
"short": "true"
},
{
"title": "fields attachment2",
"value": "fields test",
"short": "true"
}
]
image_url
Specify the image URL to be embedded in attachment. Supported formats are GIF, JPEG, PNG, BMP
"image_url": "https://qiita-image-store.s3.amazonaws.com/0/79414/ea00d65c-b9b7-3b97-df98-11d5b2fc6bfa.png ",
thumb_url
Specify the thumbnail image URL to be embedded in attachment. Supported formats are GIF, JPEG, PNG, BMP The way the image is displayed is different from ʻimage_url`.
"thumb_url": "https://qiita-image-store.s3.amazonaws.com/0/79414/741aebb5-d320-4eb1-f765-59d462f32515.png ",
footer
A set of parameters for footer information to be embedded in attachment.
"footer": "Send from Python",
"footer_icon": "https://avatars1.githubusercontent.com/u/10055293?v=3&u=1d1491fc3c27e10e93cc364ee0556a3b768c29b2&s=100",
"ts": "1498894191",
slack API: Attaching content
Recommended Posts