Class Attachment.AttachmentBuilder
- Enclosing class:
- Attachment
-
Method Summary
Modifier and TypeMethodDescriptionActions are defined as an array, and hashes contained within it will be displayed in as buttons in the message attachment.appUnfurlUrl(String appUnfurlUrl) authorIcon(String authorIcon) A valid URL that displays a small 16x16px image to the left of the author_name text.authorLink(String authorLink) A valid URL that will hyperlink the author_name text mentioned above.authorName(String authorName) Small text used to display the author's name.authorSubname(String authorSubname) blocks(List<LayoutBlock> blocks) build()callbackId(String callbackId) This is optional value that specifies callback id when there are buttons.channelName(String channelName) channelTeam(String channelTeam) Like traffic signals, color-coding messages can quickly communicate intent and help separate them from the flow of other messages in the timeline.A plain-text summary of the attachment.Fields are defined as an array, and hashes contained within it will be displayed in a table inside the message attachment.fileAttachment(Boolean fileAttachment) Add some brief text to help contextualize and identify an attachment.footerIcon(String footerIcon) To render a small icon beside your footer text, provide a publicly accessible URL string in the footer_icon field.hideBorder(Boolean hideBorder) imageBytes(Integer imageBytes) imageHeight(Integer imageHeight) A valid URL to an image file that will be displayed inside a message attachment.imageWidth(Integer imageWidth) list(ListAttachment list) listRecord(Attachment.SingleListRecord listRecord) listRecordId(String listRecordId) listRecords(List<ListRecord> listRecords) listSchema(List<ListColumn> listSchema) listViewId(String listViewId) messageBlocks(List<Attachment.MessageBlock> messageBlocks) metadata(Attachment.AttachmentMetadata metadata) By default, message text in attachments are not formatted.msgSubtype(String msgSubtype) NOTE: The following Booleans (is_msg_unfurl, is_reply_unfurl, is_thread_root_unfurl, is_app_unfurl) default to null intentionally to support block attachments.originalUrl(String originalUrl) This is optional text that appears above the message attachment block.preview(Attachment.Preview preview) replyUnfurl(Boolean replyUnfurl) serviceIcon(String serviceIcon) serviceName(String serviceName) serviceUrl(String serviceUrl) This is the main text in a message attachment, and can contain standard message markup (see details below).threadRootUnfurl(Boolean threadRootUnfurl) thumbHeight(Integer thumbHeight) A valid URL to an image file that will be displayed as a thumbnail on the right side of a message attachment.thumbWidth(Integer thumbWidth) The title is displayed as larger, bold text near the top of a message attachment.The title is displayed as larger, bold text near the top of a message attachment.toString()ts (timestamp) Does your attachment relate to something happening at a specific time?videoHtml(Attachment.VideoHtml videoHtml) videoHtmlHeight(Double videoHtmlHeight) videoHtmlWidth(Double videoHtmlWidth)
-
Method Details
-
msgSubtype
- Returns:
this.
-
fallback
A plain-text summary of the attachment. This text will be used in clients that don't show formatted text (e.g. 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.
-
hideColor
- Returns:
this.
-
pretext
This is optional text that appears above the message attachment block.- Returns:
this.
-
serviceUrl
- Returns:
this.
-
serviceName
- Returns:
this.
-
serviceIcon
- Returns:
this.
-
authorId
- Returns:
this.
-
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
- Returns:
this.
-
originalUrl
- Returns:
this.
-
authorSubname
- Returns:
this.
-
channelId
- Returns:
this.
-
channelName
- Returns:
this.
-
channelTeam
- Returns:
this.
-
id
- Returns:
this.
-
appId
- Returns:
this.
-
botId
- Returns:
this.
-
botTeamId
- Returns:
this.
-
indent
- Returns:
this.
-
msgUnfurl
NOTE: 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
- Returns:
this.
-
threadRootUnfurl
- Returns:
this.
-
appUnfurl
- Returns:
this.
-
appUnfurlUrl
- Returns:
this.
-
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://docs.slack.dev/legacy/legacy-messaging/legacy-secondary-message-attachments
- 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
- Returns:
this.
-
imageHeight
- Returns:
this.
-
imageBytes
- Returns:
this.
-
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
- Returns:
this.
-
thumbHeight
- Returns:
this.
-
videoUrl
- Returns:
this.
-
videoHtml
- Returns:
this.
-
videoHtmlWidth
- Returns:
this.
-
videoHtmlHeight
- 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
- Returns:
this.
-
messageBlocks
- Returns:
this.
-
preview
- Returns:
this.
-
fileId
- Returns:
this.
-
listRecordId
- Returns:
this.
-
listRecord
- Returns:
this.
-
listRecords
- Returns:
this.
-
hideBorder
- Returns:
this.
-
listViewId
- Returns:
this.
-
list
- Returns:
this.
-
listSchema
- Returns:
this.
-
listView
- Returns:
this.
-
files
- Returns:
this.
-
filename
- Returns:
this.
-
size
- Returns:
this.
-
mimetype
- Returns:
this.
-
url
- Returns:
this.
-
metadata
- Returns:
this.
-
fileAttachment
- Returns:
this.
-
build
-
toString
-