Skip to main content

Payloads And Views

This page documents the public Java API for payloads and views, generated from the Javadoc by the javadoc tool. Values are immutable, builders are concrete and fluent, validation runs when you call .build(), and typed getters read built values back.

Attachment

A legacy message attachment containing blocks and an optional color bar.

Start with builder(), set fields with the named fluent methods, and call Builder.build() to validate and create an immutable value.

  • Only blocks supported in messages are accepted.

See the Slack reference.

Builder

Starts a new builder.

public static Attachment.Builder builder()

Returns: a new builder

Related types: Attachment

GetBlocks

Returns the attachment's blocks in display order.

public List<Block> getBlocks()

Returns: the values in order, or an empty list when none were set

ThrowsWhen
IllegalStateExceptionif the field was set through a raw wire field to a value this type cannot represent

Related types: Block

GetColor

Returns the attachment's left border color: a six-digit hex color or good, warning, or danger.

public Optional<String> getColor()

Returns: the value, or an empty optional when it was not set

ThrowsWhen
IllegalStateExceptionif the field was set through a raw wire field to a value this type cannot represent

GetFallback

Returns plain-text summary shown in clients that cannot display attachments.

public Optional<String> getFallback()

Returns: the value, or an empty optional when it was not set

ThrowsWhen
IllegalStateExceptionif the field was set through a raw wire field to a value this type cannot represent

Blocks

Adds the attachment's blocks in display order.

Each call appends to any values already added.

public Attachment.Builder blocks(Block... values)
ParameterDescription
valuesBlock values appended in order

Returns: this builder

Related types: Attachment, Block

Color

Sets the attachment's left border color: a six-digit hex color or good, warning, or danger.

public Attachment.Builder color(String value)
ParameterDescription
valuevalue for Slack's color field

Returns: this builder

Related types: Attachment

Fallback

Sets plain-text summary shown in clients that cannot display attachments.

public Attachment.Builder fallback(String value)
ParameterDescription
valuevalue for Slack's fallback field

Returns: this builder

Related types: Attachment

WireField

Sets a Slack field that has no named method yet, such as a field Slack introduced after this release. Prefer the named methods, which are typed and documented.

The value is checked at build time like any other field. It must be a string, number, boolean, slackblocks value or builder, or a list or map containing only those.

public Attachment.Builder wireField(String field, Object value)
ParameterDescription
fieldSlack JSON field name
valueJSON-compatible value

Returns: this builder

ThrowsWhen
IllegalArgumentExceptionif the field name is empty or the value cannot be written as Slack JSON

Related types: Attachment

Build

Validates the configured fields and creates an immutable value. The builder can be reused.

public Attachment build()

Returns: an immutable Attachment

ThrowsWhen
ValidationExceptionif the value breaks a Block Kit rule, such as a missing required field or an exceeded length limit

Related types: Attachment

HomeTabView

The payload for publishing an App Home tab with views.publish.

Start with builder(), set fields with the named fluent methods, and call Builder.build() to validate and create an immutable value.

  • Required: blocks.

  • Only blocks supported on the App Home tab are accepted.

See the Slack reference.

Builder

Starts a new builder.

public static HomeTabView.Builder builder()

Returns: a new builder

Related types: HomeTabView

GetBlocks

Returns the blocks shown on the App Home tab, in display order.

public List<Block> getBlocks()

Returns: the values in order, or an empty list when none were set

ThrowsWhen
IllegalStateExceptionif the field was set through a raw wire field to a value this type cannot represent

Related types: Block

GetPrivateMetadata

Returns application-defined data returned in view payloads.

public Optional<String> getPrivateMetadata()

Returns: the value, or an empty optional when it was not set

ThrowsWhen
IllegalStateExceptionif the field was set through a raw wire field to a value this type cannot represent

GetCallbackId

Returns an identifier returned in view payloads so your app can recognize the view.

public Optional<String> getCallbackId()

Returns: the value, or an empty optional when it was not set

ThrowsWhen
IllegalStateExceptionif the field was set through a raw wire field to a value this type cannot represent

GetExternalId

Returns a workspace-unique identifier you can use to update the view later.

public Optional<String> getExternalId()

Returns: the value, or an empty optional when it was not set

