Class Attachment.AttachmentBuilder
- java.lang.Object
-
- com.slack.api.model.Attachment.AttachmentBuilder
-
- Enclosing class:
- Attachment
public static class Attachment.AttachmentBuilder extends Object
-
-
Method Summary
All Methods Instance Methods Concrete Methods 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 Detail
-
msgSubtype
public Attachment.AttachmentBuilder msgSubtype(String msgSubtype)
- Returns:
this.
-
fallback
public Attachment.AttachmentBuilder fallback(String 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
public Attachment.AttachmentBuilder callbackId(String callbackId)
This is optional value that specifies callback id when there are buttons.- Returns:
this.
-
color
public Attachment.AttachmentBuilder color(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.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
public Attachment.AttachmentBuilder pretext(String pretext)
This is optional text that appears above the message attachment block.- Returns:
this.
-
serviceUrl
public Attachment.AttachmentBuilder serviceUrl(String serviceUrl)
- Returns:
this.
-
serviceName
public Attachment.AttachmentBuilder serviceName(String serviceName)
- Returns:
this.
-
serviceIcon
public Attachment.AttachmentBuilder serviceIcon(String serviceIcon)
- Returns:
this.
-
authorId
public Attachment.AttachmentBuilder authorId(String authorId)
- Returns:
this.
-
authorName
public Attachment.AttachmentBuilder authorName(String authorName)
Small text used to display the author's name.- Returns:
this.
-
authorLink
public Attachment.AttachmentBuilder authorLink(String authorLink)
A valid URL that will hyperlink the author_name text mentioned above. Will only work if author_name is present.- Returns:
this.
-
authorIcon
public Attachment.AttachmentBuilder authorIcon(String 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
public Attachment.AttachmentBuilder fromUrl(String fromUrl)
- Returns:
this.
-
originalUrl
public Attachment.AttachmentBuilder originalUrl(String originalUrl)
- Returns:
this.
-
authorSubname
public Attachment.AttachmentBuilder authorSubname(String authorSubname)
- Returns:
this.
-
channelId
public Attachment.AttachmentBuilder channelId(String channelId)
- Returns:
this.
-
channelName
public Attachment.AttachmentBuilder channelName(String channelName)
- Returns:
this.
-
id
public Attachment.AttachmentBuilder id(Integer id)
- Returns:
this.
-
botId
public Attachment.AttachmentBuilder botId(String botId)
- Returns:
this.
-
indent
public Attachment.AttachmentBuilder indent(Boolean indent)
- Returns:
this.
-
msgUnfurl
public Attachment.AttachmentBuilder msgUnfurl(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.- Returns:
this.
-
replyUnfurl
public Attachment.AttachmentBuilder replyUnfurl(Boolean replyUnfurl)
- Returns:
this.
-
threadRootUnfurl
public Attachment.AttachmentBuilder threadRootUnfurl(Boolean threadRootUnfurl)
- Returns:
this.
-
appUnfurl
public Attachment.AttachmentBuilder appUnfurl(Boolean appUnfurl)
- Returns:
this.
-
appUnfurlUrl
public Attachment.AttachmentBuilder appUnfurlUrl(String appUnfurlUrl)
- Returns:
this.
-
title
public Attachment.AttachmentBuilder title(String 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
public Attachment.AttachmentBuilder titleLink(String 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
public Attachment.AttachmentBuilder text(String 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
public Attachment.AttachmentBuilder fields(List<Field> 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
public Attachment.AttachmentBuilder imageUrl(String 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
public Attachment.AttachmentBuilder imageWidth(Integer imageWidth)
- Returns:
this.
-
imageHeight
public Attachment.AttachmentBuilder imageHeight(Integer imageHeight)
- Returns:
this.
-
imageBytes
public Attachment.AttachmentBuilder imageBytes(Integer imageBytes)
- Returns:
this.
-
thumbUrl
public Attachment.AttachmentBuilder thumbUrl(String 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
public Attachment.AttachmentBuilder thumbWidth(Integer thumbWidth)
- Returns:
this.
-
thumbHeight
public Attachment.AttachmentBuilder thumbHeight(Integer thumbHeight)
- Returns:
this.
-
videoUrl
public Attachment.AttachmentBuilder videoUrl(String videoUrl)
- Returns:
this.
-
videoHtml
public Attachment.AttachmentBuilder videoHtml(Attachment.VideoHtml videoHtml)
- Returns:
this.
-
videoHtmlWidth
public Attachment.AttachmentBuilder videoHtmlWidth(Integer videoHtmlWidth)
- Returns:
this.
-
videoHtmlHeight
public Attachment.AttachmentBuilder videoHtmlHeight(Integer videoHtmlHeight)
- Returns:
this.
-
footer
public Attachment.AttachmentBuilder footer(String 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
public Attachment.AttachmentBuilder footerIcon(String 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
public Attachment.AttachmentBuilder ts(String 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
public Attachment.AttachmentBuilder mrkdwnIn(List<String> 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
public Attachment.AttachmentBuilder actions(List<Action> 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
public Attachment.AttachmentBuilder blocks(List<LayoutBlock> blocks)
- Returns:
this.
-
files
public Attachment.AttachmentBuilder files(List<File> files)
- Returns:
this.
-
filename
public Attachment.AttachmentBuilder filename(String filename)
- Returns:
this.
-
size
public Attachment.AttachmentBuilder size(Integer size)
- Returns:
this.
-
mimetype
public Attachment.AttachmentBuilder mimetype(String mimetype)
- Returns:
this.
-
url
public Attachment.AttachmentBuilder url(String url)
- Returns:
this.
-
metadata
public Attachment.AttachmentBuilder metadata(Attachment.AttachmentMetadata metadata)
- Returns:
this.
-
build
public Attachment build()
-
-