Blocks
This page documents the Ruby API for blocks. Values use keyword-only construction, validate before freezing, and serialize to Slack JSON.
ActionsBlock
A block that holds interactive elements such as buttons and menus.
See the Slack reference.
.new
Construct an immutable, validated value with keyword arguments. Required keywords: elements.
def self.new: (elements: Array[Element], ?block_id: (String)?, ?additional_fields: Hash[String | Symbol, untyped]?) -> ActionsBlock
| Parameter | Description |
|---|---|
elements | Adds interactive elements in display order. |
block_id | 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. |
additional_fields | JSON-compatible extension fields that do not replace modeled wire keys. |
Returns: ActionsBlock
| Throws | When |
|---|---|
ValidationError | A field or cross-field Slack rule fails. |
Related types: ActionsBlock, Element
.[]
Keyword-only alias for .new.
def self.[]: (elements: Array[Element], ?block_id: (String)?, ?additional_fields: Hash[String | Symbol, untyped]?) -> ActionsBlock
Returns: ActionsBlock
Related types: ActionsBlock, Element
elements
Adds interactive elements in display order. Wire key: elements.
def elements: () -> Array[Element]
Returns: Array[Element]
Related types: Element
block_id
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. Wire key: block_id.
def block_id: () -> (String)?
Returns: (String)?
additional_fields
Return frozen extension fields with normalized string keys.
def additional_fields: () -> Hash[String, untyped]
with
Return a newly validated value with changed keywords.
def with: (**untyped changes) -> ActionsBlock
Returns: ActionsBlock
Related types: ActionsBlock
to_h
Return structural Ruby members, including additional_fields. Nested members remain frozen.
def to_h: () -> Hash[Symbol, untyped]
as_json
Return a fresh, detached Slack wire Hash.
def as_json: (?untyped options) -> Hash[String, untyped]
to_json
Encode the Slack wire payload as JSON.
def to_json: (?untyped options) -> String
AlertBlock
A severity-labelled alert, available in modals.
See the Slack reference.
.new
Construct an immutable, validated value with keyword arguments. Required keywords: text.
def self.new: (text: String | Text, ?level: (:default | :info | :warning | :error | :success)?, ?block_id: (String)?, ?additional_fields: Hash[String | Symbol, untyped]?) -> AlertBlock
| Parameter | Description |
|---|---|
text | Sets the alert message. |
level | Sets the alert severity, which controls its color and icon. |
block_id | 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. |
additional_fields | JSON-compatible extension fields that do not replace modeled wire keys. |
Returns: AlertBlock
| Throws | When |
|---|---|
ValidationError | A field or cross-field Slack rule fails. |
Related types: AlertBlock, Text
.[]
Keyword-only alias for .new.
def self.[]: (text: String | Text, ?level: (:default | :info | :warning | :error | :success)?, ?block_id: (String)?, ?additional_fields: Hash[String | Symbol, untyped]?) -> AlertBlock
Returns: AlertBlock
Related types: AlertBlock, Text
text
Sets the alert message. Wire key: text.
def text: () -> Text
Returns: Text
Related types: Text
level
Sets the alert severity, which controls its color and icon. Wire key: level.
def level: () -> (:default | :info | :warning | :error | :success)?
Returns: (:default | :info | :warning | :error | :success)?
block_id
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. Wire key: block_id.
def block_id: () -> (String)?
Returns: (String)?
additional_fields
Return frozen extension fields with normalized string keys.
def additional_fields: () -> Hash[String, untyped]
with
Return a newly validated value with changed keywords.
def with: (**untyped changes) -> AlertBlock
Returns: AlertBlock
Related types: AlertBlock
to_h
Return structural Ruby members, including additional_fields. Nested members remain frozen.
def to_h: () -> Hash[Symbol, untyped]
as_json
Return a fresh, detached Slack wire Hash.
def as_json: (?untyped options) -> Hash[String, untyped]
to_json
Encode the Slack wire payload as JSON.
def to_json: (?untyped options) -> String
AlertLevel
Severity levels supported by alert blocks. Pass the wire symbol to constructor keywords.
| Constant | Slack value | Meaning |
|---|---|---|
DEFAULT | :default | Neutral styling. |
INFO | :info | Informational styling. |
WARNING | :warning | Warning styling. |
ERROR | :error | Error styling. |
SUCCESS | :success | Success styling. |
Block
A validated Slack layout block accepted by payload block arrays.
CardBlock
A compact card with an image, text, and up to three buttons.
See the Slack reference.
.new
Construct an immutable, validated value with keyword arguments.
def self.new: (?hero_image: (ImageElement)?, ?icon: (ImageElement)?, ?title: (String | Text)?, ?subtitle: (String | Text)?, ?body: (String | Text)?, ?actions: (Array[ButtonElement])?, ?slack_icon: (SlackIcon)?, ?subtext: (String | Text)?, ?block_id: (String)?, ?additional_fields: Hash[String | Symbol, untyped]?) -> CardBlock
| Parameter | Description |
|---|---|
hero_image | Sets the image displayed prominently at the top of the card. |
icon | Sets the image displayed beside the title. |
title | Sets the card title. |
subtitle | Sets the supporting text shown below the title. |
body | Sets the main body text of the card. |
actions | Adds up to three buttons in serialization order. Slack controls their visual placement: buttons are right-aligned with primary last; a danger button precedes the other button in a two-button group, or sits at the card's far left with three buttons. |
slack_icon | Sets a Slack-provided icon displayed beside the title. Cannot be combined with an image icon. |
subtext | Sets the small print shown at the bottom of the card. |
block_id | 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. |
additional_fields | JSON-compatible extension fields that do not replace modeled wire keys. |
Returns: CardBlock
| Throws | When |
|---|---|
ValidationError | A field or cross-field Slack rule fails. |
Related types: ButtonElement, CardBlock, ImageElement, SlackIcon, Text
.[]
Keyword-only alias for .new.
def self.[]: (?hero_image: (ImageElement)?, ?icon: (ImageElement)?, ?title: (String | Text)?, ?subtitle: (String | Text)?, ?body: (String | Text)?, ?actions: (Array[ButtonElement])?, ?slack_icon: (SlackIcon)?, ?subtext: (String | Text)?, ?block_id: (String)?, ?additional_fields: Hash[String | Symbol, untyped]?) -> CardBlock
Returns: CardBlock
Related types: ButtonElement, CardBlock, ImageElement, SlackIcon, Text
hero_image
Sets the image displayed prominently at the top of the card. Wire key: hero_image.
def hero_image: () -> (ImageElement)?
Returns: (ImageElement)?
Related types: ImageElement
icon
Sets the image displayed beside the title. Wire key: icon.
def icon: () -> (ImageElement)?
Returns: (ImageElement)?
Related types: ImageElement
title
Sets the card title. Wire key: title.
def title: () -> (Text)?
Returns: (Text)?
Related types: Text
subtitle
Sets the supporting text shown below the title. Wire key: subtitle.
def subtitle: () -> (Text)?
Returns: (Text)?
Related types: Text
body
Sets the main body text of the card. Wire key: body.
def body: () -> (Text)?
Returns: (Text)?
Related types: Text
actions
Adds up to three buttons in serialization order. Slack controls their visual placement: buttons are right-aligned with primary last; a danger button precedes the other button in a two-button group, or sits at the card's far left with three buttons. Wire key: actions.
def actions: () -> (Array[ButtonElement])?
Returns: (Array[ButtonElement])?
Related types: ButtonElement
slack_icon
Sets a Slack-provided icon displayed beside the title. Cannot be combined with an image icon. Wire key: slack_icon.
def slack_icon: () -> (SlackIcon)?
Returns: (SlackIcon)?
Related types: SlackIcon
subtext
Sets the small print shown at the bottom of the card. Wire key: subtext.
def subtext: () -> (Text)?
Returns: (Text)?
Related types: Text
block_id
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. Wire key: block_id.
def block_id: () -> (String)?
Returns: (String)?
additional_fields
Return frozen extension fields with normalized string keys.
def additional_fields: () -> Hash[String, untyped]
with
Return a newly validated value with changed keywords.
def with: (**untyped changes) -> CardBlock
Returns: CardBlock
Related types: CardBlock
to_h
Return structural Ruby members, including additional_fields. Nested members remain frozen.
def to_h: () -> Hash[Symbol, untyped]
as_json
Return a fresh, detached Slack wire Hash.
def as_json: (?untyped options) -> Hash[String, untyped]
to_json
Encode the Slack wire payload as JSON.
def to_json: (?untyped options) -> String
CarouselBlock
A horizontally scrolling set of cards, available in messages and App Home.
See the Slack reference.
.new
Construct an immutable, validated value with keyword arguments. Required keywords: elements.
def self.new: (elements: Array[CardBlock], ?block_id: (String)?, ?additional_fields: Hash[String | Symbol, untyped]?) -> CarouselBlock
| Parameter | Description |
|---|---|
elements | Adds the cards in display order. |
block_id | 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. |
additional_fields | JSON-compatible extension fields that do not replace modeled wire keys. |
Returns: CarouselBlock
| Throws | When |
|---|---|
ValidationError | A field or cross-field Slack rule fails. |
Related types: CardBlock, CarouselBlock
.[]
Keyword-only alias for .new.
def self.[]: (elements: Array[CardBlock], ?block_id: (String)?, ?additional_fields: Hash[String | Symbol, untyped]?) -> CarouselBlock
Returns: CarouselBlock
Related types: CardBlock, CarouselBlock
elements
Adds the cards in display order. Wire key: elements.
def elements: () -> Array[CardBlock]
Returns: Array[CardBlock]
Related types: CardBlock
block_id
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. Wire key: block_id.
def block_id: () -> (String)?
Returns: (String)?
additional_fields
Return frozen extension fields with normalized string keys.
def additional_fields: () -> Hash[String, untyped]
with
Return a newly validated value with changed keywords.
def with: (**untyped changes) -> CarouselBlock
Returns: CarouselBlock
Related types: CarouselBlock
to_h
Return structural Ruby members, including additional_fields. Nested members remain frozen.
def to_h: () -> Hash[Symbol, untyped]
as_json
Return a fresh, detached Slack wire Hash.
def as_json: (?untyped options) -> Hash[String, untyped]
to_json
Encode the Slack wire payload as JSON.
def to_json: (?untyped options) -> String
ContainerBlock
A titled group of blocks that can optionally collapse.
See the Slack reference.
.new
Construct an immutable, validated value with keyword arguments. Required keywords: child_blocks.
def self.new: (child_blocks: Array[Block], ?title: (String | PlainText)?, ?rich_text_title: (RichTextBlock)?, ?subtitle: (String | Text)?, ?width: (:narrow | :standard | :wide | :full)?, ?icon: (ImageElement)?, ?is_collapsible: (bool)?, ?default_collapsed: (bool)?, ?has_header_divider: (bool)?, ?block_id: (String)?, ?additional_fields: Hash[String | Symbol, untyped]?) -> ContainerBlock
| Parameter | Description |
|---|---|
child_blocks | Adds the blocks grouped inside the container, in display order. |
title | Sets the container title. Provide either a title or a rich text title. |
rich_text_title | Sets a rich text block used as the title in place of a plain-text title. |
subtitle | Sets the supporting text shown below the title. |
width | Sets the horizontal width of the container. |
icon | Sets the image displayed beside the title. |
is_collapsible | Sets whether users can collapse and expand the container. |
default_collapsed | Sets whether a collapsible container starts collapsed. Requires the container to be collapsible. |
has_header_divider | Sets whether Slack draws a divider below the container header. Only valid for non-collapsible containers. |
block_id | 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. |
additional_fields | JSON-compatible extension fields that do not replace modeled wire keys. |
Returns: ContainerBlock
| Throws | When |
|---|---|
ValidationError | A field or cross-field Slack rule fails. |
Related types: Block, ContainerBlock, ImageElement, PlainText, RichTextBlock, Text
.[]
Keyword-only alias for .new.
def self.[]: (child_blocks: Array[Block], ?title: (String | PlainText)?, ?rich_text_title: (RichTextBlock)?, ?subtitle: (String | Text)?, ?width: (:narrow | :standard | :wide | :full)?, ?icon: (ImageElement)?, ?is_collapsible: (bool)?, ?default_collapsed: (bool)?, ?has_header_divider: (bool)?, ?block_id: (String)?, ?additional_fields: Hash[String | Symbol, untyped]?) -> ContainerBlock
Returns: ContainerBlock
Related types: Block, ContainerBlock, ImageElement, PlainText, RichTextBlock, Text
child_blocks
Adds the blocks grouped inside the container, in display order. Wire key: child_blocks.
def child_blocks: () -> Array[Block]
Returns: Array[Block]
Related types: Block
title
Sets the container title. Provide either a title or a rich text title. Wire key: title.
def title: () -> (PlainText)?
Returns: (PlainText)?
Related types: PlainText
rich_text_title
Sets a rich text block used as the title in place of a plain-text title. Wire key: rich_text_title.
def rich_text_title: () -> (RichTextBlock)?
Returns: (RichTextBlock)?
Related types: RichTextBlock
subtitle
Sets the supporting text shown below the title. Wire key: subtitle.
def subtitle: () -> (Text)?
Returns: (Text)?
Related types: Text
width
Sets the horizontal width of the container. Wire key: width.
def width: () -> (:narrow | :standard | :wide | :full)?
Returns: (:narrow | :standard | :wide | :full)?
icon
Sets the image displayed beside the title. Wire key: icon.
def icon: () -> (ImageElement)?
Returns: (ImageElement)?
Related types: ImageElement
is_collapsible
Sets whether users can collapse and expand the container. Wire key: is_collapsible.
def is_collapsible: () -> (bool)?
Returns: (bool)?
default_collapsed
Sets whether a collapsible container starts collapsed. Requires the container to be collapsible. Wire key: default_collapsed.
def default_collapsed: () -> (bool)?
Returns: (bool)?
has_header_divider
Sets whether Slack draws a divider below the container header. Only valid for non-collapsible containers. Wire key: has_header_divider.
def has_header_divider: () -> (bool)?
Returns: (bool)?
block_id
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. Wire key: block_id.
def block_id: () -> (String)?
Returns: (String)?
additional_fields
Return frozen extension fields with normalized string keys.
def additional_fields: () -> Hash[String, untyped]
with
Return a newly validated value with changed keywords.
def with: (**untyped changes) -> ContainerBlock
Returns: ContainerBlock
Related types: ContainerBlock
to_h
Return structural Ruby members, including additional_fields. Nested members remain frozen.
def to_h: () -> Hash[Symbol, untyped]
as_json
Return a fresh, detached Slack wire Hash.
def as_json: (?untyped options) -> Hash[String, untyped]
to_json
Encode the Slack wire payload as JSON.
def to_json: (?untyped options) -> String
ContainerWidth
Widths supported by Slack container blocks. Pass the wire symbol to constructor keywords.
| 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. |
ContextActionsBlock
A row of feedback or icon buttons, usually shown below AI-generated content.
See the Slack reference.
.new
Construct an immutable, validated value with keyword arguments. Required keywords: elements.
def self.new: (elements: Array[ContextActionsElement], ?block_id: (String)?, ?additional_fields: Hash[String | Symbol, untyped]?) -> ContextActionsBlock
| Parameter | Description |
|---|---|
elements | Adds feedback buttons or icon buttons in display order. |
block_id | 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. |
additional_fields | JSON-compatible extension fields that do not replace modeled wire keys. |
Returns: ContextActionsBlock
| Throws | When |
|---|---|
ValidationError | A field or cross-field Slack rule fails. |
Related types: ContextActionsBlock, ContextActionsElement
.[]
Keyword-only alias for .new.
def self.[]: (elements: Array[ContextActionsElement], ?block_id: (String)?, ?additional_fields: Hash[String | Symbol, untyped]?) -> ContextActionsBlock
Returns: ContextActionsBlock
Related types: ContextActionsBlock, ContextActionsElement
elements
Adds feedback buttons or icon buttons in display order. Wire key: elements.
def elements: () -> Array[ContextActionsElement]
Returns: Array[ContextActionsElement]
Related types: ContextActionsElement
block_id
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. Wire key: block_id.
def block_id: () -> (String)?
Returns: (String)?
additional_fields
Return frozen extension fields with normalized string keys.
def additional_fields: () -> Hash[String, untyped]
with
Return a newly validated value with changed keywords.
def with: (**untyped changes) -> ContextActionsBlock
Returns: ContextActionsBlock
Related types: ContextActionsBlock
to_h
Return structural Ruby members, including additional_fields. Nested members remain frozen.
def to_h: () -> Hash[Symbol, untyped]
as_json
Return a fresh, detached Slack wire Hash.
def as_json: (?untyped options) -> Hash[String, untyped]
to_json
Encode the Slack wire payload as JSON.
def to_json: (?untyped options) -> String
ContextActionsElement
A value that can appear in a context actions block: feedback buttons or an icon button.
ContextBlock
A block of small, secondary images and text.
See the Slack reference.
.new
Construct an immutable, validated value with keyword arguments. Required keywords: elements.
def self.new: (elements: Array[ContextElement], ?block_id: (String)?, ?additional_fields: Hash[String | Symbol, untyped]?) -> ContextBlock
| Parameter | Description |
|---|---|
elements | Adds images and text in display order. |
block_id | 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. |
additional_fields | JSON-compatible extension fields that do not replace modeled wire keys. |
Returns: ContextBlock
| Throws | When |
|---|---|
ValidationError | A field or cross-field Slack rule fails. |
Related types: ContextBlock, ContextElement
.[]
Keyword-only alias for .new.
def self.[]: (elements: Array[ContextElement], ?block_id: (String)?, ?additional_fields: Hash[String | Symbol, untyped]?) -> ContextBlock
Returns: ContextBlock
Related types: ContextBlock, ContextElement
elements
Adds images and text in display order. Wire key: elements.
def elements: () -> Array[ContextElement]
Returns: Array[ContextElement]
Related types: ContextElement
block_id
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. Wire key: block_id.
def block_id: () -> (String)?
Returns: (String)?
additional_fields
Return frozen extension fields with normalized string keys.
def additional_fields: () -> Hash[String, untyped]
with
Return a newly validated value with changed keywords.
def with: (**untyped changes) -> ContextBlock
Returns: ContextBlock
Related types: ContextBlock
to_h
Return structural Ruby members, including additional_fields. Nested members remain frozen.
def to_h: () -> Hash[Symbol, untyped]
as_json
Return a fresh, detached Slack wire Hash.
def as_json: (?untyped options) -> Hash[String, untyped]
to_json
Encode the Slack wire payload as JSON.
def to_json: (?untyped options) -> String
ContextElement
A value that can appear in a context block: an image element or a text object.
DataTableBlock
A sortable, paginated table of raw text, numbers, and rich text.
See the Slack reference.
.new
Construct an immutable, validated value with keyword arguments. Required keywords: rows, caption.
def self.new: (rows: Array[Array[DataTableCell]], caption: String, ?page_size: (Integer)?, ?row_header_column_index: (Integer)?, ?block_id: (String)?, ?additional_fields: Hash[String | Symbol, untyped]?) -> DataTableBlock
| Parameter | Description |
|---|---|
rows | Adds complete table rows in display order. Every row must have the same number of cells. |
caption | Sets the caption that describes the table's contents. |
page_size | Sets how many rows Slack shows per page. |
row_header_column_index | Sets the zero-based index of the column whose cells act as row headers. |
block_id | 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. |
additional_fields | JSON-compatible extension fields that do not replace modeled wire keys. |
Returns: DataTableBlock
| Throws | When |
|---|---|
ValidationError | A field or cross-field Slack rule fails. |
Related types: DataTableBlock, DataTableCell
.[]
Keyword-only alias for .new.
def self.[]: (rows: Array[Array[DataTableCell]], caption: String, ?page_size: (Integer)?, ?row_header_column_index: (Integer)?, ?block_id: (String)?, ?additional_fields: Hash[String | Symbol, untyped]?) -> DataTableBlock
Returns: DataTableBlock
Related types: DataTableBlock, DataTableCell
rows
Adds complete table rows in display order. Every row must have the same number of cells. Wire key: rows.
def rows: () -> Array[Array[DataTableCell]]
Returns: Array[Array[DataTableCell]]
Related types: DataTableCell
caption
Sets the caption that describes the table's contents. Wire key: caption.
def caption: () -> String
Returns: String
page_size
Sets how many rows Slack shows per page. Wire key: page_size.
def page_size: () -> (Integer)?
Returns: (Integer)?
row_header_column_index
Sets the zero-based index of the column whose cells act as row headers. Wire key: row_header_column_index.
def row_header_column_index: () -> (Integer)?
Returns: (Integer)?
block_id
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. Wire key: block_id.
def block_id: () -> (String)?
Returns: (String)?
additional_fields
Return frozen extension fields with normalized string keys.
def additional_fields: () -> Hash[String, untyped]
with
Return a newly validated value with changed keywords.
def with: (**untyped changes) -> DataTableBlock
Returns: DataTableBlock
Related types: DataTableBlock
to_h
Return structural Ruby members, including additional_fields. Nested members remain frozen.
def to_h: () -> Hash[Symbol, untyped]
as_json
Return a fresh, detached Slack wire Hash.
def as_json: (?untyped options) -> Hash[String, untyped]
to_json
Encode the Slack wire payload as JSON.
def to_json: (?untyped options) -> String
DataTableCell
A value that can appear as a data table cell: raw text, a raw number, or a rich text block.
DataVisualizationBlock
A titled pie, bar, area, or line chart.
See the Slack reference.
.new
Construct an immutable, validated value with keyword arguments. Required keywords: title, chart.
def self.new: (title: String, chart: Chart, ?block_id: (String)?, ?additional_fields: Hash[String | Symbol, untyped]?) -> DataVisualizationBlock
| Parameter | Description |
|---|---|
title | Sets the chart title. |
chart | Sets the chart to display. |
block_id | 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. |
additional_fields | JSON-compatible extension fields that do not replace modeled wire keys. |
Returns: DataVisualizationBlock
| Throws | When |
|---|---|
ValidationError | A field or cross-field Slack rule fails. |
Related types: Chart, DataVisualizationBlock
.[]
Keyword-only alias for .new.
def self.[]: (title: String, chart: Chart, ?block_id: (String)?, ?additional_fields: Hash[String | Symbol, untyped]?) -> DataVisualizationBlock
Returns: DataVisualizationBlock
Related types: Chart, DataVisualizationBlock
title
Sets the chart title. Wire key: title.
def title: () -> String
Returns: String
chart
Sets the chart to display. Wire key: chart.
def chart: () -> Chart
Returns: Chart
Related types: Chart
block_id
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. Wire key: block_id.
def block_id: () -> (String)?
Returns: (String)?
additional_fields
Return frozen extension fields with normalized string keys.
def additional_fields: () -> Hash[String, untyped]
with
Return a newly validated value with changed keywords.
def with: (**untyped changes) -> DataVisualizationBlock
Returns: DataVisualizationBlock
Related types: DataVisualizationBlock
to_h
Return structural Ruby members, including additional_fields. Nested members remain frozen.
def to_h: () -> Hash[Symbol, untyped]
as_json
Return a fresh, detached Slack wire Hash.
def as_json: (?untyped options) -> Hash[String, untyped]
to_json
Encode the Slack wire payload as JSON.
def to_json: (?untyped options) -> String
DividerBlock
A horizontal rule that separates blocks.
See the Slack reference.
.new
Construct an immutable, validated value with keyword arguments.
def self.new: (?block_id: (String)?, ?additional_fields: Hash[String | Symbol, untyped]?) -> DividerBlock
| Parameter | Description |
|---|---|
block_id | 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. |
additional_fields | JSON-compatible extension fields that do not replace modeled wire keys. |
Returns: DividerBlock
| Throws | When |
|---|---|
ValidationError | A field or cross-field Slack rule fails. |
Related types: DividerBlock
.[]
Keyword-only alias for .new.
def self.[]: (?block_id: (String)?, ?additional_fields: Hash[String | Symbol, untyped]?) -> DividerBlock
Returns: DividerBlock
Related types: DividerBlock
block_id
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. Wire key: block_id.
def block_id: () -> (String)?
Returns: (String)?
additional_fields
Return frozen extension fields with normalized string keys.
def additional_fields: () -> Hash[String, untyped]
with
Return a newly validated value with changed keywords.
def with: (**untyped changes) -> DividerBlock
Returns: DividerBlock
Related types: DividerBlock
to_h
Return structural Ruby members, including additional_fields. Nested members remain frozen.
def to_h: () -> Hash[Symbol, untyped]
as_json
Return a fresh, detached Slack wire Hash.
def as_json: (?untyped options) -> Hash[String, untyped]
to_json
Encode the Slack wire payload as JSON.
def to_json: (?untyped options) -> String
FileBlock
A remote file previously added with the files.remote API.
See the Slack reference.
.new
Construct an immutable, validated value with keyword arguments. Required keywords: external_id.
def self.new: (external_id: String, ?source: (String)?, ?block_id: (String)?, ?additional_fields: Hash[String | Symbol, untyped]?) -> FileBlock
| Parameter | Description |
|---|---|
external_id | Sets the external identifier of a remote file previously added with the files.remote API. |
source | Sets the file source. Slack currently supports only remote files. |
block_id | 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. |
additional_fields | JSON-compatible extension fields that do not replace modeled wire keys. |
Returns: FileBlock
| Throws | When |
|---|---|
ValidationError | A field or cross-field Slack rule fails. |
Related types: FileBlock
.[]
Keyword-only alias for .new.
def self.[]: (external_id: String, ?source: (String)?, ?block_id: (String)?, ?additional_fields: Hash[String | Symbol, untyped]?) -> FileBlock
Returns: FileBlock
Related types: FileBlock
external_id
Sets the external identifier of a remote file previously added with the files.remote API. Wire key: external_id.
def external_id: () -> String
Returns: String
source
Sets the file source. Slack currently supports only remote files. Wire key: source.
def source: () -> (String)?
Returns: (String)?
block_id
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. Wire key: block_id.
def block_id: () -> (String)?
Returns: (String)?
additional_fields
Return frozen extension fields with normalized string keys.
def additional_fields: () -> Hash[String, untyped]
with
Return a newly validated value with changed keywords.
def with: (**untyped changes) -> FileBlock
Returns: FileBlock
Related types: FileBlock
to_h
Return structural Ruby members, including additional_fields. Nested members remain frozen.
def to_h: () -> Hash[Symbol, untyped]
as_json
Return a fresh, detached Slack wire Hash.
def as_json: (?untyped options) -> Hash[String, untyped]
to_json
Encode the Slack wire payload as JSON.
def to_json: (?untyped options) -> String
HeaderBlock
Large, bold plain text that introduces a group of blocks.
See the Slack reference.
.new
Construct an immutable, validated value with keyword arguments. Required keywords: text.
def self.new: (text: String | PlainText, ?block_id: (String)?, ?additional_fields: Hash[String | Symbol, untyped]?) -> HeaderBlock
| Parameter | Description |
|---|---|
text | Sets the header text, shown in a larger bold font. |
block_id | 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. |
additional_fields | JSON-compatible extension fields that do not replace modeled wire keys. |
Returns: HeaderBlock
| Throws | When |
|---|---|
ValidationError | A field or cross-field Slack rule fails. |
Related types: HeaderBlock, PlainText
.[]
Keyword-only alias for .new.
def self.[]: (text: String | PlainText, ?block_id: (String)?, ?additional_fields: Hash[String | Symbol, untyped]?) -> HeaderBlock
Returns: HeaderBlock
Related types: HeaderBlock, PlainText
text
Sets the header text, shown in a larger bold font. Wire key: text.
def text: () -> PlainText
Returns: PlainText
Related types: PlainText
block_id
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. Wire key: block_id.
def block_id: () -> (String)?
Returns: (String)?
additional_fields
Return frozen extension fields with normalized string keys.
def additional_fields: () -> Hash[String, untyped]
with
Return a newly validated value with changed keywords.
def with: (**untyped changes) -> HeaderBlock
Returns: HeaderBlock
Related types: HeaderBlock
to_h
Return structural Ruby members, including additional_fields. Nested members remain frozen.
def to_h: () -> Hash[Symbol, untyped]
as_json
Return a fresh, detached Slack wire Hash.
def as_json: (?untyped options) -> Hash[String, untyped]
to_json
Encode the Slack wire payload as JSON.
def to_json: (?untyped options) -> String
ImageBlock
A standalone image with alternative text and an optional title.
See the Slack reference.
.new
Construct an immutable, validated value with keyword arguments. Required keywords: alt_text.
def self.new: (?image_url: (String)?, ?slack_file: (SlackFile)?, alt_text: String, ?title: (String | PlainText)?, ?block_id: (String)?, ?additional_fields: Hash[String | Symbol, untyped]?) -> ImageBlock
| Parameter | Description |
|---|---|
image_url | Sets the publicly accessible URL of the image. Cannot be combined with a Slack file. |
slack_file | Sets a file hosted in Slack as the image source. Cannot be combined with an image URL. |
alt_text | Sets a plain-text summary of the image or video for assistive technology. |
title | Sets the title shown above the image. |
block_id | 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. |
additional_fields | JSON-compatible extension fields that do not replace modeled wire keys. |
Returns: ImageBlock
| Throws | When |
|---|---|
ValidationError | A field or cross-field Slack rule fails. |
Related types: ImageBlock, PlainText, SlackFile
.[]
Keyword-only alias for .new.
def self.[]: (?image_url: (String)?, ?slack_file: (SlackFile)?, alt_text: String, ?title: (String | PlainText)?, ?block_id: (String)?, ?additional_fields: Hash[String | Symbol, untyped]?) -> ImageBlock
Returns: ImageBlock
Related types: ImageBlock, PlainText, SlackFile
image_url
Sets the publicly accessible URL of the image. Cannot be combined with a Slack file. Wire key: image_url.
def image_url: () -> (String)?
Returns: (String)?
slack_file
Sets a file hosted in Slack as the image source. Cannot be combined with an image URL. Wire key: slack_file.
def slack_file: () -> (SlackFile)?
Returns: (SlackFile)?
Related types: SlackFile
alt_text
Sets a plain-text summary of the image or video for assistive technology. Wire key: alt_text.
def alt_text: () -> String
Returns: String
title
Sets the title shown above the image. Wire key: title.
def title: () -> (PlainText)?
Returns: (PlainText)?
Related types: PlainText
block_id
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. Wire key: block_id.
def block_id: () -> (String)?
Returns: (String)?
additional_fields
Return frozen extension fields with normalized string keys.
def additional_fields: () -> Hash[String, untyped]
with
Return a newly validated value with changed keywords.
def with: (**untyped changes) -> ImageBlock
Returns: ImageBlock
Related types: ImageBlock
to_h
Return structural Ruby members, including additional_fields. Nested members remain frozen.
def to_h: () -> Hash[Symbol, untyped]
as_json
Return a fresh, detached Slack wire Hash.
def as_json: (?untyped options) -> Hash[String, untyped]
to_json
Encode the Slack wire payload as JSON.
def to_json: (?untyped options) -> String
InputBlock
A labelled input that collects a value in a modal, App Home, or message.
See the Slack reference.
.new
Construct an immutable, validated value with keyword arguments. Required keywords: label, element.
def self.new: (label: String | PlainText, element: InputElement, ?dispatch_action: (bool)?, ?block_id: (String)?, ?hint: (String | PlainText)?, ?optional: (bool)?, ?additional_fields: Hash[String | Symbol, untyped]?) -> InputBlock
| Parameter | Description |
|---|---|
label | Sets the label shown above the input. |
element | Sets the input element that collects the user's value. |
dispatch_action | Sets whether changing the element sends a block_actions payload immediately. |
block_id | 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. |
hint | Sets helper text shown below the input. |
optional | Sets whether the modal can be submitted when this input is empty. |
additional_fields | JSON-compatible extension fields that do not replace modeled wire keys. |
Returns: InputBlock
| Throws | When |
|---|---|
ValidationError | A field or cross-field Slack rule fails. |
Related types: InputBlock, InputElement, PlainText
.[]
Keyword-only alias for .new.
def self.[]: (label: String | PlainText, element: InputElement, ?dispatch_action: (bool)?, ?block_id: (String)?, ?hint: (String | PlainText)?, ?optional: (bool)?, ?additional_fields: Hash[String | Symbol, untyped]?) -> InputBlock
Returns: InputBlock
Related types: InputBlock, InputElement, PlainText
label
Sets the label shown above the input. Wire key: label.
def label: () -> PlainText
Returns: PlainText
Related types: PlainText
element
Sets the input element that collects the user's value. Wire key: element.
def element: () -> InputElement
Returns: InputElement
Related types: InputElement
dispatch_action
Sets whether changing the element sends a block_actions payload immediately. Wire key: dispatch_action.
def dispatch_action: () -> (bool)?
Returns: (bool)?
block_id
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. Wire key: block_id.
def block_id: () -> (String)?
Returns: (String)?
hint
Sets helper text shown below the input. Wire key: hint.
def hint: () -> (PlainText)?
Returns: (PlainText)?
Related types: PlainText
optional
Sets whether the modal can be submitted when this input is empty. Wire key: optional.
def optional: () -> (bool)?
Returns: (bool)?
additional_fields
Return frozen extension fields with normalized string keys.
def additional_fields: () -> Hash[String, untyped]
with
Return a newly validated value with changed keywords.
def with: (**untyped changes) -> InputBlock
Returns: InputBlock
Related types: InputBlock
to_h
Return structural Ruby members, including additional_fields. Nested members remain frozen.
def to_h: () -> Hash[Symbol, untyped]
as_json
Return a fresh, detached Slack wire Hash.
def as_json: (?untyped options) -> Hash[String, untyped]
to_json
Encode the Slack wire payload as JSON.
def to_json: (?untyped options) -> String
LayoutAlignment
Direction-aware alignment within a layout item. Omit for fill behavior. Pass the wire symbol to constructor keywords.
| Constant | Slack value | Meaning |
|---|---|---|
START | :start | Align to the leading edge. |
CENTER | :center | Center the content. |
END | :end | Align to the trailing edge. |
LayoutBlock
A visual grid of one to five rows on messages, modals, and App Home. Supply fallback content for older clients.
See the Slack reference.
.new
Construct an immutable, validated value with keyword arguments. Required keywords: label, rows.
def self.new: (label: String, rows: Array[LayoutRow], ?is_label_visible: (bool)?, ?grid_lines: (:none | :rows | :outer)?, ?fallback: (Array[LayoutFallback])?, ?block_id: (String)?, ?additional_fields: Hash[String | Symbol, untyped]?) -> LayoutBlock
| Parameter | Description |
|---|---|
label | Describes the layout. A visible label is bold text, not a semantic heading. |
rows | Adds one to five rows in source and reading order. |
is_label_visible | Shows the label above the grid. Slack defaults to false; hidden labels are not exposed to screen readers. |
grid_lines | Sets outer borders and horizontal row dividers. Slack defaults to none; there are no vertical dividers. |
fallback | Adds stable blocks rendered in place of the layout on older clients. Omission is allowed; Slack normalizes it to an empty array and does not synthesize content. |
block_id | 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. |
additional_fields | JSON-compatible extension fields that do not replace modeled wire keys. |
Returns: LayoutBlock
| Throws | When |
|---|---|
ValidationError | A field or cross-field Slack rule fails. |
Related types: LayoutBlock, LayoutFallback, LayoutRow
.[]
Keyword-only alias for .new.
def self.[]: (label: String, rows: Array[LayoutRow], ?is_label_visible: (bool)?, ?grid_lines: (:none | :rows | :outer)?, ?fallback: (Array[LayoutFallback])?, ?block_id: (String)?, ?additional_fields: Hash[String | Symbol, untyped]?) -> LayoutBlock
Returns: LayoutBlock
Related types: LayoutBlock, LayoutFallback, LayoutRow
label
Describes the layout. A visible label is bold text, not a semantic heading. Wire key: label.
def label: () -> String
Returns: String
rows
Adds one to five rows in source and reading order. Wire key: rows.
def rows: () -> Array[LayoutRow]
Returns: Array[LayoutRow]
Related types: LayoutRow
is_label_visible
Shows the label above the grid. Slack defaults to false; hidden labels are not exposed to screen readers. Wire key: is_label_visible.
def is_label_visible: () -> (bool)?
Returns: (bool)?
grid_lines
Sets outer borders and horizontal row dividers. Slack defaults to none; there are no vertical dividers. Wire key: grid_lines.
def grid_lines: () -> (:none | :rows | :outer)?
Returns: (:none | :rows | :outer)?
fallback
Adds stable blocks rendered in place of the layout on older clients. Omission is allowed; Slack normalizes it to an empty array and does not synthesize content. Wire key: fallback.
def fallback: () -> (Array[LayoutFallback])?
Returns: (Array[LayoutFallback])?
Related types: LayoutFallback
block_id
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. Wire key: block_id.
def block_id: () -> (String)?
Returns: (String)?
additional_fields
Return frozen extension fields with normalized string keys.
def additional_fields: () -> Hash[String, untyped]
with
Return a newly validated value with changed keywords.
def with: (**untyped changes) -> LayoutBlock
Returns: LayoutBlock
Related types: LayoutBlock
to_h
Return structural Ruby members, including additional_fields. Nested members remain frozen.
def to_h: () -> Hash[Symbol, untyped]
as_json
Return a fresh, detached Slack wire Hash.
def as_json: (?untyped options) -> Hash[String, untyped]
to_json
Encode the Slack wire payload as JSON.
def to_json: (?untyped options) -> String
LayoutChild
A block that can occupy a layout item; it must also be valid on the enclosing surface.
LayoutFallback
A stable block that older clients render in place of a layout.
LayoutGridLines
Layout borders: none, outer border with horizontal row dividers, or outer border only. Pass the wire symbol to constructor keywords.
| Constant | Slack value | Meaning |
|---|---|---|
NONE | :none | No borders (the default). |
ROWS | :rows | Outer border and horizontal row dividers. |
OUTER | :outer | Outer border only. |
LayoutWidth
Relative layout item weights: narrow is 1, standard is 2, and wide is 3. Pass the wire symbol to constructor keywords.
| Constant | Slack value | Meaning |
|---|---|---|
NARROW | :narrow | Weight 1. |
STANDARD | :standard | Weight 2 (the default). |
WIDE | :wide | Weight 3. |
MarkdownBlock
Standard markdown rendered by Slack, intended for AI-generated content.
See the Slack reference.
.new
Construct an immutable, validated value with keyword arguments. Required keywords: text.
def self.new: (text: String, ?block_id: (String)?, ?additional_fields: Hash[String | Symbol, untyped]?) -> MarkdownBlock
| Parameter | Description |
|---|---|
text | Sets standard markdown content, which Slack renders directly. |
block_id | 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. |
additional_fields | JSON-compatible extension fields that do not replace modeled wire keys. |
Returns: MarkdownBlock
| Throws | When |
|---|---|
ValidationError | A field or cross-field Slack rule fails. |
Related types: MarkdownBlock
.[]
Keyword-only alias for .new.
def self.[]: (text: String, ?block_id: (String)?, ?additional_fields: Hash[String | Symbol, untyped]?) -> MarkdownBlock
Returns: MarkdownBlock
Related types: MarkdownBlock
text
Sets standard markdown content, which Slack renders directly. Wire key: text.
def text: () -> String
Returns: String
block_id
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. Wire key: block_id.
def block_id: () -> (String)?
Returns: (String)?
additional_fields
Return frozen extension fields with normalized string keys.
def additional_fields: () -> Hash[String, untyped]
with
Return a newly validated value with changed keywords.
def with: (**untyped changes) -> MarkdownBlock
Returns: MarkdownBlock
Related types: MarkdownBlock
to_h
Return structural Ruby members, including additional_fields. Nested members remain frozen.
def to_h: () -> Hash[Symbol, untyped]
as_json
Return a fresh, detached Slack wire Hash.
def as_json: (?untyped options) -> Hash[String, untyped]
to_json
Encode the Slack wire payload as JSON.
def to_json: (?untyped options) -> String
PlanBlock
A titled sequence of task cards.
See the Slack reference.
.new
Construct an immutable, validated value with keyword arguments. Required keywords: title, tasks.
def self.new: (title: String, tasks: Array[TaskCardBlock], ?block_id: (String)?, ?additional_fields: Hash[String | Symbol, untyped]?) -> PlanBlock
| Parameter | Description |
|---|---|
title | Sets the plan title. |
tasks | Adds task cards in display order. |
block_id | 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. |
additional_fields | JSON-compatible extension fields that do not replace modeled wire keys. |
Returns: PlanBlock
| Throws | When |
|---|---|
ValidationError | A field or cross-field Slack rule fails. |
Related types: PlanBlock, TaskCardBlock
.[]
Keyword-only alias for .new.
def self.[]: (title: String, tasks: Array[TaskCardBlock], ?block_id: (String)?, ?additional_fields: Hash[String | Symbol, untyped]?) -> PlanBlock
Returns: PlanBlock
Related types: PlanBlock, TaskCardBlock
title
Sets the plan title. Wire key: title.
def title: () -> String
Returns: String
tasks
Adds task cards in display order. Wire key: tasks.
def tasks: () -> Array[TaskCardBlock]
Returns: Array[TaskCardBlock]
Related types: TaskCardBlock
block_id
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. Wire key: block_id.
def block_id: () -> (String)?
Returns: (String)?
additional_fields
Return frozen extension fields with normalized string keys.
def additional_fields: () -> Hash[String, untyped]
with
Return a newly validated value with changed keywords.
def with: (**untyped changes) -> PlanBlock
Returns: PlanBlock
Related types: PlanBlock
to_h
Return structural Ruby members, including additional_fields. Nested members remain frozen.
def to_h: () -> Hash[Symbol, untyped]
as_json
Return a fresh, detached Slack wire Hash.
def as_json: (?untyped options) -> Hash[String, untyped]
to_json
Encode the Slack wire payload as JSON.
def to_json: (?untyped options) -> String
RichTextBlock
Formatted text built from sections, lists, preformatted blocks, and quotes.
See the Slack reference.
.new
Construct an immutable, validated value with keyword arguments. Required keywords: elements.
def self.new: (elements: Array[RichTextBlockElement], ?block_id: (String)?, ?additional_fields: Hash[String | Symbol, untyped]?) -> RichTextBlock
| Parameter | Description |
|---|---|
elements | Adds sections, lists, preformatted blocks, and quotes in display order. |
block_id | 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. |
additional_fields | JSON-compatible extension fields that do not replace modeled wire keys. |
Returns: RichTextBlock
| Throws | When |
|---|---|
ValidationError | A field or cross-field Slack rule fails. |
Related types: RichTextBlock, RichTextBlockElement
.[]
Keyword-only alias for .new.
def self.[]: (elements: Array[RichTextBlockElement], ?block_id: (String)?, ?additional_fields: Hash[String | Symbol, untyped]?) -> RichTextBlock
Returns: RichTextBlock
Related types: RichTextBlock, RichTextBlockElement
elements
Adds sections, lists, preformatted blocks, and quotes in display order. Wire key: elements.
def elements: () -> Array[RichTextBlockElement]
Returns: Array[RichTextBlockElement]
Related types: RichTextBlockElement
block_id
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. Wire key: block_id.
def block_id: () -> (String)?
Returns: (String)?
additional_fields
Return frozen extension fields with normalized string keys.
def additional_fields: () -> Hash[String, untyped]
with
Return a newly validated value with changed keywords.
def with: (**untyped changes) -> RichTextBlock
Returns: RichTextBlock
Related types: RichTextBlock
to_h
Return structural Ruby members, including additional_fields. Nested members remain frozen.
def to_h: () -> Hash[Symbol, untyped]
as_json
Return a fresh, detached Slack wire Hash.
def as_json: (?untyped options) -> Hash[String, untyped]
to_json
Encode the Slack wire payload as JSON.
def to_json: (?untyped options) -> String
SectionBlock
Text, a grid of fields, or both, with an optional accessory element.
See the Slack reference.
.new
Construct an immutable, validated value with keyword arguments.
def self.new: (?text: (String | Text)?, ?fields: (Array[String | Text])?, ?accessory: (Element)?, ?block_id: (String)?, ?additional_fields: Hash[String | Symbol, untyped]?) -> SectionBlock
| Parameter | Description |
|---|---|
text | Sets the main text of the section. |
fields | Adds section fields, shown in a two-column grid, in display order. |
accessory | Sets the element displayed beside the section text. |
block_id | 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. |
additional_fields | JSON-compatible extension fields that do not replace modeled wire keys. |
Returns: SectionBlock
| Throws | When |
|---|---|
ValidationError | A field or cross-field Slack rule fails. |
Related types: Element, SectionBlock, Text
.[]
Keyword-only alias for .new.
def self.[]: (?text: (String | Text)?, ?fields: (Array[String | Text])?, ?accessory: (Element)?, ?block_id: (String)?, ?additional_fields: Hash[String | Symbol, untyped]?) -> SectionBlock
Returns: SectionBlock
Related types: Element, SectionBlock, Text
text
Sets the main text of the section. Wire key: text.
def text: () -> (Text)?
Returns: (Text)?
Related types: Text
fields
Adds section fields, shown in a two-column grid, in display order. Wire key: fields.
def fields: () -> (Array[Text])?
Returns: (Array[Text])?
Related types: Text
accessory
Sets the element displayed beside the section text. Wire key: accessory.
def accessory: () -> (Element)?
Returns: (Element)?
Related types: Element
block_id
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. Wire key: block_id.
def block_id: () -> (String)?
Returns: (String)?
additional_fields
Return frozen extension fields with normalized string keys.
def additional_fields: () -> Hash[String, untyped]
with
Return a newly validated value with changed keywords.
def with: (**untyped changes) -> SectionBlock
Returns: SectionBlock
Related types: SectionBlock
to_h
Return structural Ruby members, including additional_fields. Nested members remain frozen.
def to_h: () -> Hash[Symbol, untyped]
as_json
Return a fresh, detached Slack wire Hash.
def as_json: (?untyped options) -> Hash[String, untyped]
to_json
Encode the Slack wire payload as JSON.
def to_json: (?untyped options) -> String
TableBlock
A simple table of raw text and rich text cells.
See the Slack reference.
.new
Construct an immutable, validated value with keyword arguments. Required keywords: rows.
def self.new: (rows: Array[Array[TableCell]], ?column_settings: (Array[ColumnSettings])?, ?block_id: (String)?, ?additional_fields: Hash[String | Symbol, untyped]?) -> TableBlock
| Parameter | Description |
|---|---|
rows | Adds complete table rows in display order. |
column_settings | Adds per-column settings in column order. Provide one entry for every column. |
block_id | 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. |
additional_fields | JSON-compatible extension fields that do not replace modeled wire keys. |
Returns: TableBlock
| Throws | When |
|---|---|
ValidationError | A field or cross-field Slack rule fails. |
Related types: ColumnSettings, TableBlock, TableCell
.[]
Keyword-only alias for .new.
def self.[]: (rows: Array[Array[TableCell]], ?column_settings: (Array[ColumnSettings])?, ?block_id: (String)?, ?additional_fields: Hash[String | Symbol, untyped]?) -> TableBlock
Returns: TableBlock
Related types: ColumnSettings, TableBlock, TableCell
rows
Adds complete table rows in display order. Wire key: rows.
def rows: () -> Array[Array[TableCell]]
Returns: Array[Array[TableCell]]
Related types: TableCell
column_settings
Adds per-column settings in column order. Provide one entry for every column. Wire key: column_settings.
def column_settings: () -> (Array[ColumnSettings])?
Returns: (Array[ColumnSettings])?
Related types: ColumnSettings
block_id
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. Wire key: block_id.
def block_id: () -> (String)?
Returns: (String)?
additional_fields
Return frozen extension fields with normalized string keys.
def additional_fields: () -> Hash[String, untyped]
with
Return a newly validated value with changed keywords.
def with: (**untyped changes) -> TableBlock
Returns: TableBlock
Related types: TableBlock
to_h
Return structural Ruby members, including additional_fields. Nested members remain frozen.
def to_h: () -> Hash[Symbol, untyped]
as_json
Return a fresh, detached Slack wire Hash.
def as_json: (?untyped options) -> Hash[String, untyped]
to_json
Encode the Slack wire payload as JSON.
def to_json: (?untyped options) -> String
TableCell
A value that can appear as a table block cell: raw text or a rich text block.
TaskCardBlock
One task with its status, details, output, and sources.
See the Slack reference.
.new
Construct an immutable, validated value with keyword arguments. Required keywords: task_id, title, status.
def self.new: (task_id: String, title: String, ?details: (RichTextBlock)?, ?output: (RichTextBlock)?, ?sources: (Array[UrlSource])?, status: :pending | :in_progress | :complete | :error, ?block_id: (String)?, ?additional_fields: Hash[String | Symbol, untyped]?) -> TaskCardBlock
| Parameter | Description |
|---|---|
task_id | Sets the identifier of the task. |
title | Sets the task title. |
details | Sets a rich text description of the task. |
output | Sets rich text describing the task's output. |
sources | Adds links to the sources the task used, in display order. |
status | Sets the task's current state. |
block_id | 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. |
additional_fields | JSON-compatible extension fields that do not replace modeled wire keys. |
Returns: TaskCardBlock
| Throws | When |
|---|---|
ValidationError | A field or cross-field Slack rule fails. |
Related types: RichTextBlock, TaskCardBlock, UrlSource
.[]
Keyword-only alias for .new.
def self.[]: (task_id: String, title: String, ?details: (RichTextBlock)?, ?output: (RichTextBlock)?, ?sources: (Array[UrlSource])?, status: :pending | :in_progress | :complete | :error, ?block_id: (String)?, ?additional_fields: Hash[String | Symbol, untyped]?) -> TaskCardBlock
Returns: TaskCardBlock
Related types: RichTextBlock, TaskCardBlock, UrlSource
task_id
Sets the identifier of the task. Wire key: task_id.
def task_id: () -> String
Returns: String
title
Sets the task title. Wire key: title.
def title: () -> String
Returns: String
details
Sets a rich text description of the task. Wire key: details.
def details: () -> (RichTextBlock)?
Returns: (RichTextBlock)?
Related types: RichTextBlock
output
Sets rich text describing the task's output. Wire key: output.
def output: () -> (RichTextBlock)?
Returns: (RichTextBlock)?
Related types: RichTextBlock
sources
Adds links to the sources the task used, in display order. Wire key: sources.
def sources: () -> (Array[UrlSource])?
Returns: (Array[UrlSource])?
Related types: UrlSource
status
Sets the task's current state. Wire key: status.
def status: () -> :pending | :in_progress | :complete | :error
Returns: :pending | :in_progress | :complete | :error
block_id
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. Wire key: block_id.
def block_id: () -> (String)?
Returns: (String)?
additional_fields
Return frozen extension fields with normalized string keys.
def additional_fields: () -> Hash[String, untyped]
with
Return a newly validated value with changed keywords.
def with: (**untyped changes) -> TaskCardBlock
Returns: TaskCardBlock
Related types: TaskCardBlock
to_h
Return structural Ruby members, including additional_fields. Nested members remain frozen.
def to_h: () -> Hash[Symbol, untyped]
as_json
Return a fresh, detached Slack wire Hash.
def as_json: (?untyped options) -> Hash[String, untyped]
to_json
Encode the Slack wire payload as JSON.
def to_json: (?untyped options) -> String
TaskStatus
States supported by task card blocks. Pass the wire symbol to constructor keywords.
| 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. |
VideoBlock
An embedded video player.
See the Slack reference.
.new
Construct an immutable, validated value with keyword arguments. Required keywords: alt_text, thumbnail_url, title, video_url.
def self.new: (alt_text: String, thumbnail_url: String, title: String | PlainText, video_url: String, ?block_id: (String)?, ?author_name: (String)?, ?description: (String | PlainText)?, ?provider_icon_url: (String)?, ?provider_name: (String)?, ?title_url: (String)?, ?additional_fields: Hash[String | Symbol, untyped]?) -> VideoBlock
| Parameter | Description |
|---|---|
alt_text | Sets a plain-text summary of the image or video for assistive technology. |
thumbnail_url | Sets the URL of the image shown before the video plays. |
title | Sets the video title. |
video_url | Sets the embeddable URL of the video. The domain must be listed in the app's unfurl domains. |
block_id | 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. |
author_name | Sets the name of the video's author. |
description | Sets the video description. |
provider_icon_url | Sets the URL of the video provider's icon. |
provider_name | Sets the name of the video provider, such as YouTube. |
title_url | Sets the HTTPS URL opened when the title is clicked. |
additional_fields | JSON-compatible extension fields that do not replace modeled wire keys. |
Returns: VideoBlock
| Throws | When |
|---|---|
ValidationError | A field or cross-field Slack rule fails. |
Related types: PlainText, VideoBlock
.[]
Keyword-only alias for .new.
def self.[]: (alt_text: String, thumbnail_url: String, title: String | PlainText, video_url: String, ?block_id: (String)?, ?author_name: (String)?, ?description: (String | PlainText)?, ?provider_icon_url: (String)?, ?provider_name: (String)?, ?title_url: (String)?, ?additional_fields: Hash[String | Symbol, untyped]?) -> VideoBlock
Returns: VideoBlock
Related types: PlainText, VideoBlock
alt_text
Sets a plain-text summary of the image or video for assistive technology. Wire key: alt_text.
def alt_text: () -> String
Returns: String
thumbnail_url
Sets the URL of the image shown before the video plays. Wire key: thumbnail_url.
def thumbnail_url: () -> String
Returns: String
title
Sets the video title. Wire key: title.
def title: () -> PlainText
Returns: PlainText
Related types: PlainText
video_url
Sets the embeddable URL of the video. The domain must be listed in the app's unfurl domains. Wire key: video_url.
def video_url: () -> String
Returns: String
block_id
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. Wire key: block_id.
def block_id: () -> (String)?
Returns: (String)?
author_name
Sets the name of the video's author. Wire key: author_name.
def author_name: () -> (String)?
Returns: (String)?
description
Sets the video description. Wire key: description.
def description: () -> (PlainText)?
Returns: (PlainText)?
Related types: PlainText
provider_icon_url
Sets the URL of the video provider's icon. Wire key: provider_icon_url.
def provider_icon_url: () -> (String)?
Returns: (String)?
provider_name
Sets the name of the video provider, such as YouTube. Wire key: provider_name.
def provider_name: () -> (String)?
Returns: (String)?
title_url
Sets the HTTPS URL opened when the title is clicked. Wire key: title_url.
def title_url: () -> (String)?
Returns: (String)?
additional_fields
Return frozen extension fields with normalized string keys.
def additional_fields: () -> Hash[String, untyped]
with
Return a newly validated value with changed keywords.
def with: (**untyped changes) -> VideoBlock
Returns: VideoBlock
Related types: VideoBlock
to_h
Return structural Ruby members, including additional_fields. Nested members remain frozen.
def to_h: () -> Hash[Symbol, untyped]
as_json
Return a fresh, detached Slack wire Hash.
def as_json: (?untyped options) -> Hash[String, untyped]
to_json
Encode the Slack wire payload as JSON.
def to_json: (?untyped options) -> String