ThrowsWhen
IllegalStateExceptionif the field was set through a raw wire field to a value this type cannot represent

Blocks

Adds the blocks shown on the App Home tab, in display order.

Required. Must contain between 1 and 100 items. Each call appends to any values already added.

public HomeTabView.Builder blocks(Block... values)
ParameterDescription
valuesBlock values appended in order

Returns: this builder

Related types: Block, HomeTabView

PrivateMetadata

Sets application-defined data returned in view payloads.

Slack allows at most 3000 characters.

public HomeTabView.Builder privateMetadata(String value)
ParameterDescription
valuevalue for Slack's private_metadata field

Returns: this builder

Related types: HomeTabView

CallbackId

Sets an identifier returned in view payloads so your app can recognize the view.

Slack allows at most 255 characters.

public HomeTabView.Builder callbackId(String value)
ParameterDescription
valuevalue for Slack's callback_id field

Returns: this builder

Related types: HomeTabView

ExternalId

Sets a workspace-unique identifier you can use to update the view later.

public HomeTabView.Builder externalId(String value)
ParameterDescription
valuevalue for Slack's external_id field

Returns: this builder

Related types: HomeTabView

WireField

Sets a Slack field that has no named method yet, such as a field Slack introduced after this release. Prefer the named methods, which are typed and documented.

The value is checked at build time like any other field. It must be a string, number, boolean, slackblocks value or builder, or a list or map containing only those.

public HomeTabView.Builder wireField(String field, Object value)
ParameterDescription
fieldSlack JSON field name
valueJSON-compatible value

Returns: this builder

ThrowsWhen
IllegalArgumentExceptionif the field name is empty or the value cannot be written as Slack JSON

Related types: HomeTabView

Build

Validates the configured fields and creates an immutable value. The builder can be reused.

public HomeTabView build()

Returns: an immutable HomeTabView

ThrowsWhen
ValidationExceptionif the value breaks a Block Kit rule, such as a missing required field or an exceeded length limit

Related types: HomeTabView

MessagePayload

A complete payload for chat.postMessage and related Web API methods.

Start with builder(), set fields with the named fluent methods, and call Builder.build() to validate and create an immutable value.

  • Required: channel.

  • Only blocks supported in messages are accepted.

See the Slack reference.

Builder

Starts a new builder.

public static MessagePayload.Builder builder()

Returns: a new builder

Related types: MessagePayload

GetChannel

Returns the ID of the channel, private group, or conversation that receives the message.

public String getChannel()

Returns: the value

ThrowsWhen
IllegalStateExceptionif the field was set through a raw wire field to a value this type cannot represent

GetBlocks

Returns the message blocks in display order.

public List<Block> getBlocks()

Returns: the values in order, or an empty list when none were set

ThrowsWhen
IllegalStateExceptionif the field was set through a raw wire field to a value this type cannot represent

Related types: Block

GetAttachments

Returns legacy attachments in display order.

public List<Attachment> getAttachments()

Returns: the values in order, or an empty list when none were set

ThrowsWhen
IllegalStateExceptionif the field was set through a raw wire field to a value this type cannot represent

Related types: Attachment

GetText

Returns the fallback text used in notifications and by clients that cannot display blocks.

public Optional<String> getText()

Returns: the value, or an empty optional when it was not set

ThrowsWhen
IllegalStateExceptionif the field was set through a raw wire field to a value this type cannot represent

GetMrkdwn

Returns whether Slack formats the top-level text as mrkdwn.

public Optional<Boolean> getMrkdwn()

Returns: the value, or an empty optional when it was not set

ThrowsWhen
IllegalStateExceptionif the field was set through a raw wire field to a value this type cannot represent

Returns whether Slack unfurls text-based links.

public Optional<Boolean> getUnfurlLinks()

Returns: the value, or an empty optional when it was not set

ThrowsWhen
IllegalStateExceptionif the field was set through a raw wire field to a value this type cannot represent

GetUnfurlMedia

Returns whether Slack unfurls media links.

public Optional<Boolean> getUnfurlMedia()

Returns: the value, or an empty optional when it was not set

ThrowsWhen
IllegalStateExceptionif the field was set through a raw wire field to a value this type cannot represent

