Blocks
This page documents the public Java API for blocks, 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.
Built block values implement Slack's official LayoutBlock interface, so they can be passed directly to ChatPostMessageRequest.blocks(...) and other slack-java-sdk request builders.
ActionsBlock
A block that holds interactive elements such as buttons and menus.
Start with builder(), set fields with the named fluent methods, and call Builder.build() to validate and create an immutable value.
- Required:
elements.
See the Slack reference.
Builder
Starts a new builder.
public static ActionsBlock.Builder builder()
Returns: a new builder
Related types: ActionsBlock
GetElements
Returns interactive elements in display order.
public List<Element> getElements()
Returns: the values in order, or an empty list when none were set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: Element
Elements
Adds interactive elements in display order.
Required. Slack allows at most 25 items. Each call appends to any values already added.
public ActionsBlock.Builder elements(Element... values)
| Parameter | Description |
|---|---|
values | Element values appended in order |
Returns: this builder
Related types: ActionsBlock, Element
BlockId
Sets a unique identifier for this block. Slack returns it in interaction payloads, so use a stable value when you need to find the block again.
Slack allows at most 255 characters.
public ActionsBlock.Builder blockId(String value)
| Parameter | Description |
|---|---|
value | value for Slack's block_id field |
Returns: this builder
Related types: ActionsBlock
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 ActionsBlock.Builder wireField(String field, Object value)
| Parameter | Description |
|---|---|
field | Slack JSON field name |
value | JSON-compatible value |
Returns: this builder
| Throws | When |
|---|---|
IllegalArgumentException | if the field name is empty or the value cannot be written as Slack JSON |
Related types: ActionsBlock
Build
Validates the configured fields and creates an immutable value. The builder can be reused.
public ActionsBlock build()
Returns: an immutable ActionsBlock
| Throws | When |
|---|---|
ValidationException | if the value breaks a Block Kit rule, such as a missing required field or an exceeded length limit |
Related types: ActionsBlock
AlertBlock
A severity-labelled alert, available in modals.
Start with builder(), set fields with the named fluent methods, and call Builder.build() to validate and create an immutable value.
- Required:
text.
See the Slack reference.
Builder
Starts a new builder.
public static AlertBlock.Builder builder()
Returns: a new builder
Related types: AlertBlock
GetText
Returns the alert message.
public Text getText()
Returns: the value
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: Text
GetLevel
Returns the alert severity, which controls its color and icon.
public Optional<AlertLevel> getLevel()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: AlertLevel
Text — String
Sets the alert message.
Required. Slack allows at most 200 characters. The string is sent as a mrkdwn text object.
public AlertBlock.Builder text(String value)
| Parameter | Description |
|---|---|
value | text content |
Returns: this builder
Related types: AlertBlock
Text — Text
Sets the alert message.
Required. Slack allows at most 200 characters.
public AlertBlock.Builder text(Text value)
| Parameter | Description |
|---|---|
value | a Text object |
Returns: this builder
Related types: AlertBlock, Text
MarkdownText
Sets the alert message.
Required. Slack allows at most 200 characters. Equivalent to text(String).
public AlertBlock.Builder markdownText(String value)
| Parameter | Description |
|---|---|
value | text content |
Returns: this builder
Related types: AlertBlock
Level
Sets the alert severity, which controls its color and icon.
public AlertBlock.Builder level(AlertLevel value)
| Parameter | Description |
|---|---|
value | value for Slack's level field |
Returns: this builder
Related types: AlertBlock, AlertLevel
BlockId
Sets a unique identifier for this block. Slack returns it in interaction payloads, so use a stable value when you need to find the block again.
Slack allows at most 255 characters.
public AlertBlock.Builder blockId(String value)
| Parameter | Description |
|---|---|
value | value for Slack's block_id field |
Returns: this builder
Related types: AlertBlock
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 AlertBlock.Builder wireField(String field, Object value)
| Parameter | Description |
|---|---|
field | Slack JSON field name |
value | JSON-compatible value |
Returns: this builder
| Throws | When |
|---|---|
IllegalArgumentException | if the field name is empty or the value cannot be written as Slack JSON |
Related types: AlertBlock
Build
Validates the configured fields and creates an immutable value. The builder can be reused.
public AlertBlock build()
Returns: an immutable AlertBlock
| Throws | When |
|---|---|
ValidationException | if the value breaks a Block Kit rule, such as a missing required field or an exceeded length limit |
Related types: AlertBlock
AlertLevel
Severity levels supported by alert blocks.
| Constant | Slack value | Meaning |
|---|---|---|
DEFAULT | default | Neutral styling. |
INFO | info | Informational styling. |
WARNING | warning | Warning styling. |
ERROR | error | Error styling. |
SUCCESS | success | Success styling. |
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<AlertLevel> fromWireValue(String wireValue)
| Parameter | Description |
|---|---|
wireValue | the value Slack uses in JSON |
Returns: the matching constant, or an empty optional for an unknown value
Related types: AlertLevel
Block
A validated Slack layout block accepted directly by Slack's official Java SDK.
Implemented by ActionsBlock, AlertBlock, CardBlock, CarouselBlock, ContainerBlock, ContextActionsBlock, ContextBlock, DataTableBlock, DataVisualizationBlock, DividerBlock, FileBlock, HeaderBlock, ImageBlock, InputBlock, MarkdownBlock, PlanBlock, RichTextBlock, SectionBlock, TableBlock, TaskCardBlock, VideoBlock.
GetType
Returns the Slack block type. Values are materialized once at build time, so this is a map lookup rather than a rebuild.
public default String getType()
Returns: Slack wire type
GetBlockId
Returns the configured block identifier.
public default lang.@Nullable String getBlockId()
Returns: block identifier, or null when none was set
CardBlock
A compact card with an image, text, and up to three buttons.
Start with builder(), set fields with the named fluent methods, and call Builder.build() to validate and create an immutable value.
-
Provide at least one of a hero image, title, actions, or body.
-
An image icon and a Slack icon cannot be combined.
See the Slack reference.
Builder
Starts a new builder.
public static CardBlock.Builder builder()
Returns: a new builder
Related types: CardBlock
GetHeroImage
Returns the image displayed prominently at the top of the card.
public Optional<ImageElement> getHeroImage()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: ImageElement
GetIcon
Returns the image displayed beside the title.
public Optional<ImageElement> getIcon()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: ImageElement
GetTitle
Returns the card title.
public Optional<Text> getTitle()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: Text
GetSubtitle
Returns the supporting text shown below the title.
public Optional<Text> getSubtitle()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: Text
GetBody
Returns the main body text of the card.
public Optional<Text> getBody()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: Text
GetActions
Returns buttons displayed at the bottom of the card, in display order.
public List<ButtonElement> getActions()
Returns: the values in order, or an empty list when none were set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: ButtonElement
GetSlackIcon
Returns a Slack-provided icon displayed beside the title. Cannot be combined with an image icon.
public Optional<SlackIcon> getSlackIcon()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: SlackIcon
GetSubtext
Returns the small print shown at the bottom of the card.
public Optional<Text> getSubtext()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: Text
HeroImage
Sets the image displayed prominently at the top of the card.
public CardBlock.Builder heroImage(ImageElement value)
| Parameter | Description |
|---|---|
value | nested ImageElement |
Returns: this builder
Related types: CardBlock, ImageElement
Icon
Sets the image displayed beside the title.
public CardBlock.Builder icon(ImageElement value)
| Parameter | Description |
|---|---|
value | nested ImageElement |
Returns: this builder
Related types: CardBlock, ImageElement
Title — String
Sets the card title.
Slack allows at most 150 characters. The string is sent as a mrkdwn text object.
public CardBlock.Builder title(String value)
| Parameter | Description |
|---|---|
value | text content |
Returns: this builder
Related types: CardBlock
Title — Text
Sets the card title.
Slack allows at most 150 characters.
public CardBlock.Builder title(Text value)
| Parameter | Description |
|---|---|
value | a Text object |
Returns: this builder
Related types: CardBlock, Text
Subtitle — String
Sets the supporting text shown below the title.
Slack allows at most 150 characters. The string is sent as a mrkdwn text object.
public CardBlock.Builder subtitle(String value)
| Parameter | Description |
|---|---|
value | text content |
Returns: this builder
Related types: CardBlock
Subtitle — Text
Sets the supporting text shown below the title.
Slack allows at most 150 characters.
public CardBlock.Builder subtitle(Text value)
| Parameter | Description |
|---|---|
value | a Text object |
Returns: this builder
Related types: CardBlock, Text
Body — String
Sets the main body text of the card.
Slack allows at most 200 characters. The string is sent as a mrkdwn text object.
public CardBlock.Builder body(String value)
| Parameter | Description |
|---|---|
value | text content |
Returns: this builder
Related types: CardBlock
Body — Text
Sets the main body text of the card.
Slack allows at most 200 characters.
public CardBlock.Builder body(Text value)
| Parameter | Description |
|---|---|
value | a Text object |
Returns: this builder
Related types: CardBlock, Text
Actions
Adds buttons displayed at the bottom of the card, in display order.
Slack allows at most 3 items. Each call appends to any values already added.
public CardBlock.Builder actions(ButtonElement... values)
| Parameter | Description |
|---|---|
values | ButtonElement values appended in order |
Returns: this builder
Related types: ButtonElement, CardBlock
SlackIcon
Sets a Slack-provided icon displayed beside the title. Cannot be combined with an image icon.
public CardBlock.Builder slackIcon(SlackIcon value)
| Parameter | Description |
|---|---|
value | nested SlackIcon |
Returns: this builder
Related types: CardBlock, SlackIcon
Subtext — String
Sets the small print shown at the bottom of the card.
Slack allows at most 200 characters. The string is sent as a mrkdwn text object.
public CardBlock.Builder subtext(String value)
| Parameter | Description |
|---|---|
value | text content |
Returns: this builder
Related types: CardBlock
Subtext — Text
Sets the small print shown at the bottom of the card.
Slack allows at most 200 characters.
public CardBlock.Builder subtext(Text value)
| Parameter | Description |
|---|---|
value | a Text object |
Returns: this builder
Related types: CardBlock, Text
BlockId
Sets a unique identifier for this block. Slack returns it in interaction payloads, so use a stable value when you need to find the block again.
Slack allows at most 255 characters.
public CardBlock.Builder blockId(String value)
| Parameter | Description |
|---|---|
value | value for Slack's block_id field |
Returns: this builder
Related types: CardBlock
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 CardBlock.Builder wireField(String field, Object value)
| Parameter | Description |
|---|---|
field | Slack JSON field name |
value | JSON-compatible value |
Returns: this builder
| Throws | When |
|---|---|
IllegalArgumentException | if the field name is empty or the value cannot be written as Slack JSON |
Related types: CardBlock
Build
Validates the configured fields and creates an immutable value. The builder can be reused.
public CardBlock build()
Returns: an immutable CardBlock
| Throws | When |
|---|---|
ValidationException | if the value breaks a Block Kit rule, such as a missing required field or an exceeded length limit |
Related types: CardBlock
CarouselBlock
A horizontally scrolling set of cards, available in messages and App Home.
Start with builder(), set fields with the named fluent methods, and call Builder.build() to validate and create an immutable value.
- Required:
elements.
See the Slack reference.
Builder
Starts a new builder.
public static CarouselBlock.Builder builder()
Returns: a new builder
Related types: CarouselBlock
GetElements
Returns the cards in display order.
public List<CardBlock> getElements()
Returns: the values in order, or an empty list when none were set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: CardBlock
Elements
Adds the cards in display order.
Required. Must contain between 1 and 10 items. Each call appends to any values already added.
public CarouselBlock.Builder elements(CardBlock... values)
| Parameter | Description |
|---|---|
values | CardBlock values appended in order |
Returns: this builder
Related types: CardBlock, CarouselBlock
BlockId
Sets a unique identifier for this block. Slack returns it in interaction payloads, so use a stable value when you need to find the block again.
Slack allows at most 255 characters.
public CarouselBlock.Builder blockId(String value)
| Parameter | Description |
|---|---|
value | value for Slack's block_id field |
Returns: this builder
Related types: CarouselBlock
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 CarouselBlock.Builder wireField(String field, Object value)
| Parameter | Description |
|---|---|
field | Slack JSON field name |
value | JSON-compatible value |
Returns: this builder
| Throws | When |
|---|---|
IllegalArgumentException | if the field name is empty or the value cannot be written as Slack JSON |
Related types: CarouselBlock
Build
Validates the configured fields and creates an immutable value. The builder can be reused.
public CarouselBlock build()
Returns: an immutable CarouselBlock
| Throws | When |
|---|---|
ValidationException | if the value breaks a Block Kit rule, such as a missing required field or an exceeded length limit |
Related types: CarouselBlock
ContainerBlock
A titled group of blocks that can optionally collapse.
Start with builder(), set fields with the named fluent methods, and call Builder.build() to validate and create an immutable value.
-
Required:
childBlocks. -
Provide a title or a rich text title.
See the Slack reference.
Builder
Starts a new builder.
public static ContainerBlock.Builder builder()
Returns: a new builder
Related types: ContainerBlock
GetChildBlocks
Returns the blocks grouped inside the container, in display order.
public List<Block> getChildBlocks()
Returns: the values in order, or an empty list when none were set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: Block
GetTitle
Returns the container title. Provide either a title or a rich text title.
public Optional<PlainText> getTitle()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: PlainText
GetRichTextTitle
Returns a rich text block used as the title in place of a plain-text title.
public Optional<RichTextBlock> getRichTextTitle()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: RichTextBlock
GetSubtitle
Returns the supporting text shown below the title.
public Optional<Text> getSubtitle()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: Text
GetWidth
Returns the horizontal width of the container.
public Optional<ContainerWidth> getWidth()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: ContainerWidth
GetIcon
Returns the image displayed beside the title.
public Optional<ImageElement> getIcon()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: ImageElement
GetCollapsible
Returns whether users can collapse and expand the container.
public Optional<Boolean> getCollapsible()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetDefaultCollapsed
Returns whether a collapsible container starts collapsed. Requires the container to be collapsible.
public Optional<Boolean> getDefaultCollapsed()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetHasHeaderDivider
Returns whether Slack draws a divider below the container header. Only valid for non-collapsible containers.
public Optional<Boolean> getHasHeaderDivider()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
ChildBlocks
Adds the blocks grouped inside the container, in display order.
Required. Slack allows at most 10 items. Each call appends to any values already added.
public ContainerBlock.Builder childBlocks(Block... values)
| Parameter | Description |
|---|---|
values | Block values appended in order |
Returns: this builder
Related types: Block, ContainerBlock
Title — String
Sets the container title. Provide either a title or a rich text title.
Slack allows at most 150 characters. The string is sent as a plain_text text object.
public ContainerBlock.Builder title(String value)
| Parameter | Description |
|---|---|
value | text content |
Returns: this builder
Related types: ContainerBlock
Title — PlainText
Sets the container title. Provide either a title or a rich text title.
Slack allows at most 150 characters.
public ContainerBlock.Builder title(PlainText value)
| Parameter | Description |
|---|---|
value | a PlainText object |
Returns: this builder
Related types: ContainerBlock, PlainText
RichTextTitle
Sets a rich text block used as the title in place of a plain-text title.
public ContainerBlock.Builder richTextTitle(RichTextBlock value)
| Parameter | Description |
|---|---|
value | nested RichTextBlock |
Returns: this builder
Related types: ContainerBlock, RichTextBlock
Subtitle — String
Sets the supporting text shown below the title.
Slack allows at most 150 characters. The string is sent as a mrkdwn text object.
public ContainerBlock.Builder subtitle(String value)
| Parameter | Description |
|---|---|
value | text content |
Returns: this builder
Related types: ContainerBlock
Subtitle — Text
Sets the supporting text shown below the title.
Slack allows at most 150 characters.
public ContainerBlock.Builder subtitle(Text value)
| Parameter | Description |
|---|---|
value | a Text object |
Returns: this builder
Related types: ContainerBlock, Text
Width
Sets the horizontal width of the container.
public ContainerBlock.Builder width(ContainerWidth value)
| Parameter | Description |
|---|---|
value | value for Slack's width field |
Returns: this builder
Related types: ContainerBlock, ContainerWidth
Icon
Sets the image displayed beside the title.
public ContainerBlock.Builder icon(ImageElement value)
| Parameter | Description |
|---|---|
value | nested ImageElement |
Returns: this builder
Related types: ContainerBlock, ImageElement
IsCollapsible
Sets whether users can collapse and expand the container.
public ContainerBlock.Builder isCollapsible(boolean value)
| Parameter | Description |
|---|---|
value | value for Slack's is_collapsible field |
Returns: this builder
Related types: ContainerBlock
DefaultCollapsed
Sets whether a collapsible container starts collapsed. Requires the container to be collapsible.
public ContainerBlock.Builder defaultCollapsed(boolean value)
| Parameter | Description |
|---|---|
value | value for Slack's default_collapsed field |
Returns: this builder
Related types: ContainerBlock
HasHeaderDivider
Sets whether Slack draws a divider below the container header. Only valid for non-collapsible containers.
public ContainerBlock.Builder hasHeaderDivider(boolean value)
| Parameter | Description |
|---|---|
value | value for Slack's has_header_divider field |
Returns: this builder
Related types: ContainerBlock
BlockId
Sets a unique identifier for this block. Slack returns it in interaction payloads, so use a stable value when you need to find the block again.
Slack allows at most 255 characters.
public ContainerBlock.Builder blockId(String value)
| Parameter | Description |
|---|---|
value | value for Slack's block_id field |
Returns: this builder
Related types: ContainerBlock
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 ContainerBlock.Builder wireField(String field, Object value)
| Parameter | Description |
|---|---|
field | Slack JSON field name |
value | JSON-compatible value |
Returns: this builder
| Throws | When |
|---|---|
IllegalArgumentException | if the field name is empty or the value cannot be written as Slack JSON |
Related types: ContainerBlock
Build
Validates the configured fields and creates an immutable value. The builder can be reused.
public ContainerBlock build()
Returns: an immutable ContainerBlock
| Throws | When |
|---|---|
ValidationException | if the value breaks a Block Kit rule, such as a missing required field or an exceeded length limit |
Related types: ContainerBlock
ContainerWidth
Widths supported by Slack container blocks.
| Constant | Slack value | Meaning |
|---|---|---|
NARROW | narrow | A compact container. |
STANDARD | standard | Slack's standard container width. |
WIDE | wide | A wide container. |
FULL | full | The full available width. |
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<ContainerWidth> fromWireValue(String wireValue)
| Parameter | Description |
|---|---|
wireValue | the value Slack uses in JSON |
Returns: the matching constant, or an empty optional for an unknown value
Related types: ContainerWidth
ContextActionsBlock
A row of feedback or icon buttons, usually shown below AI-generated content.
Start with builder(), set fields with the named fluent methods, and call Builder.build() to validate and create an immutable value.
- Required:
elements.
See the Slack reference.
Builder
Starts a new builder.
public static ContextActionsBlock.Builder builder()
Returns: a new builder
Related types: ContextActionsBlock
GetElements
Returns feedback buttons or icon buttons in display order.
public List<ContextActionsElement> getElements()
Returns: the values in order, or an empty list when none were set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: ContextActionsElement
Elements
Adds feedback buttons or icon buttons in display order.
Required. Slack allows at most 5 items. Each call appends to any values already added.
public ContextActionsBlock.Builder elements(ContextActionsElement... values)
| Parameter | Description |
|---|---|
values | ContextActionsElement values appended in order |
Returns: this builder
Related types: ContextActionsBlock, ContextActionsElement
BlockId
Sets a unique identifier for this block. Slack returns it in interaction payloads, so use a stable value when you need to find the block again.
Slack allows at most 255 characters.
public ContextActionsBlock.Builder blockId(String value)
| Parameter | Description |
|---|---|
value | value for Slack's block_id field |
Returns: this builder
Related types: ContextActionsBlock
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 ContextActionsBlock.Builder wireField(String field, Object value)
| Parameter | Description |
|---|---|
field | Slack JSON field name |
value | JSON-compatible value |
Returns: this builder
| Throws | When |
|---|---|
IllegalArgumentException | if the field name is empty or the value cannot be written as Slack JSON |
Related types: ContextActionsBlock
Build
Validates the configured fields and creates an immutable value. The builder can be reused.
public ContextActionsBlock build()
Returns: an immutable ContextActionsBlock
| Throws | When |
|---|---|
ValidationException | if the value breaks a Block Kit rule, such as a missing required field or an exceeded length limit |
Related types: ContextActionsBlock
ContextActionsElement
A value that can appear in a context actions block: feedback buttons or an icon button.
Implemented by FeedbackButtonsElement, IconButtonElement.
ContextBlock
A block of small, secondary images and text.
Start with builder(), set fields with the named fluent methods, and call Builder.build() to validate and create an immutable value.
- Required:
elements.
See the Slack reference.
Builder
Starts a new builder.
public static ContextBlock.Builder builder()
Returns: a new builder
Related types: ContextBlock
GetElements
Returns images and text in display order.
public List<ContextElement> getElements()
Returns: the values in order, or an empty list when none were set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: ContextElement
Elements
Adds images and text in display order.
Required. Slack allows at most 10 items. Each call appends to any values already added.
public ContextBlock.Builder elements(ContextElement... values)
| Parameter | Description |
|---|---|
values | ContextElement values appended in order |
Returns: this builder
Related types: ContextBlock, ContextElement
BlockId
Sets a unique identifier for this block. Slack returns it in interaction payloads, so use a stable value when you need to find the block again.
Slack allows at most 255 characters.
public ContextBlock.Builder blockId(String value)
| Parameter | Description |
|---|---|
value | value for Slack's block_id field |
Returns: this builder
Related types: ContextBlock
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 ContextBlock.Builder wireField(String field, Object value)
| Parameter | Description |
|---|---|
field | Slack JSON field name |
value | JSON-compatible value |
Returns: this builder
| Throws | When |
|---|---|
IllegalArgumentException | if the field name is empty or the value cannot be written as Slack JSON |
Related types: ContextBlock
Build
Validates the configured fields and creates an immutable value. The builder can be reused.
public ContextBlock build()
Returns: an immutable ContextBlock
| Throws | When |
|---|---|
ValidationException | if the value breaks a Block Kit rule, such as a missing required field or an exceeded length limit |
Related types: ContextBlock
ContextElement
A value that can appear in a context block: an image element or a text object.
Implemented by ImageElement, MarkdownText, PlainText.
DataTableBlock
A sortable, paginated table of raw text, numbers, and rich text.
Start with builder(), set fields with the named fluent methods, and call Builder.build() to validate and create an immutable value.
-
Required:
rows,caption. -
The first row is the header row and cannot contain rich text.
-
Every row must have the same number of cells, and all cell text together is limited to 20,000 characters.
See the Slack reference.
Builder
Starts a new builder.
public static DataTableBlock.Builder builder()
Returns: a new builder
Related types: DataTableBlock
GetRows
Returns complete table rows in display order. Every row must have the same number of cells.
public List<List<DataTableCell>> getRows()
Returns: the values in order, or an empty list when none were set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: DataTableCell
GetCaption
Returns the caption that describes the table's contents.
public String getCaption()
Returns: the value
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetPageSize
Returns how many rows Slack shows per page.
public OptionalInt getPageSize()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetRowHeaderColumnIndex
Returns the zero-based index of the column whose cells act as row headers.
public OptionalInt getRowHeaderColumnIndex()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Rows
Adds complete table rows in display order. Every row must have the same number of cells.
Required. Must contain between 2 and 201 items. Each call appends to any rows already added.
public final DataTableBlock.Builder rows(List<? extends DataTableCell>... rows)
| Parameter | Description |
|---|---|
rows | rows of DataTableCell values, in display order |
Returns: this builder
Related types: DataTableBlock, DataTableCell
Caption
Sets the caption that describes the table's contents.
Required.
public DataTableBlock.Builder caption(String value)
| Parameter | Description |
|---|---|
value | value for Slack's caption field |
Returns: this builder
Related types: DataTableBlock
PageSize
Sets how many rows Slack shows per page.
Must be between 1 and 100.
public DataTableBlock.Builder pageSize(int value)
| Parameter | Description |
|---|---|
value | value for Slack's page_size field |
Returns: this builder
Related types: DataTableBlock
RowHeaderColumnIndex
Sets the zero-based index of the column whose cells act as row headers.
public DataTableBlock.Builder rowHeaderColumnIndex(int value)
| Parameter | Description |
|---|---|
value | value for Slack's row_header_column_index field |
Returns: this builder
Related types: DataTableBlock
BlockId
Sets a unique identifier for this block. Slack returns it in interaction payloads, so use a stable value when you need to find the block again.
Slack allows at most 255 characters.
public DataTableBlock.Builder blockId(String value)
| Parameter | Description |
|---|---|
value | value for Slack's block_id field |
Returns: this builder
Related types: DataTableBlock
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 DataTableBlock.Builder wireField(String field, Object value)
| Parameter | Description |
|---|---|
field | Slack JSON field name |
value | JSON-compatible value |
Returns: this builder
| Throws | When |
|---|---|
IllegalArgumentException | if the field name is empty or the value cannot be written as Slack JSON |
Related types: DataTableBlock
Build
Validates the configured fields and creates an immutable value. The builder can be reused.
public DataTableBlock build()
Returns: an immutable DataTableBlock
| Throws | When |
|---|---|
ValidationException | if the value breaks a Block Kit rule, such as a missing required field or an exceeded length limit |
Related types: DataTableBlock
DataTableCell
A value that can appear as a data table cell: raw text, a raw number, or a rich text block.
Implemented by RawNumber, RawText, RichTextBlock.
DataVisualizationBlock
A titled pie, bar, area, or line chart.
Start with builder(), set fields with the named fluent methods, and call Builder.build() to validate and create an immutable value.
- Required:
title,chart.
See the Slack reference.
Builder
Starts a new builder.
public static DataVisualizationBlock.Builder builder()
Returns: a new builder
Related types: DataVisualizationBlock
GetTitle
Returns the chart title.
public String getTitle()
Returns: the value
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetChart
Returns the chart to display.
public Chart getChart()
Returns: the value
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: Chart
Title
Sets the chart title.
Required. Slack allows at most 50 characters.
public DataVisualizationBlock.Builder title(String value)
| Parameter | Description |
|---|---|
value | value for Slack's title field |
Returns: this builder
Related types: DataVisualizationBlock
Chart
Sets the chart to display.
Required.
public DataVisualizationBlock.Builder chart(Chart value)
| Parameter | Description |
|---|---|
value | nested Chart |
Returns: this builder
Related types: Chart, DataVisualizationBlock
BlockId
Sets a unique identifier for this block. Slack returns it in interaction payloads, so use a stable value when you need to find the block again.
Slack allows at most 255 characters.
public DataVisualizationBlock.Builder blockId(String value)
| Parameter | Description |
|---|---|
value | value for Slack's block_id field |
Returns: this builder
Related types: DataVisualizationBlock
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 DataVisualizationBlock.Builder wireField(String field, Object value)
| Parameter | Description |
|---|---|
field | Slack JSON field name |
value | JSON-compatible value |
Returns: this builder
| Throws | When |
|---|---|
IllegalArgumentException | if the field name is empty or the value cannot be written as Slack JSON |
Related types: DataVisualizationBlock
Build
Validates the configured fields and creates an immutable value. The builder can be reused.
public DataVisualizationBlock build()
Returns: an immutable DataVisualizationBlock
| Throws | When |
|---|---|
ValidationException | if the value breaks a Block Kit rule, such as a missing required field or an exceeded length limit |
Related types: DataVisualizationBlock
DividerBlock
A horizontal rule that separates blocks.
Start with builder(), set fields with the named fluent methods, and call Builder.build() to validate and create an immutable value.
See the Slack reference.
Builder
Starts a new builder.
public static DividerBlock.Builder builder()
Returns: a new builder
Related types: DividerBlock
Create
Creates a divider block with no block identifier.
public static DividerBlock create()
Returns: an immutable DividerBlock
| Throws | When |
|---|---|
ValidationException | if the value breaks a Block Kit rule |
Related types: DividerBlock
BlockId
Sets a unique identifier for this block. Slack returns it in interaction payloads, so use a stable value when you need to find the block again.
Slack allows at most 255 characters.
public DividerBlock.Builder blockId(String value)
| Parameter | Description |
|---|---|
value | value for Slack's block_id field |
Returns: this builder
Related types: DividerBlock
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 DividerBlock.Builder wireField(String field, Object value)
| Parameter | Description |
|---|---|
field | Slack JSON field name |
value | JSON-compatible value |
Returns: this builder
| Throws | When |
|---|---|
IllegalArgumentException | if the field name is empty or the value cannot be written as Slack JSON |
Related types: DividerBlock
Build
Validates the configured fields and creates an immutable value. The builder can be reused.
public DividerBlock build()
Returns: an immutable DividerBlock
| Throws | When |
|---|---|
ValidationException | if the value breaks a Block Kit rule, such as a missing required field or an exceeded length limit |
Related types: DividerBlock
FileBlock
A remote file previously added with the files.remote API.
Start with builder(), set fields with the named fluent methods, and call Builder.build() to validate and create an immutable value.
- Required:
externalId.
See the Slack reference.
Builder
Starts a new builder.
public static FileBlock.Builder builder()
Returns: a new builder
Related types: FileBlock
GetExternalId
Returns the external identifier of a remote file previously added with the files.remote API.
public String getExternalId()
Returns: the value
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetSource
Returns the file source. Slack currently supports only remote files.
public Optional<String> getSource()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
ExternalId
Sets the external identifier of a remote file previously added with the files.remote API.
Required.
public FileBlock.Builder externalId(String value)
| Parameter | Description |
|---|---|
value | value for Slack's external_id field |
Returns: this builder
Related types: FileBlock
Source
Sets the file source. Slack currently supports only remote files.
public FileBlock.Builder source(String value)
| Parameter | Description |
|---|---|
value | value for Slack's source field |
Returns: this builder
Related types: FileBlock
BlockId
Sets a unique identifier for this block. Slack returns it in interaction payloads, so use a stable value when you need to find the block again.
Slack allows at most 255 characters.
public FileBlock.Builder blockId(String value)
| Parameter | Description |
|---|---|
value | value for Slack's block_id field |
Returns: this builder
Related types: FileBlock
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 FileBlock.Builder wireField(String field, Object value)
| Parameter | Description |
|---|---|
field | Slack JSON field name |
value | JSON-compatible value |
Returns: this builder
| Throws | When |
|---|---|
IllegalArgumentException | if the field name is empty or the value cannot be written as Slack JSON |
Related types: FileBlock
Build
Validates the configured fields and creates an immutable value. The builder can be reused.
public FileBlock build()
Returns: an immutable FileBlock
| Throws | When |
|---|---|
ValidationException | if the value breaks a Block Kit rule, such as a missing required field or an exceeded length limit |
Related types: FileBlock
HeaderBlock
Large, bold plain text that introduces a group of blocks.
Start with builder(), set fields with the named fluent methods, and call Builder.build() to validate and create an immutable value.
- Required:
text.
See the Slack reference.
Builder — no arguments
Starts a new builder.
public static HeaderBlock.Builder builder()
Returns: a new builder
Related types: HeaderBlock
Builder — String
Starts a header builder with its required text.
public static HeaderBlock.Builder builder(String text)
| Parameter | Description |
|---|---|
text | header text |
Returns: a new builder
Related types: HeaderBlock
GetText
Returns the header text, shown in a larger bold font.
public PlainText getText()
Returns: the value
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: PlainText
Text — String
Sets the header text, shown in a larger bold font.
Required. Slack allows at most 150 characters. The string is sent as a plain_text text object.
public HeaderBlock.Builder text(String value)
| Parameter | Description |
|---|---|
value | text content |
Returns: this builder
Related types: HeaderBlock
Text — PlainText
Sets the header text, shown in a larger bold font.
Required. Slack allows at most 150 characters.
public HeaderBlock.Builder text(PlainText value)
| Parameter | Description |
|---|---|
value | a PlainText object |
Returns: this builder
Related types: HeaderBlock, PlainText
PlainText
Sets the header text, shown in a larger bold font.
Required. Slack allows at most 150 characters. Equivalent to text(String).
public HeaderBlock.Builder plainText(String value)
| Parameter | Description |
|---|---|
value | text content |
Returns: this builder
Related types: HeaderBlock
BlockId
Sets a unique identifier for this block. Slack returns it in interaction payloads, so use a stable value when you need to find the block again.
Slack allows at most 255 characters.
public HeaderBlock.Builder blockId(String value)
| Parameter | Description |
|---|---|
value | value for Slack's block_id field |
Returns: this builder
Related types: HeaderBlock
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 HeaderBlock.Builder wireField(String field, Object value)
| Parameter | Description |
|---|---|
field | Slack JSON field name |
value | JSON-compatible value |
Returns: this builder
| Throws | When |
|---|---|
IllegalArgumentException | if the field name is empty or the value cannot be written as Slack JSON |
Related types: HeaderBlock
Build
Validates the configured fields and creates an immutable value. The builder can be reused.
public HeaderBlock build()
Returns: an immutable HeaderBlock
| Throws | When |
|---|---|
ValidationException | if the value breaks a Block Kit rule, such as a missing required field or an exceeded length limit |
Related types: HeaderBlock
ImageBlock
A standalone image with alternative text and an optional title.
Start with builder(), set fields with the named fluent methods, and call Builder.build() to validate and create an immutable value.
- Required:
imageUrl,altText.
See the Slack reference.
Builder — no arguments
Starts a new builder.
public static ImageBlock.Builder builder()
Returns: a new builder
Related types: ImageBlock
Builder — String, String
Starts an image builder with its required URL and alternative text.
public static ImageBlock.Builder builder(String imageUrl, String altText)
| Parameter | Description |
|---|---|
imageUrl | public image URL |
altText | accessible image description |
Returns: a new builder
Related types: ImageBlock
GetImageUrl
Returns the publicly accessible URL of the image. Cannot be combined with a Slack file.
public String getImageUrl()
Returns: the value
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetAltText
Returns a plain-text summary of the image or video for assistive technology.
public String getAltText()
Returns: the value
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetTitle
Returns the title shown above the image.
public Optional<PlainText> getTitle()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: PlainText
ImageUrl
Sets the publicly accessible URL of the image. Cannot be combined with a Slack file.
Required. Slack allows at most 3000 characters.
public ImageBlock.Builder imageUrl(String value)
| Parameter | Description |
|---|---|
value | value for Slack's image_url field |
Returns: this builder
Related types: ImageBlock
AltText
Sets a plain-text summary of the image or video for assistive technology.
Required. Slack allows at most 2000 characters.
public ImageBlock.Builder altText(String value)
| Parameter | Description |
|---|---|
value | value for Slack's alt_text field |
Returns: this builder
Related types: ImageBlock
Title — String
Sets the title shown above the image.
The string is sent as a plain_text text object.
public ImageBlock.Builder title(String value)
| Parameter | Description |
|---|---|
value | text content |
Returns: this builder
Related types: ImageBlock
Title — PlainText
Sets the title shown above the image.
public ImageBlock.Builder title(PlainText value)
| Parameter | Description |
|---|---|
value | a PlainText object |
Returns: this builder
Related types: ImageBlock, PlainText
BlockId
Sets a unique identifier for this block. Slack returns it in interaction payloads, so use a stable value when you need to find the block again.
Slack allows at most 255 characters.
public ImageBlock.Builder blockId(String value)
| Parameter | Description |
|---|---|
value | value for Slack's block_id field |
Returns: this builder
Related types: ImageBlock
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 ImageBlock.Builder wireField(String field, Object value)
| Parameter | Description |
|---|---|
field | Slack JSON field name |
value | JSON-compatible value |
Returns: this builder
| Throws | When |
|---|---|
IllegalArgumentException | if the field name is empty or the value cannot be written as Slack JSON |
Related types: ImageBlock
Build
Validates the configured fields and creates an immutable value. The builder can be reused.
public ImageBlock build()
Returns: an immutable ImageBlock
| Throws | When |
|---|---|
ValidationException | if the value breaks a Block Kit rule, such as a missing required field or an exceeded length limit |
Related types: ImageBlock
InputBlock
A labelled input that collects a value in a modal, App Home, or message.
Start with builder(), set fields with the named fluent methods, and call Builder.build() to validate and create an immutable value.
- Required:
label,element.
See the Slack reference.
Builder
Starts a new builder.
public static InputBlock.Builder builder()
Returns: a new builder
Related types: InputBlock
GetLabel
Returns the label shown above the input.
public PlainText getLabel()
Returns: the value
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: PlainText
GetElement
Returns the input element that collects the user's value.
public InputElement getElement()
Returns: the value
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: InputElement
GetDispatchAction
Returns whether changing the element sends a block_actions payload immediately.
public Optional<Boolean> getDispatchAction()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetHint
Returns helper text shown below the input.
public Optional<PlainText> getHint()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: PlainText
GetOptional
Returns whether the modal can be submitted when this input is empty.
public Optional<Boolean> getOptional()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Label — String
Sets the label shown above the input.
Required. Slack allows at most 2000 characters. The string is sent as a plain_text text object.
public InputBlock.Builder label(String value)
| Parameter | Description |
|---|---|
value | text content |
Returns: this builder
Related types: InputBlock
Label — PlainText
Sets the label shown above the input.
Required. Slack allows at most 2000 characters.
public InputBlock.Builder label(PlainText value)
| Parameter | Description |
|---|---|
value | a PlainText object |
Returns: this builder
Related types: InputBlock, PlainText
Element
Sets the input element that collects the user's value.
Required.
public InputBlock.Builder element(InputElement value)
| Parameter | Description |
|---|---|
value | nested InputElement |
Returns: this builder
Related types: InputBlock, InputElement
DispatchAction
Sets whether changing the element sends a block_actions payload immediately.
public InputBlock.Builder dispatchAction(boolean value)
| Parameter | Description |
|---|---|
value | value for Slack's dispatch_action field |
Returns: this builder
Related types: InputBlock
BlockId
Sets a unique identifier for this block. Slack returns it in interaction payloads, so use a stable value when you need to find the block again.
Slack allows at most 255 characters.
public InputBlock.Builder blockId(String value)
| Parameter | Description |
|---|---|
value | value for Slack's block_id field |
Returns: this builder
Related types: InputBlock
Hint — String
Sets helper text shown below the input.
Slack allows at most 2000 characters. The string is sent as a plain_text text object.
public InputBlock.Builder hint(String value)
| Parameter | Description |
|---|---|
value | text content |
Returns: this builder
Related types: InputBlock
Hint — PlainText
Sets helper text shown below the input.
Slack allows at most 2000 characters.
public InputBlock.Builder hint(PlainText value)
| Parameter | Description |
|---|---|
value | a PlainText object |
Returns: this builder
Related types: InputBlock, PlainText
Optional
Sets whether the modal can be submitted when this input is empty.
public InputBlock.Builder optional(boolean value)
| Parameter | Description |
|---|---|
value | value for Slack's optional field |
Returns: this builder
Related types: InputBlock
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 InputBlock.Builder wireField(String field, Object value)
| Parameter | Description |
|---|---|
field | Slack JSON field name |
value | JSON-compatible value |
Returns: this builder
| Throws | When |
|---|---|
IllegalArgumentException | if the field name is empty or the value cannot be written as Slack JSON |
Related types: InputBlock
Build
Validates the configured fields and creates an immutable value. The builder can be reused.
public InputBlock build()
Returns: an immutable InputBlock
| Throws | When |
|---|---|
ValidationException | if the value breaks a Block Kit rule, such as a missing required field or an exceeded length limit |
Related types: InputBlock
MarkdownBlock
Standard markdown rendered by Slack, intended for AI-generated content.
Start with builder(), set fields with the named fluent methods, and call Builder.build() to validate and create an immutable value.
- Required:
text.
See the Slack reference.
Builder
Starts a new builder.
public static MarkdownBlock.Builder builder()
Returns: a new builder
Related types: MarkdownBlock
GetText
Returns standard markdown content, which Slack renders directly.
public String getText()
Returns: the value
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Text
Sets standard markdown content, which Slack renders directly.
Required. Must be between 1 and 12000 characters.
public MarkdownBlock.Builder text(String value)
| Parameter | Description |
|---|---|
value | value for Slack's text field |
Returns: this builder
Related types: MarkdownBlock
BlockId
Sets a unique identifier for this block. Slack returns it in interaction payloads, so use a stable value when you need to find the block again.
Slack allows at most 255 characters.
public MarkdownBlock.Builder blockId(String value)
| Parameter | Description |
|---|---|
value | value for Slack's block_id field |
Returns: this builder
Related types: MarkdownBlock
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 MarkdownBlock.Builder wireField(String field, Object value)
| Parameter | Description |
|---|---|
field | Slack JSON field name |
value | JSON-compatible value |
Returns: this builder
| Throws | When |
|---|---|
IllegalArgumentException | if the field name is empty or the value cannot be written as Slack JSON |
Related types: MarkdownBlock
Build
Validates the configured fields and creates an immutable value. The builder can be reused.
public MarkdownBlock build()
Returns: an immutable MarkdownBlock
| Throws | When |
|---|---|
ValidationException | if the value breaks a Block Kit rule, such as a missing required field or an exceeded length limit |
Related types: MarkdownBlock
PlanBlock
A titled sequence of task cards.
Start with builder(), set fields with the named fluent methods, and call Builder.build() to validate and create an immutable value.
- Required:
title.
See the Slack reference.
Builder
Starts a new builder.
public static PlanBlock.Builder builder()
Returns: a new builder
Related types: PlanBlock
GetTitle
Returns the plan title.
public String getTitle()
Returns: the value
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetTasks
Returns task cards in display order.
public List<TaskCardBlock> getTasks()
Returns: the values in order, or an empty list when none were set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: TaskCardBlock
Title
Sets the plan title.
Required.
public PlanBlock.Builder title(String value)
| Parameter | Description |
|---|---|
value | value for Slack's title field |
Returns: this builder
Related types: PlanBlock
Tasks
Adds task cards in display order.
Each call appends to any values already added.
public PlanBlock.Builder tasks(TaskCardBlock... values)
| Parameter | Description |
|---|---|
values | TaskCardBlock values appended in order |
Returns: this builder
Related types: PlanBlock, TaskCardBlock
BlockId
Sets a unique identifier for this block. Slack returns it in interaction payloads, so use a stable value when you need to find the block again.
Slack allows at most 255 characters.
public PlanBlock.Builder blockId(String value)
| Parameter | Description |
|---|---|
value | value for Slack's block_id field |
Returns: this builder
Related types: PlanBlock
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 PlanBlock.Builder wireField(String field, Object value)
| Parameter | Description |
|---|---|
field | Slack JSON field name |
value | JSON-compatible value |
Returns: this builder
| Throws | When |
|---|---|
IllegalArgumentException | if the field name is empty or the value cannot be written as Slack JSON |
Related types: PlanBlock
Build
Validates the configured fields and creates an immutable value. The builder can be reused.
public PlanBlock build()
Returns: an immutable PlanBlock
| Throws | When |
|---|---|
ValidationException | if the value breaks a Block Kit rule, such as a missing required field or an exceeded length limit |
Related types: PlanBlock
RichTextBlock
Formatted text built from sections, lists, preformatted blocks, and quotes.
Start with builder(), set fields with the named fluent methods, and call Builder.build() to validate and create an immutable value.
- Required:
elements.
See the Slack reference.
Builder
Starts a new builder.
public static RichTextBlock.Builder builder()
Returns: a new builder
Related types: RichTextBlock
GetElements
Returns sections, lists, preformatted blocks, and quotes in display order.
public List<RichTextBlockElement> getElements()
Returns: the values in order, or an empty list when none were set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: RichTextBlockElement
Elements
Adds sections, lists, preformatted blocks, and quotes in display order.
Required. Each call appends to any values already added.
public RichTextBlock.Builder elements(RichTextBlockElement... values)
| Parameter | Description |
|---|---|
values | RichTextBlockElement values appended in order |
Returns: this builder
Related types: RichTextBlock, RichTextBlockElement
BlockId
Sets a unique identifier for this block. Slack returns it in interaction payloads, so use a stable value when you need to find the block again.
Slack allows at most 255 characters.
public RichTextBlock.Builder blockId(String value)
| Parameter | Description |
|---|---|
value | value for Slack's block_id field |
Returns: this builder
Related types: RichTextBlock
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 RichTextBlock.Builder wireField(String field, Object value)
| Parameter | Description |
|---|---|
field | Slack JSON field name |
value | JSON-compatible value |
Returns: this builder
| Throws | When |
|---|---|
IllegalArgumentException | if the field name is empty or the value cannot be written as Slack JSON |
Related types: RichTextBlock
Build
Validates the configured fields and creates an immutable value. The builder can be reused.
public RichTextBlock build()
Returns: an immutable RichTextBlock
| Throws | When |
|---|---|
ValidationException | if the value breaks a Block Kit rule, such as a missing required field or an exceeded length limit |
Related types: RichTextBlock
SectionBlock
Text, a grid of fields, or both, with an optional accessory element.
Start with builder(), set fields with the named fluent methods, and call Builder.build() to validate and create an immutable value.
- Provide text, fields, or both.
See the Slack reference.
Builder
Starts a new builder.
public static SectionBlock.Builder builder()
Returns: a new builder
Related types: SectionBlock
GetText
Returns the main text of the section.
public Optional<Text> getText()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: Text
GetFields
Returns section fields, shown in a two-column grid, in display order.
public List<Text> getFields()
Returns: the values in order, or an empty list when none were set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: Text
GetAccessory
Returns the element displayed beside the section text.
public Optional<Element> getAccessory()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: Element
Text — String
Sets the main text of the section.
Slack allows at most 3000 characters. The string is sent as a mrkdwn text object.
public SectionBlock.Builder text(String value)
| Parameter | Description |
|---|---|
value | text content |
Returns: this builder
Related types: SectionBlock
Text — Text
Sets the main text of the section.
Slack allows at most 3000 characters.
public SectionBlock.Builder text(Text value)
| Parameter | Description |
|---|---|
value | a Text object |
Returns: this builder
Related types: SectionBlock, Text
MarkdownText
Sets the main text of the section.
Slack allows at most 3000 characters. Equivalent to text(String).
public SectionBlock.Builder markdownText(String value)
| Parameter | Description |
|---|---|
value | text content |
Returns: this builder
Related types: SectionBlock
Fields
Adds section fields, shown in a two-column grid, in display order.
Slack allows at most 10 items, each at most 2000 characters. Each call appends to any values already added.
public SectionBlock.Builder fields(Text... values)
| Parameter | Description |
|---|---|
values | Text objects appended in order |
Returns: this builder
Related types: SectionBlock, Text
MarkdownFields
Adds section fields, shown in a two-column grid, in display order.
Slack allows at most 10 items, each at most 2000 characters. Each string is sent as a mrkdwn text object.
public SectionBlock.Builder markdownFields(String... values)
| Parameter | Description |
|---|---|
values | strings appended in order |
Returns: this builder
Related types: SectionBlock
Accessory
Sets the element displayed beside the section text.
public SectionBlock.Builder accessory(Element value)
| Parameter | Description |
|---|---|
value | nested Element |
Returns: this builder
Related types: Element, SectionBlock
BlockId
Sets a unique identifier for this block. Slack returns it in interaction payloads, so use a stable value when you need to find the block again.
Slack allows at most 255 characters.
public SectionBlock.Builder blockId(String value)
| Parameter | Description |
|---|---|
value | value for Slack's block_id field |
Returns: this builder
Related types: SectionBlock
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 SectionBlock.Builder wireField(String field, Object value)
| Parameter | Description |
|---|---|
field | Slack JSON field name |
value | JSON-compatible value |
Returns: this builder
| Throws | When |
|---|---|
IllegalArgumentException | if the field name is empty or the value cannot be written as Slack JSON |
Related types: SectionBlock
Build
Validates the configured fields and creates an immutable value. The builder can be reused.
public SectionBlock build()
Returns: an immutable SectionBlock
| Throws | When |
|---|---|
ValidationException | if the value breaks a Block Kit rule, such as a missing required field or an exceeded length limit |
Related types: SectionBlock
TableBlock
A simple table of raw text and rich text cells.
Start with builder(), set fields with the named fluent methods, and call Builder.build() to validate and create an immutable value.
-
Required:
rows. -
Every row must have the same number of cells.
-
Column settings need one entry for every column.
See the Slack reference.
Builder
Starts a new builder.
public static TableBlock.Builder builder()
Returns: a new builder
Related types: TableBlock
GetRows
Returns complete table rows in display order. Every row must have the same number of cells.
public List<List<TableCell>> getRows()
Returns: the values in order, or an empty list when none were set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: TableCell
GetColumnSettings
Returns per-column settings in column order. Provide one entry for every column.
public List<ColumnSettings> getColumnSettings()
Returns: the values in order, or an empty list when none were set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: ColumnSettings
Rows
Adds complete table rows in display order. Every row must have the same number of cells.
Required. Each call appends to any rows already added.
public final TableBlock.Builder rows(List<? extends TableCell>... rows)
| Parameter | Description |
|---|---|
rows | rows of TableCell values, in display order |
Returns: this builder
Related types: TableBlock, TableCell
ColumnSettings
Adds per-column settings in column order. Provide one entry for every column.
Each call appends to any values already added.
public TableBlock.Builder columnSettings(ColumnSettings... values)
| Parameter | Description |
|---|---|
values | ColumnSettings values appended in order |
Returns: this builder
Related types: ColumnSettings, TableBlock
BlockId
Sets a unique identifier for this block. Slack returns it in interaction payloads, so use a stable value when you need to find the block again.
Slack allows at most 255 characters.
public TableBlock.Builder blockId(String value)
| Parameter | Description |
|---|---|
value | value for Slack's block_id field |
Returns: this builder
Related types: TableBlock
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 TableBlock.Builder wireField(String field, Object value)
| Parameter | Description |
|---|---|
field | Slack JSON field name |
value | JSON-compatible value |
Returns: this builder
| Throws | When |
|---|---|
IllegalArgumentException | if the field name is empty or the value cannot be written as Slack JSON |
Related types: TableBlock
Build
Validates the configured fields and creates an immutable value. The builder can be reused.
public TableBlock build()
Returns: an immutable TableBlock
| Throws | When |
|---|---|
ValidationException | if the value breaks a Block Kit rule, such as a missing required field or an exceeded length limit |
Related types: TableBlock
TableCell
A value that can appear as a table block cell: raw text or a rich text block.
Implemented by RawText, RichTextBlock.
TaskCardBlock
One task with its status, details, output, and sources.
Start with builder(), set fields with the named fluent methods, and call Builder.build() to validate and create an immutable value.
- Required:
taskId,title.
See the Slack reference.
Builder
Starts a new builder.
public static TaskCardBlock.Builder builder()
Returns: a new builder
Related types: TaskCardBlock
GetTaskId
Returns the identifier of the task.
public String getTaskId()
Returns: the value
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetTitle
Returns the task title.
public String getTitle()
Returns: the value
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetDetails
Returns a rich text description of the task.
public Optional<RichTextBlock> getDetails()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: RichTextBlock
GetOutput
Returns rich text describing the task's output.
public Optional<RichTextBlock> getOutput()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: RichTextBlock
GetSources
Returns links to the sources the task used, in display order.
public List<UrlSource> getSources()
Returns: the values in order, or an empty list when none were set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: UrlSource
GetStatus
Returns the task's current state.
public Optional<TaskStatus> getStatus()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: TaskStatus
TaskId
Sets the identifier of the task.
Required.
public TaskCardBlock.Builder taskId(String value)
| Parameter | Description |
|---|---|
value | value for Slack's task_id field |
Returns: this builder
Related types: TaskCardBlock
Title
Sets the task title.
Required.
public TaskCardBlock.Builder title(String value)
| Parameter | Description |
|---|---|
value | value for Slack's title field |
Returns: this builder
Related types: TaskCardBlock
Details
Sets a rich text description of the task.
public TaskCardBlock.Builder details(RichTextBlock value)
| Parameter | Description |
|---|---|
value | nested RichTextBlock |
Returns: this builder
Related types: RichTextBlock, TaskCardBlock
Output
Sets rich text describing the task's output.
public TaskCardBlock.Builder output(RichTextBlock value)
| Parameter | Description |
|---|---|
value | nested RichTextBlock |
Returns: this builder
Related types: RichTextBlock, TaskCardBlock
Sources
Adds links to the sources the task used, in display order.
Each call appends to any values already added.
public TaskCardBlock.Builder sources(UrlSource... values)
| Parameter | Description |
|---|---|
values | UrlSource values appended in order |
Returns: this builder
Related types: TaskCardBlock, UrlSource
Status
Sets the task's current state.
public TaskCardBlock.Builder status(TaskStatus value)
| Parameter | Description |
|---|---|
value | value for Slack's status field |
Returns: this builder
Related types: TaskCardBlock, TaskStatus
BlockId
Sets a unique identifier for this block. Slack returns it in interaction payloads, so use a stable value when you need to find the block again.
Slack allows at most 255 characters.
public TaskCardBlock.Builder blockId(String value)
| Parameter | Description |
|---|---|
value | value for Slack's block_id field |
Returns: this builder
Related types: TaskCardBlock
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 TaskCardBlock.Builder wireField(String field, Object value)
| Parameter | Description |
|---|---|
field | Slack JSON field name |
value | JSON-compatible value |
Returns: this builder
| Throws | When |
|---|---|
IllegalArgumentException | if the field name is empty or the value cannot be written as Slack JSON |
Related types: TaskCardBlock
Build
Validates the configured fields and creates an immutable value. The builder can be reused.
public TaskCardBlock build()
Returns: an immutable TaskCardBlock
| Throws | When |
|---|---|
ValidationException | if the value breaks a Block Kit rule, such as a missing required field or an exceeded length limit |
Related types: TaskCardBlock
TaskStatus
States supported by task card blocks.
| Constant | Slack value | Meaning |
|---|---|---|
PENDING | pending | The task has not started. |
IN_PROGRESS | in_progress | The task is running. |
COMPLETE | complete | The task finished successfully. |
ERROR | error | The task failed. |
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<TaskStatus> fromWireValue(String wireValue)
| Parameter | Description |
|---|---|
wireValue | the value Slack uses in JSON |
Returns: the matching constant, or an empty optional for an unknown value
Related types: TaskStatus
VideoBlock
An embedded video player.
Start with builder(), set fields with the named fluent methods, and call Builder.build() to validate and create an immutable value.
- Required:
altText,thumbnailUrl,title,videoUrl.
See the Slack reference.
Builder
Starts a new builder.
public static VideoBlock.Builder builder()
Returns: a new builder
Related types: VideoBlock
GetAltText
Returns a plain-text summary of the image or video for assistive technology.
public String getAltText()
Returns: the value
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetThumbnailUrl
Returns the URL of the image shown before the video plays.
public String getThumbnailUrl()
Returns: the value
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetTitle
Returns the video title.
public PlainText getTitle()
Returns: the value
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: PlainText
GetVideoUrl
Returns the embeddable URL of the video. The domain must be listed in the app's unfurl domains.
public String getVideoUrl()
Returns: the value
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetAuthorName
Returns the name of the video's author.
public Optional<String> getAuthorName()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetDescription
Returns the video description.
public Optional<PlainText> getDescription()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
Related types: PlainText
GetProviderIconUrl
Returns the URL of the video provider's icon.
public Optional<String> getProviderIconUrl()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetProviderName
Returns the name of the video provider, such as YouTube.
public Optional<String> getProviderName()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
GetTitleUrl
Returns the HTTPS URL opened when the title is clicked.
public Optional<String> getTitleUrl()
Returns: the value, or an empty optional when it was not set
| Throws | When |
|---|---|
IllegalStateException | if the field was set through a raw wire field to a value this type cannot represent |
AltText
Sets a plain-text summary of the image or video for assistive technology.
Required. Must be between 1 and 200 characters.
public VideoBlock.Builder altText(String value)
| Parameter | Description |
|---|---|
value | value for Slack's alt_text field |
Returns: this builder
Related types: VideoBlock
ThumbnailUrl
Sets the URL of the image shown before the video plays.
Required.
public VideoBlock.Builder thumbnailUrl(String value)
| Parameter | Description |
|---|---|
value | value for Slack's thumbnail_url field |
Returns: this builder
Related types: VideoBlock
Title — String
Sets the video title.
Required. Slack allows at most 200 characters. The string is sent as a plain_text text object.
public VideoBlock.Builder title(String value)
| Parameter | Description |
|---|---|
value | text content |
Returns: this builder
Related types: VideoBlock
Title — PlainText
Sets the video title.
Required. Slack allows at most 200 characters.
public VideoBlock.Builder title(PlainText value)
| Parameter | Description |
|---|---|
value | a PlainText object |
Returns: this builder
Related types: PlainText, VideoBlock
VideoUrl
Sets the embeddable URL of the video. The domain must be listed in the app's unfurl domains.
Required.
public VideoBlock.Builder videoUrl(String value)
| Parameter | Description |
|---|---|
value | value for Slack's video_url field |
Returns: this builder
Related types: VideoBlock
BlockId
Sets a unique identifier for this block. Slack returns it in interaction payloads, so use a stable value when you need to find the block again.
Slack allows at most 255 characters.
public VideoBlock.Builder blockId(String value)
| Parameter | Description |
|---|---|
value | value for Slack's block_id field |
Returns: this builder
Related types: VideoBlock
AuthorName
Sets the name of the video's author.
Slack allows at most 50 characters.
public VideoBlock.Builder authorName(String value)
| Parameter | Description |
|---|---|
value | value for Slack's author_name field |
Returns: this builder
Related types: VideoBlock
Description — String
Sets the video description.
Slack allows at most 200 characters. The string is sent as a plain_text text object.
public VideoBlock.Builder description(String value)
| Parameter | Description |
|---|---|
value | text content |
Returns: this builder
Related types: VideoBlock
Description — PlainText
Sets the video description.
Slack allows at most 200 characters.
public VideoBlock.Builder description(PlainText value)
| Parameter | Description |
|---|---|
value | a PlainText object |
Returns: this builder
Related types: PlainText, VideoBlock
ProviderIconUrl
Sets the URL of the video provider's icon.
public VideoBlock.Builder providerIconUrl(String value)
| Parameter | Description |
|---|---|
value | value for Slack's provider_icon_url field |
Returns: this builder
Related types: VideoBlock
ProviderName
Sets the name of the video provider, such as YouTube.
Slack allows at most 50 characters.
public VideoBlock.Builder providerName(String value)
| Parameter | Description |
|---|---|
value | value for Slack's provider_name field |
Returns: this builder
Related types: VideoBlock
TitleUrl
Sets the HTTPS URL opened when the title is clicked.
public VideoBlock.Builder titleUrl(String value)
| Parameter | Description |
|---|---|
value | value for Slack's title_url field |
Returns: this builder
Related types: VideoBlock
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 VideoBlock.Builder wireField(String field, Object value)
| Parameter | Description |
|---|---|
field | Slack JSON field name |
value | JSON-compatible value |
Returns: this builder
| Throws | When |
|---|---|
IllegalArgumentException | if the field name is empty or the value cannot be written as Slack JSON |
Related types: VideoBlock
Build
Validates the configured fields and creates an immutable value. The builder can be reused.
public VideoBlock build()
Returns: an immutable VideoBlock
| Throws | When |
|---|---|
ValidationException | if the value breaks a Block Kit rule, such as a missing required field or an exceeded length limit |
Related types: VideoBlock