Class Attachment.AttachmentBuilder
- Enclosing class:
- Attachment
public static class Attachment.AttachmentBuilder extends Object
-
Method Summary
Modifier and Type Method Description Attachment.AttachmentBuilderactions(List<Action> actions)Actions are defined as an array, and hashes contained within it will be displayed in as buttons in the message attachment.Attachment.AttachmentBuilderappUnfurl(Boolean appUnfurl)Attachment.AttachmentBuilderappUnfurlUrl(String appUnfurlUrl)Attachment.AttachmentBuilderauthorIcon(String authorIcon)A valid URL that displays a small 16x16px image to the left of the author_name text.Attachment.AttachmentBuilderauthorId(String authorId)Attachment.AttachmentBuilderauthorLink(String authorLink)A valid URL that will hyperlink the author_name text mentioned above.Attachment.AttachmentBuilderauthorName(String authorName)Small text used to display the author's name.Attachment.AttachmentBuilderauthorSubname(String authorSubname)Attachment.AttachmentBuilderblocks(List<LayoutBlock> blocks)Attachment.AttachmentBuilderbotId(String botId)Attachmentbuild()Attachment.AttachmentBuildercallbackId(String callbackId)This is optional value that specifies callback id when there are buttons.Attachment.AttachmentBuilderchannelId(String channelId)Attachment.AttachmentBuilderchannelName(String channelName)Attachment.AttachmentBuildercolor(String color)Like traffic signals, color-coding messages can quickly communicate intent and help separate them from the flow of other messages in the timeline.Attachment.AttachmentBuilderfallback(String fallback)A plain-text summary of the attachment.Attachment.AttachmentBuilderfields(List<Field> fields)Fields are defined as an array, and hashes contained within it will be displayed in a table inside the message attachment.Attachment.AttachmentBuilderfilename(String filename)Attachment.AttachmentBuilderfiles(List<File> files)Attachment.AttachmentBuilderfooter(String footer)Add some brief text to help contextualize and identify an attachment.Attachment.AttachmentBuilderfooterIcon(String footerIcon)To render a small icon beside your footer text, provide a publicly accessible URL string in the footer_icon field.Attachment.AttachmentBuilderfromUrl(String fromUrl)Attachment.AttachmentBuilderid(Integer id)Attachment.AttachmentBuilderimageBytes(Integer imageBytes)Attachment.AttachmentBuilderimageHeight(Integer imageHeight)Attachment.AttachmentBuilderimageUrl(String imageUrl)A valid URL to an image file that will be displayed inside a message attachment.Attachment.AttachmentBuilderimageWidth(Integer imageWidth)Attachment.AttachmentBuilderindent(Boolean indent)Attachment.AttachmentBuildermetadata(Attachment.AttachmentMetadata metadata)Attachment.AttachmentBuildermimetype(String mimetype)Attachment.AttachmentBuildermrkdwnIn(List<String> mrkdwnIn)By default, message text in attachments are not formatted.Attachment.AttachmentBuildermsgSubtype(String msgSubtype)Attachment.AttachmentBuildermsgUnfurl(Boolean msgUnfurl)NOTE: The the following Booleans (is_msg_unfurl, is_reply_unfurl, is_thread_root_unfurl, is_app_unfurl) default to null intentionally to support block attachments.Attachment.AttachmentBuilderoriginalUrl(String originalUrl)Attachment.AttachmentBuilderpretext(String pretext)This is optional text that appears above the message attachment block.Attachment.AttachmentBuilderreplyUnfurl(Boolean replyUnfurl)Attachment.AttachmentBuilderserviceIcon(String serviceIcon)Attachment.AttachmentBuilderserviceName(String serviceName)Attachment.AttachmentBuilderserviceUrl(String serviceUrl)Attachment.AttachmentBuildersize(Integer size)Attachment.AttachmentBuildertext(String text)This is the main text in a message attachment, and can contain standard message markup (see details below).Attachment.AttachmentBuilderthreadRootUnfurl(Boolean threadRootUnfurl)Attachment.AttachmentBuilderthumbHeight(Integer thumbHeight)Attachment.AttachmentBuilderthumbUrl(String thumbUrl)A valid URL to an image file that will be displayed as a thumbnail on the right side of a message attachment.Attachment.AttachmentBuilderthumbWidth(Integer thumbWidth)Attachment.AttachmentBuildertitle(String title)The title is displayed as larger, bold text near the top of a message attachment.Attachment.AttachmentBuildertitleLink(String titleLink)The title is displayed as larger, bold text near the top of a message attachment.StringtoString()Attachment.AttachmentBuilderts(String ts)ts (timestamp) Does your attachment relate to something happening at a specific time?Attachment.AttachmentBuilderurl(String url)Attachment.AttachmentBuildervideoHtml(Attachment.VideoHtml videoHtml)Attachment.AttachmentBuildervideoHtmlHeight(Integer videoHtmlHeight)Attachment.AttachmentBuildervideoHtmlWidth(Integer videoHtmlWidth)Attachment.AttachmentBuildervideoUrl(String videoUrl)
-
Method Details
-
msgSubtype
-
fallback
A plain-text summary of the attachment. This text will be used in clients that don't show formatted text (eg. IRC, mobile notifications) and should not contain any markup.- Returns:
this.
-
callbackId
This is optional value that specifies callback id when there are buttons.- Returns:
this.
-
color
Like traffic signals, color-coding messages can quickly communicate intent and help separate them from the flow of other messages in the timeline.An optional value that can either be one of good, warning, danger, or any hex color code (eg. #439FE0). This value is used to color the border along the left side of the message attachment.
- Returns:
this.
-
pretext
This is optional text that appears above the message attachment block.- Returns:
this.
-
serviceUrl
-
serviceName
-
serviceIcon
-
authorId
-
authorName
Small text used to display the author's name.- Returns:
this.
-
authorLink
A valid URL that will hyperlink the author_name text mentioned above. Will only work if author_name is present.- Returns:
this.
-
authorIcon
A valid URL that displays a small 16x16px image to the left of the author_name text. Will only work if author_name is present.- Returns:
this.
-
fromUrl
-
originalUrl
-
authorSubname
-
channelId
-
channelName
-
id
-
botId
-
indent
-
msgUnfurl
NOTE: The the following Booleans (is_msg_unfurl, is_reply_unfurl, is_thread_root_unfurl, is_app_unfurl) default to null intentionally to support block attachments.- Returns:
this.
-
replyUnfurl
-
threadRootUnfurl
-
appUnfurl
-
appUnfurlUrl
-
title
The title is displayed as larger, bold text near the top of a message attachment. By passing a valid URL in the title_link parameter (optional), the title text will be hyperlinked.- Returns:
this.
-
titleLink
The title is displayed as larger, bold text near the top of a message attachment. By passing a valid URL in the title_link parameter (optional), the title text will be hyperlinked.- Returns:
this.
-
text
This is the main text in a message attachment, and can contain standard message markup (see details below). The content will automatically collapse if it contains 700+ characters or 5+ linebreaks, and will display a "Show more..." link to expand the content.https://api.slack.com/docs/message-attachments#message_formatting
- Returns:
this.
-
fields
Fields are defined as an array, and hashes contained within it will be displayed in a table inside the message attachment.- Returns:
this.
-
imageUrl
A valid URL to an image file that will be displayed inside a message attachment. We currently support the following formats: GIF, JPEG, PNG, and BMP.Large images will be resized to a maximum width of 400px or a maximum height of 500px, while still maintaining the original aspect ratio.
- Returns:
this.
-
imageWidth
-
imageHeight
-
imageBytes
-
thumbUrl
A valid URL to an image file that will be displayed as a thumbnail on the right side of a message attachment. We currently support the following formats: GIF, JPEG, PNG, and BMP.The thumbnail's longest dimension will be scaled down to 75px while maintaining the aspect ratio of the image. The filesize of the image must also be less than 500 KB.
For best results, please use images that are already 75px by 75px.
- Returns:
this.
-
thumbWidth
-
thumbHeight
-
videoUrl
-
videoHtml
-
videoHtmlWidth
-
videoHtmlHeight
-
footer
Add some brief text to help contextualize and identify an attachment. Limited to 300 characters, and may be truncated further when displayed to users in environments with limited screen real estate.- Returns:
this.
-
footerIcon
To render a small icon beside your footer text, provide a publicly accessible URL string in the footer_icon field. You must also provide a footer for the field to be recognized.We'll render what you provide at 16px by 16px. It's best to use an image that is similarly sized.
- Returns:
this.
-
ts
ts (timestamp) Does your attachment relate to something happening at a specific time?By providing the ts field with an integer value in "epoch time", the attachment will display an additional timestamp value as part of the attachment's footer.
Use ts when referencing articles or happenings. Your message will have its own timestamp when published.
- Returns:
this.
-
mrkdwnIn
By default, message text in attachments are not formatted. To enable formatting on attachment fields, add the name of the field (as defined in the API) in this list.- Returns:
this.
-
actions
Actions are defined as an array, and hashes contained within it will be displayed in as buttons in the message attachment.- Returns:
this.
-
blocks
-
files
-
filename
-
size
-
mimetype
-
url
-
metadata
-
build
-
toString
-