GetMetadata

Returns message metadata as a JSON-compatible map, such as event_type and event_payload.

public Optional<Map<String,Object>> getMetadata()

Returns: the value, or an empty optional when it was not set

ThrowsWhen
IllegalStateExceptionif the field was set through a raw wire field to a value this type cannot represent

Channel

Sets the ID of the channel, private group, or conversation that receives the message.

Required. Must not be empty.

public MessagePayload.Builder channel(String value)
ParameterDescription
valuevalue for Slack's channel field

Returns: this builder

Related types: MessagePayload

Blocks

Adds the message blocks in display order.

Slack allows at most 50 items. Each call appends to any values already added.

public MessagePayload.Builder blocks(Block... values)
ParameterDescription
valuesBlock values appended in order

Returns: this builder

Related types: Block, MessagePayload

Attachments

Adds legacy attachments in display order.

Slack allows at most 100 items. Each call appends to any values already added.

public MessagePayload.Builder attachments(Attachment... values)
ParameterDescription
valuesAttachment values appended in order

Returns: this builder

Related types: Attachment, MessagePayload

Text

Sets the fallback text used in notifications and by clients that cannot display blocks.

public MessagePayload.Builder text(String value)
ParameterDescription
valuevalue for Slack's text field

Returns: this builder

Related types: MessagePayload

Mrkdwn

Sets whether Slack formats the top-level text as mrkdwn.

public MessagePayload.Builder mrkdwn(boolean value)
ParameterDescription
valuevalue for Slack's mrkdwn field

Returns: this builder

Related types: MessagePayload

Sets whether Slack unfurls text-based links.

public MessagePayload.Builder unfurlLinks(boolean value)
ParameterDescription
valuevalue for Slack's unfurl_links field

Returns: this builder

Related types: MessagePayload

UnfurlMedia

Sets whether Slack unfurls media links.

public MessagePayload.Builder unfurlMedia(boolean value)
ParameterDescription
valuevalue for Slack's unfurl_media field

Returns: this builder

Related types: MessagePayload

Metadata

Sets message metadata as a JSON-compatible map, such as event_type and event_payload.

public MessagePayload.Builder metadata(Map<String,?> value)
ParameterDescription
valuemap of strings, numbers, booleans, lists, and maps

Returns: this builder

Related types: MessagePayload

WireField

Sets a Slack field that has no named method yet, such as a field Slack introduced after this release. Prefer the named methods, which are typed and documented.

The value is checked at build time like any other field. It must be a string, number, boolean, slackblocks value or builder, or a list or map containing only those.

public MessagePayload.Builder wireField(String field, Object value)
ParameterDescription
fieldSlack JSON field name
valueJSON-compatible value

Returns: this builder

ThrowsWhen
IllegalArgumentExceptionif the field name is empty or the value cannot be written as Slack JSON

Related types: MessagePayload

Build

Validates the configured fields and creates an immutable value. The builder can be reused.

public MessagePayload build()

Returns: an immutable MessagePayload

ThrowsWhen
ValidationExceptionif the value breaks a Block Kit rule, such as a missing required field or an exceeded length limit

Related types: MessagePayload

MessageResponse

A response body for slash commands and interaction response URLs.

Start with builder(), set fields with the named fluent methods, and call Builder.build() to validate and create an immutable value.

  • Only blocks supported in messages are accepted.

See the Slack reference.

Builder

Starts a new builder.

public static MessageResponse.Builder builder()

Returns: a new builder

Related types: MessageResponse

GetBlocks

Returns the response blocks in display order.

public List<Block> getBlocks()

Returns: the values in order, or an empty list when none were set

ThrowsWhen
IllegalStateExceptionif the field was set through a raw wire field to a value this type cannot represent

Related types: Block

GetAttachments

Returns legacy attachments in display order.

public List<Attachment> getAttachments()

Returns: the values in order, or an empty list when none were set

ThrowsWhen
IllegalStateExceptionif the field was set through a raw wire field to a value this type cannot represent

Related types: Attachment

GetText

Returns the fallback text used in notifications and by clients that cannot display blocks.

public Optional<String> getText()

Returns: the value, or an empty optional when it was not set

ThrowsWhen
IllegalStateExceptionif the field was set through a raw wire field to a value this type cannot represent

