Blocks
Block factories for messages, modals, and App Home tabs.
Every factory accepts camelCase input, returns Slack's snake_case wire shape,
and validates the result unless settings.validate is false.
actionsBlock()
actionsBlock(
input,settings?):SlackWire<ActionsBlock>
Creates a row of interactive elements.
Input fields
Up to 25 buttons, select menus, or other action elements.
| Input field | Type | Description |
|---|---|---|
blockId? | string | Deterministic identifier, up to 255 characters. |
elements | JsonObject[] | Interactive elements displayed in the row. |
Settings
| Setting | Type | Description |
|---|---|---|
settings | FactorySettings | Per-call validation settings. |
Returns
SlackWire<ActionsBlock>
A validated Slack actions block.
Throws
InvalidUsageError when an element is unsupported or the limit is exceeded.
alertBlock()
alertBlock(
input,settings?):SlackObject<"alert">
Creates a severity-labelled notice for a modal.
Input fields
Alert content, severity, and optional block identifier.
| Input field | Type | Description |
|---|---|---|
blockId? | string | Deterministic identifier, up to 255 characters. |
level? | AlertLevel | Visual severity. Defaults to default. |
text | TextLike | Alert copy. Strings are converted to mrkdwn text. |
Settings
| Setting | Type | Description |
|---|---|---|
settings | FactorySettings | Per-call validation settings. |
Returns
SlackObject<"alert">
A validated Slack alert block.
Throws
InvalidUsageError when a field violates Slack's constraints.
AlertLevel
AlertLevel =
"default"|"info"|"warning"|"error"|"success"
Severity shown by an alert block.
cardBlock()
cardBlock(
input,settings?):SlackObject<"card">
Creates a compact content card with text, imagery, and optional actions.
Input fields
Card fields. At least one visible content field must be supplied.
| Input field | Type | Description |
|---|---|---|
actions? | JsonObject[] | Up to three button actions. |
blockId? | string | Deterministic identifier, up to 255 characters. |
body? | TextLike | Main card copy, up to 200 characters. |
heroImage? | JsonObject | Large image displayed above the card content. |
icon? | JsonObject | Small image displayed beside the card heading. |
slackIcon? | JsonObject | Slack-hosted icon created with slackIcon. |
subtext? | TextLike | Supporting copy displayed below the body. |
subtitle? | TextLike | Secondary heading, up to 150 characters. |
title? | TextLike | Primary heading, up to 150 characters. |
Settings
| Setting | Type | Description |
|---|---|---|
settings | FactorySettings | Per-call validation settings. |
Returns
SlackObject<"card">
A validated Slack card block.
Throws
InvalidUsageError when content is missing or exceeds Slack's limits.
CardBlockInput
Fields accepted by cardBlock.
Properties
| Property | Type | Description |
|---|---|---|
actions? | JsonObject[] | Up to three button actions. |
blockId? | string | Deterministic identifier, up to 255 characters. |
body? | TextLike | Main card copy, up to 200 characters. |
heroImage? | JsonObject | Large image displayed above the card content. |
icon? | JsonObject | Small image displayed beside the card heading. |
slackIcon? | JsonObject | Slack-hosted icon created with slackIcon. |
subtext? | TextLike | Supporting copy displayed below the body. |
subtitle? | TextLike | Secondary heading, up to 150 characters. |
title? | TextLike | Primary heading, up to 150 characters. |
carouselBlock()
carouselBlock(
input,settings?):SlackObject<"carousel">
Creates a horizontally scrolling collection of cards.
Input fields
One to ten card blocks and an optional block identifier.
| Input field | Type | Description |
|---|---|---|
blockId? | string | Deterministic identifier, up to 255 characters. |
elements | JsonObject[] | Between one and ten objects returned by cardBlock. |
Settings
| Setting | Type | Description |
|---|---|---|
settings | FactorySettings | Per-call validation settings. |
Returns
SlackObject<"carousel">
A validated Slack carousel block.
Throws
InvalidUsageError when the card count is outside Slack's limits.
containerBlock()
containerBlock(
input,settings?):SlackObject<"container">
Creates a titled container that groups related child blocks.
Input fields
Child blocks plus optional heading, width, icon, and collapse behavior.
| Input field | Type | Description |
|---|---|---|
blockId? | string | Deterministic identifier, up to 255 characters. |
childBlocks | JsonObject[] | Up to ten blocks supported by Slack containers. |
defaultCollapsed? | boolean | Whether a collapsible container starts collapsed. |
hasHeaderDivider? | boolean | Whether Slack draws a divider below the header. |
icon? | JsonObject | Optional image displayed in the header. |
isCollapsible? | boolean | Whether readers can expand and collapse the container. |
richTextTitle? | JsonObject | Rich-text title block. Mutually exclusive with title. |
subtitle? | TextLike | Optional supporting copy below the title. |
title? | TextLike | Plain-text title. Mutually exclusive with richTextTitle. |
width? | ContainerWidth | Container width. Defaults to standard. |
Settings
| Setting | Type | Description |
|---|---|---|
settings | FactorySettings | Per-call validation settings. |
Returns
SlackObject<"container">
A validated Slack container block.
Throws
InvalidUsageError when child content or collapse options are invalid.
ContainerWidth
ContainerWidth =
"narrow"|"standard"|"wide"|"full"
Horizontal width used by a container block.
contextActionsBlock()
contextActionsBlock(
input,settings?):SlackObject<"context_actions">
Creates contextual feedback or icon controls.
Input fields
Up to five feedback-buttons or icon-button elements.
| Input field | Type | Description |
|---|---|---|
blockId? | string | Deterministic identifier, up to 255 characters. |
elements | JsonObject[] | Feedback-buttons or icon-button elements. |
Settings
| Setting | Type | Description |
|---|---|---|
settings | FactorySettings | Per-call validation settings. |
Returns
SlackObject<"context_actions">
A validated Slack context_actions block.
Throws
InvalidUsageError when an element is unsupported or the limit is exceeded.
contextBlock()
contextBlock(
input,settings?):SlackWire<ContextBlock>
Creates compact contextual text and images.
Input fields
Up to ten text objects or image elements.
| Input field | Type | Description |
|---|---|---|
blockId? | string | Deterministic identifier, up to 255 characters. |
elements | JsonObject[] | Text objects and image elements. |
Settings
| Setting | Type | Description |
|---|---|---|
settings | FactorySettings | Per-call validation settings. |
Returns
SlackWire<ContextBlock>
A validated Slack context block.
Throws
InvalidUsageError when an element is unsupported or the limit is exceeded.
dataTableBlock()
dataTableBlock(
input,settings?):SlackObject<"data_table">
Creates a sortable data table.
Input fields
Caption, rows, pagination size, and row-header configuration.
| Input field | Type | Description |
|---|---|---|
blockId? | string | Deterministic identifier, up to 255 characters. |
caption | string | Accessible table caption. |
pageSize? | number | Rows per page, between 1 and 100. Defaults to 5. |
rowHeaderColumnIndex? | number | Zero-based column used as the row header. Defaults to 0. |
rows | JsonObject[][] | Two to 201 equally sized rows containing raw text, raw numbers, or rich text. |
Settings
| Setting | Type | Description |
|---|---|---|
settings | FactorySettings | Per-call validation settings. |
Returns
SlackObject<"data_table">
A validated Slack data_table block.
Throws
InvalidUsageError when row dimensions, cells, or pagination are invalid.
dataVisualizationBlock()
dataVisualizationBlock(
input,settings?):SlackObject<"data_visualization">
Creates a chart rendered by Slack.
Input fields
Chart title, chart object, and optional block identifier.
| Input field | Type | Description |
|---|---|---|
blockId? | string | Deterministic identifier, up to 255 characters. |
chart | JsonObject | Object returned by pieChart, barChart, areaChart, or lineChart. |
title | string | Chart heading, up to 50 characters. |
Settings
| Setting | Type | Description |
|---|---|---|
settings | FactorySettings | Per-call validation settings. |
Returns
SlackObject<"data_visualization">
A validated Slack data_visualization block.
Throws
InvalidUsageError when chart data or labels violate Slack's limits.
dividerBlock()
dividerBlock(
input?,settings?):SlackWire<DividerBlock>
Creates a visual divider between blocks.
Input fields
Optional deterministic block identifier.
| Input field | Type | Description |
|---|---|---|
blockId? | string | Deterministic identifier, up to 255 characters. |
Settings
| Setting | Type | Description |
|---|---|---|
settings | FactorySettings | Per-call validation settings. |
Returns
SlackWire<DividerBlock>
A validated Slack divider block.
Throws
InvalidUsageError when the block identifier is too long.
fileBlock()
fileBlock(
input,settings?):SlackWire<FileBlock>
Creates a block that displays a Slack remote file.
Input fields
Remote-file identifier, source, and optional block identifier.
| Input field | Type | Description |
|---|---|---|
blockId? | string | Deterministic identifier, up to 255 characters. |
externalId | string | Identifier assigned when the remote file was added to Slack. |
source? | "remote" | Remote-file source. Slack currently accepts only remote. |
Settings
| Setting | Type | Description |
|---|---|---|
settings | FactorySettings | Per-call validation settings. |
Returns
SlackWire<FileBlock>
A validated Slack file block.
Throws
InvalidUsageError when required file data is missing.
headerBlock()
headerBlock(
input,settings?):SlackWire<HeaderBlock>
Creates a prominent plain-text heading.
Input fields
Heading text and optional block identifier.
| Input field | Type | Description |
|---|---|---|
blockId? | string | Deterministic identifier, up to 255 characters. |
text | TextLike | Heading copy. Strings are converted to plain text. |
Settings
| Setting | Type | Description |
|---|---|---|
settings | FactorySettings | Per-call validation settings. |
Returns
SlackWire<HeaderBlock>
A validated Slack header block.
Throws
InvalidUsageError when the heading exceeds Slack's limit.
imageBlock()
imageBlock(
input,settings?):SlackWire<ImageBlock>
Creates an image block with optional title text.
Input fields
Image URL, accessible alternative, title, and optional block identifier.
| Input field | Type | Description |
|---|---|---|
altText | string | Accessible description of the image. |
blockId? | string | Deterministic identifier, up to 255 characters. |
imageUrl | string | Public URL of the image. |
title? | TextLike | Optional plain-text title. |
Settings
| Setting | Type | Description |
|---|---|---|
settings | FactorySettings | Per-call validation settings. |
Returns
SlackWire<ImageBlock>
A validated Slack image block.
Throws
InvalidUsageError when text or URL fields violate Slack's constraints.
inputBlock()
inputBlock(
input,settings?):SlackWire<InputBlock>
Creates a labelled form control for a modal or App Home tab.
Input fields
Label, input-compatible element, and optional form behavior.
| Input field | Type | Description |
|---|---|---|
blockId? | string | Deterministic identifier, up to 255 characters. |
dispatchAction? | boolean | Whether changes dispatch an interaction immediately. |
element | JsonObject | Input-compatible element such as a text input, picker, or select menu. |
hint? | TextLike | Optional plain-text help shown below the control. |
label | TextLike | Plain-text label displayed above the control. |
optional? | boolean | Whether the user may submit without completing this input. |
Settings
| Setting | Type | Description |
|---|---|---|
settings | FactorySettings | Per-call validation settings. |
Returns
SlackWire<InputBlock>
A validated Slack input block.
Throws
InvalidUsageError when the element is unsupported or text exceeds Slack's limits.
markdownBlock()
markdownBlock(
input,settings?):SlackWire<MarkdownBlock>
Creates a block rendered from GitHub-flavored Markdown.
Input fields
Markdown source and optional block identifier.
| Input field | Type | Description |
|---|---|---|
blockId? | string | Deterministic identifier, up to 255 characters. |
text | string | GitHub-flavored Markdown source. |
Settings
| Setting | Type | Description |
|---|---|---|
settings | FactorySettings | Per-call validation settings. |
Returns
SlackWire<MarkdownBlock>
A validated Slack markdown block.
Throws
InvalidUsageError when the Markdown source violates Slack's limits.
planBlock()
planBlock(
input,settings?):SlackObject<"plan">
Creates a titled sequence of task cards.
Input fields
Plan title, tasks, and optional block identifier.
| Input field | Type | Description |
|---|---|---|
blockId? | string | Deterministic identifier, up to 255 characters. |
tasks? | JsonObject[] | Task-card blocks. Their outer type and block_id fields are omitted in the plan. |
title | string | Human-readable plan title. |
Settings
| Setting | Type | Description |
|---|---|---|
settings | FactorySettings | Per-call validation settings. |
Returns
SlackObject<"plan">
A validated Slack plan block.
Throws
InvalidUsageError when task content violates Slack's constraints.
richTextBlock()
richTextBlock(
input,settings?):SlackWire<RichTextBlock>
Creates a rich-text block from rich-text layout objects.
Input fields
Rich-text sections, lists, quotes, or code blocks.
| Input field | Type | Description |
|---|---|---|
blockId? | string | Deterministic identifier, up to 255 characters. |
elements | JsonObject[] | Rich-text layout objects. |
Settings
| Setting | Type | Description |
|---|---|---|
settings | FactorySettings | Per-call validation settings. |
Returns
SlackWire<RichTextBlock>
A validated Slack rich_text block.
Throws
InvalidUsageError when an element is not a supported rich-text object.
sectionBlock()
sectionBlock(
input,settings?):SlackWire<SectionBlock>
Creates a flexible text block with optional fields or an accessory.
Input fields
Section text, fields, accessory, and optional block identifier.
| Input field | Type | Description |
|---|---|---|
accessory? | JsonObject | Optional interactive or visual element displayed beside the text. |
blockId? | string | Deterministic identifier, up to 255 characters. |
fields? | TextLike[] | Up to ten text fields displayed in columns. |
text? | TextLike | Main copy. Strings are converted to mrkdwn text. |
Settings
| Setting | Type | Description |
|---|---|---|
settings | FactorySettings | Per-call validation settings. |
Returns
SlackWire<SectionBlock>
A validated Slack section block.
Throws
InvalidUsageError when text is missing or a field exceeds Slack's limits.
SectionBlockInput
Fields accepted by sectionBlock.
Properties
| Property | Type | Description |
|---|---|---|
accessory? | JsonObject | Optional interactive or visual element displayed beside the text. |
blockId? | string | Deterministic identifier, up to 255 characters. |
fields? | TextLike[] | Up to ten text fields displayed in columns. |
text? | TextLike | Main copy. Strings are converted to mrkdwn text. |
tableBlock()
tableBlock(
input,settings?):SlackWire<TableBlock>
Creates a table block from raw-text or rich-text cells.
Input fields
Rows, optional column display settings, and optional block identifier.
| Input field | Type | Description |
|---|---|---|
blockId? | string | Deterministic identifier, up to 255 characters. |
columnSettings? | JsonObject[] | Optional display settings for each column. |
rows | JsonObject[][] | Up to 100 equally sized rows of raw-text or rich-text cells. |
Settings
| Setting | Type | Description |
|---|---|---|
settings | FactorySettings | Per-call validation settings. |
Returns
SlackWire<TableBlock>
A validated Slack table block.
Throws
InvalidUsageError when dimensions, cells, or column settings are invalid.
taskCardBlock()
taskCardBlock(
input,settings?):SlackObject<"task_card">
Creates one task card for a plan.
Input fields
Task identity, title, rich content, sources, and optional status.
| Input field | Type | Description |
|---|---|---|
blockId? | string | Deterministic identifier, up to 255 characters. |
details? | JsonObject | Optional rich-text task details. |
output? | JsonObject | Optional rich-text task output. |
sources? | JsonObject[] | Optional source links created with urlSource. |
status? | TaskStatus | Current task lifecycle state. |
taskId | string | Stable task identifier. |
title | string | Human-readable task title. |
Settings
| Setting | Type | Description |
|---|---|---|
settings | FactorySettings | Per-call validation settings. |
Returns
SlackObject<"task_card">
A validated Slack task_card block.
Throws
InvalidUsageError when identifiers, content, or source links are invalid.
TaskStatus
TaskStatus =
"pending"|"in_progress"|"complete"|"error"
Lifecycle state shown by a task card.
videoBlock()
videoBlock(
input,settings?):SlackWire<VideoBlock>
Creates an embedded video block.
Slack, rather than this library, enforces its provider allowlist when the payload is submitted.
Input fields
Video URL, thumbnail, accessible text, title, and optional metadata.
| Input field | Type | Description |
|---|---|---|
altText | string | Accessible summary, up to 200 characters. |
authorName? | string | Optional author name, up to 50 characters. |
blockId? | string | Deterministic identifier, up to 255 characters. |
description? | TextLike | Optional plain-text description, up to 200 characters. |
providerIconUrl? | string | Optional provider icon URL. |
providerName? | string | Optional provider name, up to 50 characters. |
thumbnailUrl | string | Public preview-image URL. |
title | TextLike | Plain-text video title, up to 200 characters. |
titleUrl? | string | Optional destination when the title is selected. |
videoUrl | string | URL of a video hosted by a Slack-supported provider. |
Settings
| Setting | Type | Description |
|---|---|---|
settings | FactorySettings | Per-call validation settings. |
Returns
SlackWire<VideoBlock>
A validated Slack video block.
Throws
InvalidUsageError when a text field violates Slack's constraints.