Class Attachment

java.lang.Object
com.slack.api.model.Attachment

public class Attachment extends Object
https://api.slack.com/docs/message-attachments
  • Constructor Details

  • Method Details

    • isIndent

      public Boolean isIndent()
    • setIndent

      public void setIndent(Boolean indent)
    • isMsgUnfurl

      public Boolean isMsgUnfurl()
    • setMsgUnfurl

      public void setMsgUnfurl(Boolean msgUnfurl)
    • isReplyUnfurl

      public Boolean isReplyUnfurl()
    • setReplyUnfurl

      public void setReplyUnfurl(Boolean replyUnfurl)
    • isThreadRootUnfurl

      public Boolean isThreadRootUnfurl()
    • setThreadRootUnfurl

      public void setThreadRootUnfurl(Boolean threadRootUnfurl)
    • isAppUnfurl

      public Boolean isAppUnfurl()
    • setAppUnfurl

      public void setAppUnfurl(Boolean appUnfurl)
    • builder

      public static Attachment.AttachmentBuilder builder()
    • getMsgSubtype

      public String getMsgSubtype()
    • getFallback

      public String getFallback()
      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.
    • getCallbackId

      public String getCallbackId()
      This is optional value that specifies callback id when there are buttons.
    • getColor

      public String getColor()
      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.

    • getPretext

      public String getPretext()
      This is optional text that appears above the message attachment block.
    • getServiceUrl

      public String getServiceUrl()
    • getServiceName

      public String getServiceName()
    • getServiceIcon

      public String getServiceIcon()
    • getAuthorId

      public String getAuthorId()
    • getAuthorName

      public String getAuthorName()
      Small text used to display the author's name.
    • getAuthorLink

      public String getAuthorLink()
      A valid URL that will hyperlink the author_name text mentioned above. Will only work if author_name is present.
    • getAuthorIcon

      public String getAuthorIcon()
      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.
    • getFromUrl

      public String getFromUrl()
    • getOriginalUrl

      public String getOriginalUrl()
    • getAuthorSubname

      public String getAuthorSubname()
    • getChannelId

      public String getChannelId()
    • getChannelName

      public String getChannelName()
    • getId

      public Integer getId()
    • getBotId

      public String getBotId()
    • getAppUnfurlUrl

      public String getAppUnfurlUrl()
    • getTitle

      public String getTitle()
      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.
    • getTitleLink

      public String getTitleLink()
      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.
    • getText

      public String getText()
      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

    • getFields

      public List<Field> getFields()
      Fields are defined as an array, and hashes contained within it will be displayed in a table inside the message attachment.
    • getImageUrl

      public String getImageUrl()
      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.

    • getImageWidth

      public Integer getImageWidth()
    • getImageHeight

      public Integer getImageHeight()
    • getImageBytes

      public Integer getImageBytes()
    • getThumbUrl

      public String getThumbUrl()
      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.

    • getThumbWidth

      public Integer getThumbWidth()
    • getThumbHeight

      public Integer getThumbHeight()
    • getVideoUrl

      public String getVideoUrl()
    • getVideoHtml

      public Attachment.VideoHtml getVideoHtml()
    • getVideoHtmlWidth

      public Integer getVideoHtmlWidth()
    • getVideoHtmlHeight

      public Integer getVideoHtmlHeight()
    • getFooter

      public String getFooter()
      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.
    • getFooterIcon

      public String getFooterIcon()
      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.

    • getTs

      public String getTs()
      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.

    • getMrkdwnIn

      public List<String> getMrkdwnIn()
      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.
    • getActions

      public List<Action> getActions()
      Actions are defined as an array, and hashes contained within it will be displayed in as buttons in the message attachment.
    • getBlocks

      public List<LayoutBlock> getBlocks()
    • getFiles

      public List<File> getFiles()
    • getFilename

      public String getFilename()
    • getSize

      public Integer getSize()
    • getMimetype

      public String getMimetype()
    • getUrl

      public String getUrl()
    • getMetadata

      public Attachment.AttachmentMetadata getMetadata()
    • setMsgSubtype

      public void setMsgSubtype(String msgSubtype)
    • setFallback

      public void setFallback(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.
    • setCallbackId

      public void setCallbackId(String callbackId)
      This is optional value that specifies callback id when there are buttons.
    • setColor

      public void setColor(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.

    • setPretext

      public void setPretext(String pretext)
      This is optional text that appears above the message attachment block.
    • setServiceUrl

      public void setServiceUrl(String serviceUrl)
    • setServiceName

      public void setServiceName(String serviceName)
    • setServiceIcon

      public void setServiceIcon(String serviceIcon)
    • setAuthorId

      public void setAuthorId(String authorId)
    • setAuthorName

      public void setAuthorName(String authorName)
      Small text used to display the author's name.
    • setAuthorLink

      public void setAuthorLink(String authorLink)
      A valid URL that will hyperlink the author_name text mentioned above. Will only work if author_name is present.
    • setAuthorIcon

      public void setAuthorIcon(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.
    • setFromUrl

      public void setFromUrl(String fromUrl)
    • setOriginalUrl

      public void setOriginalUrl(String originalUrl)
    • setAuthorSubname

      public void setAuthorSubname(String authorSubname)
    • setChannelId

      public void setChannelId(String channelId)
    • setChannelName

      public void setChannelName(String channelName)
    • setId

      public void setId(Integer id)
    • setBotId

      public void setBotId(String botId)
    • setAppUnfurlUrl

      public void setAppUnfurlUrl(String appUnfurlUrl)
    • setTitle

      public void setTitle(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.
    • setTitleLink

      public void setTitleLink(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.
    • setText

      public void setText(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

    • setFields

      public void setFields(List<Field> fields)
      Fields are defined as an array, and hashes contained within it will be displayed in a table inside the message attachment.
    • setImageUrl

      public void setImageUrl(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.

    • setImageWidth

      public void setImageWidth(Integer imageWidth)
    • setImageHeight

      public void setImageHeight(Integer imageHeight)
    • setImageBytes

      public void setImageBytes(Integer imageBytes)
    • setThumbUrl

      public void setThumbUrl(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.

    • setThumbWidth

      public void setThumbWidth(Integer thumbWidth)
    • setThumbHeight

      public void setThumbHeight(Integer thumbHeight)
    • setVideoUrl

      public void setVideoUrl(String videoUrl)
    • setVideoHtml

      public void setVideoHtml(Attachment.VideoHtml videoHtml)
    • setVideoHtmlWidth

      public void setVideoHtmlWidth(Integer videoHtmlWidth)
    • setVideoHtmlHeight

      public void setVideoHtmlHeight(Integer videoHtmlHeight)
    • setFooter

      public void setFooter(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.
    • setFooterIcon

      public void setFooterIcon(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.

    • setTs

      public void setTs(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.

    • setMrkdwnIn

      public void setMrkdwnIn(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.
    • setActions

      public void setActions(List<Action> actions)
      Actions are defined as an array, and hashes contained within it will be displayed in as buttons in the message attachment.
    • setBlocks

      public void setBlocks(List<LayoutBlock> blocks)
    • setFiles

      public void setFiles(List<File> files)
    • setFilename

      public void setFilename(String filename)
    • setSize

      public void setSize(Integer size)
    • setMimetype

      public void setMimetype(String mimetype)
    • setUrl

      public void setUrl(String url)
    • setMetadata

      public void setMetadata(Attachment.AttachmentMetadata metadata)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object