GetMrkdwn

Returns whether Slack formats the top-level text as mrkdwn.

public Optional<Boolean> getMrkdwn()

Returns: the value, or an empty optional when it was not set

ThrowsWhen
IllegalStateExceptionif the field was set through a raw wire field to a value this type cannot represent

GetReplaceOriginal

Returns whether the response replaces the message that triggered it.

public Optional<Boolean> getReplaceOriginal()

Returns: the value, or an empty optional when it was not set

ThrowsWhen
IllegalStateExceptionif the field was set through a raw wire field to a value this type cannot represent

GetResponseType

Returns who can see the response.

public Optional<ResponseType> getResponseType()

Returns: the value, or an empty optional when it was not set

ThrowsWhen
IllegalStateExceptionif the field was set through a raw wire field to a value this type cannot represent

Related types: ResponseType

Blocks

Adds the response blocks in display order.

Slack allows at most 50 items. Each call appends to any values already added.

public MessageResponse.Builder blocks(Block... values)
ParameterDescription
valuesBlock values appended in order

Returns: this builder

Related types: Block, MessageResponse

Attachments

Adds legacy attachments in display order.

Slack allows at most 100 items. Each call appends to any values already added.

public MessageResponse.Builder attachments(Attachment... values)
ParameterDescription
valuesAttachment values appended in order

Returns: this builder

Related types: Attachment, MessageResponse

Text

Sets the fallback text used in notifications and by clients that cannot display blocks.

public MessageResponse.Builder text(String value)
ParameterDescription
valuevalue for Slack's text field

Returns: this builder

Related types: MessageResponse

Mrkdwn

Sets whether Slack formats the top-level text as mrkdwn.

public MessageResponse.Builder mrkdwn(boolean value)
ParameterDescription
valuevalue for Slack's mrkdwn field

Returns: this builder

Related types: MessageResponse

ReplaceOriginal

Sets whether the response replaces the message that triggered it.

public MessageResponse.Builder replaceOriginal(boolean value)
ParameterDescription
valuevalue for Slack's replace_original field

Returns: this builder

Related types: MessageResponse

ResponseType

Sets who can see the response.

public MessageResponse.Builder responseType(ResponseType value)
ParameterDescription
valuevalue for Slack's response_type field

Returns: this builder

Related types: MessageResponse, ResponseType

WireField

Sets a Slack field that has no named method yet, such as a field Slack introduced after this release. Prefer the named methods, which are typed and documented.

The value is checked at build time like any other field. It must be a string, number, boolean, slackblocks value or builder, or a list or map containing only those.

public MessageResponse.Builder wireField(String field, Object value)
ParameterDescription
fieldSlack JSON field name
valueJSON-compatible value

Returns: this builder

ThrowsWhen
IllegalArgumentExceptionif the field name is empty or the value cannot be written as Slack JSON

Related types: MessageResponse

Build

Validates the configured fields and creates an immutable value. The builder can be reused.

public MessageResponse build()

Returns: an immutable MessageResponse

ThrowsWhen
ValidationExceptionif the value breaks a Block Kit rule, such as a missing required field or an exceeded length limit

Related types: MessageResponse

ModalView

The view payload for views.open, views.push, and views.update.

Start with builder(), set fields with the named fluent methods, and call Builder.build() to validate and create an immutable value.

  • Required: title, blocks.

  • Only blocks supported in modals are accepted.

  • A modal that contains an input block must have a submit label.

See the Slack reference.

Builder

Starts a new builder.

public static ModalView.Builder builder()

Returns: a new builder

Related types: ModalView

GetTitle

Returns the title in the modal's top bar.

public PlainText getTitle()

Returns: the value

ThrowsWhen
IllegalStateExceptionif the field was set through a raw wire field to a value this type cannot represent

Related types: PlainText

GetBlocks

Returns the blocks shown in the modal, in display order.

public List<Block> getBlocks()

Returns: the values in order, or an empty list when none were set

ThrowsWhen
IllegalStateExceptionif the field was set through a raw wire field to a value this type cannot represent

Related types: Block

GetClose

Returns the label of the button that closes the modal.

public Optional<PlainText> getClose()

Returns: the value, or an empty optional when it was not set

ThrowsWhen
IllegalStateExceptionif the field was set through a raw wire field to a value this type cannot represent

Related types: PlainText

GetSubmit

Returns the label of the button that submits the modal.

public Optional<PlainText> getSubmit()

Returns: the value, or an empty optional when it was not set

ThrowsWhen
IllegalStateExceptionif the field was set through a raw wire field to a value this type cannot represent

Related types: PlainText

GetPrivateMetadata

Returns application-defined data returned in view payloads.

public Optional<String> getPrivateMetadata()

Returns: the value, or an empty optional when it was not set

ThrowsWhen
IllegalStateExceptionif the field was set through a raw wire field to a value this type cannot represent

GetCallbackId

Returns an identifier returned in view payloads so your app can recognize the view.

public Optional<String> getCallbackId()

Returns: the value, or an empty optional when it was not set

ThrowsWhen
IllegalStateExceptionif the field was set through a raw wire field to a value this type cannot represent

GetClearOnClose

Returns whether closing this modal closes every view in its stack.

public Optional<Boolean> getClearOnClose()

Returns: the value, or an empty optional when it was not set

ThrowsWhen
IllegalStateExceptionif the field was set through a raw wire field to a value this type cannot represent

GetNotifyOnClose

Returns whether Slack sends a view_closed event when the user closes the modal.

public Optional<Boolean> getNotifyOnClose()

Returns: the value, or an empty optional when it was not set

ThrowsWhen
IllegalStateExceptionif the field was set through a raw wire field to a value this type cannot represent

GetExternalId

Returns a workspace-unique identifier you can use to update the view later.

public Optional<String> getExternalId()

Returns: the value, or an empty optional when it was not set

ThrowsWhen
IllegalStateExceptionif the field was set through a raw wire field to a value this type cannot represent

GetSubmitDisabled

Returns whether the submit button starts disabled. Only valid in workflow configuration modals.

public Optional<Boolean> getSubmitDisabled()

Returns: the value, or an empty optional when it was not set

ThrowsWhen
IllegalStateExceptionif the field was set through a raw wire field to a value this type cannot represent

Title — String

Sets the title in the modal's top bar.

Required. Slack allows at most 24 characters. The string is sent as a plain_text text object.

public ModalView.Builder title(String value)
ParameterDescription
valuetext content

Returns: this builder

Related types: ModalView

Title — PlainText

Sets the title in the modal's top bar.

Required. Slack allows at most 24 characters.

public ModalView.Builder title(PlainText value)
ParameterDescription
valuea PlainText object

Returns: this builder

Related types: ModalView, PlainText

Blocks

Adds the blocks shown in the modal, in display order.

Required. Must contain between 1 and 100 items. Each call appends to any values already added.

public ModalView.Builder blocks(Block... values)
ParameterDescription
valuesBlock values appended in order

Returns: this builder

Related types: Block, ModalView

Close — String

Sets the label of the button that closes the modal.

Slack allows at most 24 characters. The string is sent as a plain_text text object.

public ModalView.Builder close(String value)
ParameterDescription
valuetext content

Returns: this builder

Related types: ModalView

Close — PlainText

Sets the label of the button that closes the modal.

Slack allows at most 24 characters.

public ModalView.Builder close(PlainText value)
ParameterDescription
valuea PlainText object

Returns: this builder

Related types: ModalView, PlainText

Submit — String

Sets the label of the button that submits the modal.

Slack allows at most 24 characters. The string is sent as a plain_text text object.

public ModalView.Builder submit(String value)
ParameterDescription
valuetext content

Returns: this builder

Related types: ModalView

Submit — PlainText

Sets the label of the button that submits the modal.

Slack allows at most 24 characters.

public ModalView.Builder submit(PlainText value)
ParameterDescription
valuea PlainText object

Returns: this builder

Related types: ModalView, PlainText

PrivateMetadata

Sets application-defined data returned in view payloads.

Slack allows at most 3000 characters.

public ModalView.Builder privateMetadata(String value)
ParameterDescription
valuevalue for Slack's private_metadata field

Returns: this builder

Related types: ModalView

CallbackId

Sets an identifier returned in view payloads so your app can recognize the view.

Slack allows at most 255 characters.

public ModalView.Builder callbackId(String value)
ParameterDescription
valuevalue for Slack's callback_id field

Returns: this builder

Related types: ModalView

ClearOnClose

Sets whether closing this modal closes every view in its stack.

public ModalView.Builder clearOnClose(boolean value)
ParameterDescription
valuevalue for Slack's clear_on_close field

Returns: this builder

Related types: ModalView

NotifyOnClose

Sets whether Slack sends a view_closed event when the user closes the modal.

public ModalView.Builder notifyOnClose(boolean value)
ParameterDescription
valuevalue for Slack's notify_on_close field

Returns: this builder

Related types: ModalView

ExternalId

Sets a workspace-unique identifier you can use to update the view later.

public ModalView.Builder externalId(String value)
ParameterDescription
valuevalue for Slack's external_id field

Returns: this builder

Related types: ModalView

SubmitDisabled

Sets whether the submit button starts disabled. Only valid in workflow configuration modals.

public ModalView.Builder submitDisabled(boolean value)
ParameterDescription
valuevalue for Slack's submit_disabled field

Returns: this builder

Related types: ModalView

WireField

Sets a Slack field that has no named method yet, such as a field Slack introduced after this release. Prefer the named methods, which are typed and documented.

The value is checked at build time like any other field. It must be a string, number, boolean, slackblocks value or builder, or a list or map containing only those.

public ModalView.Builder wireField(String field, Object value)
ParameterDescription
fieldSlack JSON field name
valueJSON-compatible value

Returns: this builder

ThrowsWhen
IllegalArgumentExceptionif the field name is empty or the value cannot be written as Slack JSON

Related types: ModalView

Build

Validates the configured fields and creates an immutable value. The builder can be reused.

public ModalView build()

Returns: an immutable ModalView

ThrowsWhen
ValidationExceptionif the value breaks a Block Kit rule, such as a missing required field or an exceeded length limit

Related types: ModalView

ResponseType

Visibility of a slash-command or interaction response.

ConstantSlack valueMeaning
IN_CHANNELin_channelVisible to everyone in the channel.
EPHEMERALephemeralVisible only to the user who triggered the response.

WireValue

Returns the value Slack expects in JSON.

public String wireValue()

Returns: the wire value

FromWireValue

Finds the constant for a Slack JSON value.

public static Optional<ResponseType> fromWireValue(String wireValue)
ParameterDescription
wireValuethe value Slack uses in JSON

Returns: the matching constant, or an empty optional for an unknown value

Related types: ResponseType

WebhookMessage

A payload for incoming webhooks.

Start with builder(), set fields with the named fluent methods, and call Builder.build() to validate and create an immutable value.

  • Only blocks supported in messages are accepted.

See the Slack reference.

Builder

Starts a new builder.

public static WebhookMessage.Builder builder()

Returns: a new builder

Related types: WebhookMessage

GetBlocks

Returns the message blocks in display order.

public List<Block> getBlocks()

Returns: the values in order, or an empty list when none were set

ThrowsWhen
IllegalStateExceptionif the field was set through a raw wire field to a value this type cannot represent

Related types: Block

GetAttachments

Returns legacy attachments in display order.

public List<Attachment> getAttachments()

Returns: the values in order, or an empty list when none were set

ThrowsWhen
IllegalStateExceptionif the field was set through a raw wire field to a value this type cannot represent

Related types: Attachment

GetText

Returns the fallback text used in notifications and by clients that cannot display blocks.

public Optional<String> getText()

Returns: the value, or an empty optional when it was not set

ThrowsWhen
IllegalStateExceptionif the field was set through a raw wire field to a value this type cannot represent

GetResponseType

Returns who can see the response.

public Optional<ResponseType> getResponseType()

Returns: the value, or an empty optional when it was not set

ThrowsWhen
IllegalStateExceptionif the field was set through a raw wire field to a value this type cannot represent

Related types: ResponseType

GetReplaceOriginal

Returns whether the response replaces the message that triggered it.

public Optional<Boolean> getReplaceOriginal()

Returns: the value, or an empty optional when it was not set

ThrowsWhen
IllegalStateExceptionif the field was set through a raw wire field to a value this type cannot represent

GetDeleteOriginal

Returns whether the response deletes the message that triggered it.

public Optional<Boolean> getDeleteOriginal()

Returns: the value, or an empty optional when it was not set

ThrowsWhen
IllegalStateExceptionif the field was set through a raw wire field to a value this type cannot represent

Returns whether Slack unfurls text-based links.

public Optional<Boolean> getUnfurlLinks()

Returns: the value, or an empty optional when it was not set

ThrowsWhen
IllegalStateExceptionif the field was set through a raw wire field to a value this type cannot represent

GetUnfurlMedia

Returns whether Slack unfurls media links.

public Optional<Boolean> getUnfurlMedia()

Returns: the value, or an empty optional when it was not set

ThrowsWhen
IllegalStateExceptionif the field was set through a raw wire field to a value this type cannot represent

GetMetadata

Returns message metadata as a JSON-compatible map, such as event_type and event_payload.

public Optional<Map<String,Object>> getMetadata()

Returns: the value, or an empty optional when it was not set

ThrowsWhen
IllegalStateExceptionif the field was set through a raw wire field to a value this type cannot represent

Blocks

Adds the message blocks in display order.

Slack allows at most 50 items. Each call appends to any values already added.

public WebhookMessage.Builder blocks(Block... values)
ParameterDescription
valuesBlock values appended in order

Returns: this builder

Related types: Block, WebhookMessage

Attachments

Adds legacy attachments in display order.

Slack allows at most 100 items. Each call appends to any values already added.

public WebhookMessage.Builder attachments(Attachment... values)
ParameterDescription
valuesAttachment values appended in order

Returns: this builder

Related types: Attachment, WebhookMessage

Text

Sets the fallback text used in notifications and by clients that cannot display blocks.

public WebhookMessage.Builder text(String value)
ParameterDescription
valuevalue for Slack's text field

Returns: this builder

Related types: WebhookMessage

ResponseType

Sets who can see the response.

public WebhookMessage.Builder responseType(ResponseType value)
ParameterDescription
valuevalue for Slack's response_type field

Returns: this builder

Related types: ResponseType, WebhookMessage

ReplaceOriginal

Sets whether the response replaces the message that triggered it.

public WebhookMessage.Builder replaceOriginal(boolean value)
ParameterDescription
valuevalue for Slack's replace_original field

Returns: this builder

Related types: WebhookMessage

DeleteOriginal

Sets whether the response deletes the message that triggered it.

public WebhookMessage.Builder deleteOriginal(boolean value)
ParameterDescription
valuevalue for Slack's delete_original field

Returns: this builder

Related types: WebhookMessage

Sets whether Slack unfurls text-based links.

public WebhookMessage.Builder unfurlLinks(boolean value)
ParameterDescription
valuevalue for Slack's unfurl_links field

Returns: this builder

Related types: WebhookMessage

UnfurlMedia

Sets whether Slack unfurls media links.

public WebhookMessage.Builder unfurlMedia(boolean value)
ParameterDescription
valuevalue for Slack's unfurl_media field

Returns: this builder

Related types: WebhookMessage

Metadata

Sets message metadata as a JSON-compatible map, such as event_type and event_payload.

public WebhookMessage.Builder metadata(Map<String,?> value)
ParameterDescription
valuemap of strings, numbers, booleans, lists, and maps

Returns: this builder

Related types: WebhookMessage

WireField

Sets a Slack field that has no named method yet, such as a field Slack introduced after this release. Prefer the named methods, which are typed and documented.

The value is checked at build time like any other field. It must be a string, number, boolean, slackblocks value or builder, or a list or map containing only those.

public WebhookMessage.Builder wireField(String field, Object value)
ParameterDescription
fieldSlack JSON field name
valueJSON-compatible value

Returns: this builder

ThrowsWhen
IllegalArgumentExceptionif the field name is empty or the value cannot be written as Slack JSON

Related types: WebhookMessage

Build

Validates the configured fields and creates an immutable value. The builder can be reused.

public WebhookMessage build()

Returns: an immutable WebhookMessage

ThrowsWhen
ValidationExceptionif the value breaks a Block Kit rule, such as a missing required field or an exceeded length limit

Related types: WebhookMessage