Blocks
This page documents the public C# API for blocks, generated from the XML documentation of the compiled library. Values are immutable, constructors take named arguments and validate them, and read-only properties return what was passed.
Every block implements IBlock, so blocks of any kind share one collection type, and values serialize as Slack JSON with ToJson() or System.Text.Json.
ActionsBlock
A block that holds interactive elements such as buttons and menus.
- Required:
elements.
See the Slack reference.
Implements IBlock.
ActionsBlock
Creates and validates a ActionsBlock.
public ActionsBlock(IEnumerable<IElement> elements, string? blockId = null, IReadOnlyDictionary<string, object?>? additionalFields = null)
| Parameter | Description |
|---|---|
elements | Interactive elements in display order. Required. Slack allows at most 25 items. |
blockId | 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. |
additionalFields | Slack fields that have no named parameter yet, such as a field Slack introduced after this release. Values must be strings, numbers, booleans, lists, dictionaries, JSON nodes, or slackblocks values, and are validated with the rest of the object. Typed properties do not reflect them, and a field cannot be set both here and through its named parameter. |
| Throws | When |
|---|---|
ValidationException | The value breaks a Block Kit rule, such as a missing required field or an exceeded length limit. |
ArgumentException | A collection contains null, or an additional field cannot be written as JSON or repeats a named parameter. |
Related types: ActionsBlock, IElement
Elements
Gets interactive elements in display order.
The values in order, or an empty list when none were set.
public IReadOnlyList<IElement> Elements { get; }
Related types: IElement
BlockId
Gets 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.
The value, or null when it was not set.
public string? BlockId { get; }
AlertBlock
A severity-labelled alert, available in modals.
- Required:
text.
See the Slack reference.
Implements IBlock.
AlertBlock
Creates and validates a AlertBlock.
public AlertBlock(Text text, AlertLevel? level = null, string? blockId = null, IReadOnlyDictionary<string, object?>? additionalFields = null)
| Parameter | Description |
|---|---|
text | The alert message. Required. Slack allows at most 200 characters. A string is sent as a mrkdwn text object. |
level | The alert severity, which controls its color and icon. |
blockId | 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. |
additionalFields | Slack fields that have no named parameter yet, such as a field Slack introduced after this release. Values must be strings, numbers, booleans, lists, dictionaries, JSON nodes, or slackblocks values, and are validated with the rest of the object. Typed properties do not reflect them, and a field cannot be set both here and through its named parameter. |
| Throws | When |
|---|---|
ValidationException | The value breaks a Block Kit rule, such as a missing required field or an exceeded length limit. |
ArgumentException | A collection contains null, or an additional field cannot be written as JSON or repeats a named parameter. |
Related types: AlertBlock, AlertLevel, Text
Text
Gets the alert message.
public Text Text { get; }
Related types: Text
Level
Gets the alert severity, which controls its color and icon.
The value, or null when it was not set.
public AlertLevel? Level { get; }
Related types: AlertLevel
BlockId
Gets 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.
The value, or null when it was not set.
public string? BlockId { get; }
AlertLevel
Severity levels supported by alert blocks.
ToWireValue() returns the value Slack expects in JSON.
| Constant | Slack value | Meaning |
|---|---|---|
Default | default | Neutral styling. |
Info | info | Informational styling. |
Warning | warning | Warning styling. |
Error | error | Error styling. |
Success | success | Success styling. |
CardBlock
A compact card with an image, text, and up to three buttons.
- 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.
Implements IBlock.
CardBlock
Creates and validates a CardBlock.
public CardBlock(ImageElement? heroImage = null, ImageElement? icon = null, Text? title = null, Text? subtitle = null, Text? body = null, IEnumerable<ButtonElement>? actions = null, SlackIcon? slackIcon = null, Text? subtext = null, string? blockId = null, IReadOnlyDictionary<string, object?>? additionalFields = null)
| Parameter | Description |
|---|---|
heroImage | The image displayed prominently at the top of the card. |
icon | The image displayed beside the title. |
title | The card title. Slack allows at most 150 characters. A string is sent as a mrkdwn text object. |
subtitle | The supporting text shown below the title. Slack allows at most 150 characters. A string is sent as a mrkdwn text object. |
body | The main body text of the card. Slack allows at most 200 characters. A string is sent as a mrkdwn text object. |
actions | Buttons displayed at the bottom of the card, in display order. Slack allows at most 3 items. |
slackIcon | A Slack-provided icon displayed beside the title. Cannot be combined with an image icon. |
subtext | The small print shown at the bottom of the card. Slack allows at most 200 characters. A string is sent as a mrkdwn text object. |
blockId | 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. |
additionalFields | Slack fields that have no named parameter yet, such as a field Slack introduced after this release. Values must be strings, numbers, booleans, lists, dictionaries, JSON nodes, or slackblocks values, and are validated with the rest of the object. Typed properties do not reflect them, and a field cannot be set both here and through its named parameter. |
| Throws | When |
|---|---|
ValidationException | The value breaks a Block Kit rule, such as a missing required field or an exceeded length limit. |
ArgumentException | A collection contains null, or an additional field cannot be written as JSON or repeats a named parameter. |
Related types: ButtonElement, CardBlock, ImageElement, SlackIcon, Text
HeroImage
Gets the image displayed prominently at the top of the card.
The value, or null when it was not set.
public ImageElement? HeroImage { get; }
Related types: ImageElement
Icon
Gets the image displayed beside the title.
The value, or null when it was not set.
public ImageElement? Icon { get; }
Related types: ImageElement
Title
Gets the card title.
The value, or null when it was not set.
public Text? Title { get; }
Related types: Text
Subtitle
Gets the supporting text shown below the title.
The value, or null when it was not set.
public Text? Subtitle { get; }
Related types: Text
Body
Gets the main body text of the card.
The value, or null when it was not set.
public Text? Body { get; }
Related types: Text
Actions
Gets buttons displayed at the bottom of the card, in display order.
The values in order, or an empty list when none were set.
public IReadOnlyList<ButtonElement> Actions { get; }
Related types: ButtonElement
SlackIcon
Gets a Slack-provided icon displayed beside the title. Cannot be combined with an image icon.
The value, or null when it was not set.
public SlackIcon? SlackIcon { get; }
Related types: SlackIcon
Subtext
Gets the small print shown at the bottom of the card.
The value, or null when it was not set.
public Text? Subtext { get; }
Related types: Text
BlockId
Gets 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.
The value, or null when it was not set.
public string? BlockId { get; }
CarouselBlock
A horizontally scrolling set of cards, available in messages and App Home.
- Required:
elements.
See the Slack reference.
Implements IBlock.
CarouselBlock
Creates and validates a CarouselBlock.
public CarouselBlock(IEnumerable<CardBlock> elements, string? blockId = null, IReadOnlyDictionary<string, object?>? additionalFields = null)
| Parameter | Description |
|---|---|
elements | The cards in display order. Required. Must contain between 1 and 10 items. |
blockId | 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. |
additionalFields | Slack fields that have no named parameter yet, such as a field Slack introduced after this release. Values must be strings, numbers, booleans, lists, dictionaries, JSON nodes, or slackblocks values, and are validated with the rest of the object. Typed properties do not reflect them, and a field cannot be set both here and through its named parameter. |
| Throws | When |
|---|---|
ValidationException | The value breaks a Block Kit rule, such as a missing required field or an exceeded length limit. |
ArgumentException | A collection contains null, or an additional field cannot be written as JSON or repeats a named parameter. |
Related types: CardBlock, CarouselBlock
Elements
Gets the cards in display order.
The values in order, or an empty list when none were set.
public IReadOnlyList<CardBlock> Elements { get; }
Related types: CardBlock
BlockId
Gets 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.
The value, or null when it was not set.
public string? BlockId { get; }
ContainerBlock
A titled group of blocks that can optionally collapse.
- Required:
childBlocks. - Provide a title or a rich text title.
See the Slack reference.
Implements IBlock.
ContainerBlock
Creates and validates a ContainerBlock.
public ContainerBlock(IEnumerable<IBlock> childBlocks, PlainText? title = null, RichTextBlock? richTextTitle = null, Text? subtitle = null, ContainerWidth? width = null, ImageElement? icon = null, bool? isCollapsible = null, bool? defaultCollapsed = null, bool? hasHeaderDivider = null, string? blockId = null, IReadOnlyDictionary<string, object?>? additionalFields = null)
| Parameter | Description |
|---|---|
childBlocks | The blocks grouped inside the container, in display order. Required. Slack allows at most 10 items. |
title | The container title. Provide either a title or a rich text title. Slack allows at most 150 characters. A string is sent as a plain_text text object. |
richTextTitle | A rich text block used as the title in place of a plain-text title. |
subtitle | The supporting text shown below the title. Slack allows at most 150 characters. A string is sent as a mrkdwn text object. |
width | The horizontal width of the container. |
icon | The image displayed beside the title. |
isCollapsible | Whether users can collapse and expand the container. |
defaultCollapsed | Whether a collapsible container starts collapsed. Requires the container to be collapsible. |
hasHeaderDivider | Whether Slack draws a divider below the container header. Only valid for non-collapsible containers. |
blockId | 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. |
additionalFields | Slack fields that have no named parameter yet, such as a field Slack introduced after this release. Values must be strings, numbers, booleans, lists, dictionaries, JSON nodes, or slackblocks values, and are validated with the rest of the object. Typed properties do not reflect them, and a field cannot be set both here and through its named parameter. |
| Throws | When |
|---|---|
ValidationException | The value breaks a Block Kit rule, such as a missing required field or an exceeded length limit. |
ArgumentException | A collection contains null, or an additional field cannot be written as JSON or repeats a named parameter. |
Related types: ContainerBlock, ContainerWidth, IBlock, ImageElement, PlainText, RichTextBlock, Text
ChildBlocks
Gets the blocks grouped inside the container, in display order.
The values in order, or an empty list when none were set.
public IReadOnlyList<IBlock> ChildBlocks { get; }
Related types: IBlock
Title
Gets the container title. Provide either a title or a rich text title.
The value, or null when it was not set.
public PlainText? Title { get; }
Related types: PlainText
RichTextTitle
Gets a rich text block used as the title in place of a plain-text title.
The value, or null when it was not set.
public RichTextBlock? RichTextTitle { get; }
Related types: RichTextBlock
Subtitle
Gets the supporting text shown below the title.
The value, or null when it was not set.
public Text? Subtitle { get; }
Related types: Text
Width
Gets the horizontal width of the container.
The value, or null when it was not set.
public ContainerWidth? Width { get; }
Related types: ContainerWidth
Icon
Gets the image displayed beside the title.
The value, or null when it was not set.
public ImageElement? Icon { get; }
Related types: ImageElement
IsCollapsible
Gets whether users can collapse and expand the container.
The value, or null when it was not set.
public bool? IsCollapsible { get; }
DefaultCollapsed
Gets whether a collapsible container starts collapsed. Requires the container to be collapsible.
The value, or null when it was not set.
public bool? DefaultCollapsed { get; }
HasHeaderDivider
Gets whether Slack draws a divider below the container header. Only valid for non-collapsible containers.
The value, or null when it was not set.
public bool? HasHeaderDivider { get; }
BlockId
Gets 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.
The value, or null when it was not set.
public string? BlockId { get; }
ContainerWidth
Widths supported by Slack container blocks.
ToWireValue() returns the value Slack expects in JSON.
| 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.
- Required:
elements.
See the Slack reference.
Implements IBlock.
ContextActionsBlock
Creates and validates a ContextActionsBlock.
public ContextActionsBlock(IEnumerable<IContextActionsElement> elements, string? blockId = null, IReadOnlyDictionary<string, object?>? additionalFields = null)
| Parameter | Description |
|---|---|
elements | Feedback buttons or icon buttons in display order. Required. Slack allows at most 5 items. |
blockId | 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. |
additionalFields | Slack fields that have no named parameter yet, such as a field Slack introduced after this release. Values must be strings, numbers, booleans, lists, dictionaries, JSON nodes, or slackblocks values, and are validated with the rest of the object. Typed properties do not reflect them, and a field cannot be set both here and through its named parameter. |
| Throws | When |
|---|---|
ValidationException | The value breaks a Block Kit rule, such as a missing required field or an exceeded length limit. |
ArgumentException | A collection contains null, or an additional field cannot be written as JSON or repeats a named parameter. |
Related types: ContextActionsBlock, IContextActionsElement
Elements
Gets feedback buttons or icon buttons in display order.
The values in order, or an empty list when none were set.
public IReadOnlyList<IContextActionsElement> Elements { get; }
Related types: IContextActionsElement
BlockId
Gets 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.
The value, or null when it was not set.
public string? BlockId { get; }
ContextBlock
A block of small, secondary images and text.
- Required:
elements.
See the Slack reference.
Implements IBlock.
ContextBlock
Creates and validates a ContextBlock.
public ContextBlock(IEnumerable<IContextElement> elements, string? blockId = null, IReadOnlyDictionary<string, object?>? additionalFields = null)
| Parameter | Description |
|---|---|
elements | Images and text in display order. Required. Slack allows at most 10 items. |
blockId | 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. |
additionalFields | Slack fields that have no named parameter yet, such as a field Slack introduced after this release. Values must be strings, numbers, booleans, lists, dictionaries, JSON nodes, or slackblocks values, and are validated with the rest of the object. Typed properties do not reflect them, and a field cannot be set both here and through its named parameter. |
| Throws | When |
|---|---|
ValidationException | The value breaks a Block Kit rule, such as a missing required field or an exceeded length limit. |
ArgumentException | A collection contains null, or an additional field cannot be written as JSON or repeats a named parameter. |
Related types: ContextBlock, IContextElement
Elements
Gets images and text in display order.
The values in order, or an empty list when none were set.
public IReadOnlyList<IContextElement> Elements { get; }
Related types: IContextElement
BlockId
Gets 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.
The value, or null when it was not set.
public string? BlockId { get; }
DataTableBlock
A sortable, paginated table of raw text, numbers, and rich text.
- 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.
Implements IBlock.
DataTableBlock
Creates and validates a DataTableBlock.
public DataTableBlock(IEnumerable<IEnumerable<IDataTableCell>> rows, string caption, int? pageSize = null, int? rowHeaderColumnIndex = null, string? blockId = null, IReadOnlyDictionary<string, object?>? additionalFields = null)
| Parameter | Description |
|---|---|
rows | Complete table rows in display order. Every row must have the same number of cells. Required. Must contain between 2 and 201 items. |
caption | The caption that describes the table's contents. Required. |
pageSize | How many rows Slack shows per page. Must be between 1 and 100. |
rowHeaderColumnIndex | The zero-based index of the column whose cells act as row headers. |
blockId | 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. |
additionalFields | Slack fields that have no named parameter yet, such as a field Slack introduced after this release. Values must be strings, numbers, booleans, lists, dictionaries, JSON nodes, or slackblocks values, and are validated with the rest of the object. Typed properties do not reflect them, and a field cannot be set both here and through its named parameter. |
| Throws | When |
|---|---|
ValidationException | The value breaks a Block Kit rule, such as a missing required field or an exceeded length limit. |
ArgumentException | A collection contains null, or an additional field cannot be written as JSON or repeats a named parameter. |
Related types: DataTableBlock, IDataTableCell
Rows
Gets complete table rows in display order. Every row must have the same number of cells.
The values in order, or an empty list when none were set.
public IReadOnlyList<IReadOnlyList<IDataTableCell>> Rows { get; }
Related types: IDataTableCell
Caption
Gets the caption that describes the table's contents.
public string Caption { get; }
PageSize
Gets how many rows Slack shows per page.
public int? PageSize { get; }
RowHeaderColumnIndex
Gets the zero-based index of the column whose cells act as row headers.
public int? RowHeaderColumnIndex { get; }
BlockId
Gets 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.
The value, or null when it was not set.
public string? BlockId { get; }
DataVisualizationBlock
A titled pie, bar, area, or line chart.
- Required:
title,chart.
See the Slack reference.
Implements IBlock.
DataVisualizationBlock
Creates and validates a DataVisualizationBlock.
public DataVisualizationBlock(string title, IChart chart, string? blockId = null, IReadOnlyDictionary<string, object?>? additionalFields = null)
| Parameter | Description |
|---|---|
title | The chart title. Required. Slack allows at most 50 characters. |
chart | The chart to display. Required. |
blockId | 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. |
additionalFields | Slack fields that have no named parameter yet, such as a field Slack introduced after this release. Values must be strings, numbers, booleans, lists, dictionaries, JSON nodes, or slackblocks values, and are validated with the rest of the object. Typed properties do not reflect them, and a field cannot be set both here and through its named parameter. |
| Throws | When |
|---|---|
ValidationException | The value breaks a Block Kit rule, such as a missing required field or an exceeded length limit. |
ArgumentException | A collection contains null, or an additional field cannot be written as JSON or repeats a named parameter. |
Related types: DataVisualizationBlock, IChart
Title
Gets the chart title.
public string Title { get; }
Chart
Gets the chart to display.
public IChart Chart { get; }
Related types: IChart
BlockId
Gets 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.
The value, or null when it was not set.
public string? BlockId { get; }
DividerBlock
A horizontal rule that separates blocks.
See the Slack reference.
Implements IBlock.
DividerBlock
Creates and validates a DividerBlock.
public DividerBlock(string? blockId = null, IReadOnlyDictionary<string, object?>? additionalFields = null)
| Parameter | Description |
|---|---|
blockId | 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. |
additionalFields | Slack fields that have no named parameter yet, such as a field Slack introduced after this release. Values must be strings, numbers, booleans, lists, dictionaries, JSON nodes, or slackblocks values, and are validated with the rest of the object. Typed properties do not reflect them, and a field cannot be set both here and through its named parameter. |
| Throws | When |
|---|---|
ValidationException | The value breaks a Block Kit rule, such as a missing required field or an exceeded length limit. |
ArgumentException | A collection contains null, or an additional field cannot be written as JSON or repeats a named parameter. |
Related types: DividerBlock
BlockId
Gets 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.
The value, or null when it was not set.
public string? BlockId { get; }
FileBlock
A remote file previously added with the files.remote API.
- Required:
externalId.
See the Slack reference.
Implements IBlock.
FileBlock
Creates and validates a FileBlock.
public FileBlock(string externalId, string? source = null, string? blockId = null, IReadOnlyDictionary<string, object?>? additionalFields = null)
| Parameter | Description |
|---|---|
externalId | The external identifier of a remote file previously added with the files.remote API. Required. |
source | The file source. Slack currently supports only remote files. |
blockId | 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. |
additionalFields | Slack fields that have no named parameter yet, such as a field Slack introduced after this release. Values must be strings, numbers, booleans, lists, dictionaries, JSON nodes, or slackblocks values, and are validated with the rest of the object. Typed properties do not reflect them, and a field cannot be set both here and through its named parameter. |
| Throws | When |
|---|---|
ValidationException | The value breaks a Block Kit rule, such as a missing required field or an exceeded length limit. |
ArgumentException | A collection contains null, or an additional field cannot be written as JSON or repeats a named parameter. |
Related types: FileBlock
ExternalId
Gets the external identifier of a remote file previously added with the files.remote API.
public string ExternalId { get; }
Source
Gets the file source. Slack currently supports only remote files.
public string? Source { get; }
BlockId
Gets 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.
The value, or null when it was not set.
public string? BlockId { get; }
HeaderBlock
Large, bold plain text that introduces a group of blocks.
- Required:
text.
See the Slack reference.
Implements IBlock.
HeaderBlock
Creates and validates a HeaderBlock.
public HeaderBlock(PlainText text, string? blockId = null, IReadOnlyDictionary<string, object?>? additionalFields = null)
| Parameter | Description |
|---|---|
text | The header text, shown in a larger bold font. Required. Slack allows at most 150 characters. A string is sent as a plain_text text object. |
blockId | 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. |
additionalFields | Slack fields that have no named parameter yet, such as a field Slack introduced after this release. Values must be strings, numbers, booleans, lists, dictionaries, JSON nodes, or slackblocks values, and are validated with the rest of the object. Typed properties do not reflect them, and a field cannot be set both here and through its named parameter. |
| Throws | When |
|---|---|
ValidationException | The value breaks a Block Kit rule, such as a missing required field or an exceeded length limit. |
ArgumentException | A collection contains null, or an additional field cannot be written as JSON or repeats a named parameter. |
Related types: HeaderBlock, PlainText
Text
Gets the header text, shown in a larger bold font.
public PlainText Text { get; }
Related types: PlainText, Text
BlockId
Gets 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.
The value, or null when it was not set.
public string? BlockId { get; }
IBlock
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.
IContextActionsElement
A value that can appear in a context actions block: feedback buttons or an icon button.
Implemented by FeedbackButtonsElement, IconButtonElement.
IContextElement
A value that can appear in a context block: an image element or a text object.
Implemented by ImageElement, MarkdownText, PlainText.
IDataTableCell
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.
ImageBlock
A standalone image with alternative text and an optional title.
- Required:
imageUrl,altText.
See the Slack reference.
Implements IBlock.
ImageBlock
Creates and validates a ImageBlock.
public ImageBlock(string imageUrl, string altText, PlainText? title = null, string? blockId = null, IReadOnlyDictionary<string, object?>? additionalFields = null)
| Parameter | Description |
|---|---|
imageUrl | The publicly accessible URL of the image. Cannot be combined with a Slack file. Required. Slack allows at most 3000 characters. |
altText | A plain-text summary of the image or video for assistive technology. Required. Slack allows at most 2000 characters. |
title | The title shown above the image. A string is sent as a plain_text text object. |
blockId | 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. |
additionalFields | Slack fields that have no named parameter yet, such as a field Slack introduced after this release. Values must be strings, numbers, booleans, lists, dictionaries, JSON nodes, or slackblocks values, and are validated with the rest of the object. Typed properties do not reflect them, and a field cannot be set both here and through its named parameter. |
| Throws | When |
|---|---|
ValidationException | The value breaks a Block Kit rule, such as a missing required field or an exceeded length limit. |
ArgumentException | A collection contains null, or an additional field cannot be written as JSON or repeats a named parameter. |
Related types: ImageBlock, PlainText
ImageUrl
Gets the publicly accessible URL of the image. Cannot be combined with a Slack file.
public string ImageUrl { get; }
AltText
Gets a plain-text summary of the image or video for assistive technology.
public string AltText { get; }
Title
Gets the title shown above the image.
The value, or null when it was not set.
public PlainText? Title { get; }
Related types: PlainText
BlockId
Gets 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.
The value, or null when it was not set.
public string? BlockId { get; }
InputBlock
A labelled input that collects a value in a modal, App Home, or message.
- Required:
label,element.
See the Slack reference.
Implements IBlock.
InputBlock
Creates and validates a InputBlock.
public InputBlock(PlainText label, IInputElement element, bool? dispatchAction = null, string? blockId = null, PlainText? hint = null, bool? optional = null, IReadOnlyDictionary<string, object?>? additionalFields = null)
| Parameter | Description |
|---|---|
label | The label shown above the input. Required. Slack allows at most 2000 characters. A string is sent as a plain_text text object. |
element | The input element that collects the user's value. Required. |
dispatchAction | Whether changing the element sends a block_actions payload immediately. |
blockId | 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. |
hint | Helper text shown below the input. Slack allows at most 2000 characters. A string is sent as a plain_text text object. |
optional | Whether the modal can be submitted when this input is empty. |
additionalFields | Slack fields that have no named parameter yet, such as a field Slack introduced after this release. Values must be strings, numbers, booleans, lists, dictionaries, JSON nodes, or slackblocks values, and are validated with the rest of the object. Typed properties do not reflect them, and a field cannot be set both here and through its named parameter. |
| Throws | When |
|---|---|
ValidationException | The value breaks a Block Kit rule, such as a missing required field or an exceeded length limit. |
ArgumentException | A collection contains null, or an additional field cannot be written as JSON or repeats a named parameter. |
Related types: IInputElement, InputBlock, PlainText
Label
Gets the label shown above the input.
public PlainText Label { get; }
Related types: PlainText
Element
Gets the input element that collects the user's value.
public IInputElement Element { get; }
Related types: IInputElement
DispatchAction
Gets whether changing the element sends a block_actions payload immediately.
The value, or null when it was not set.
public bool? DispatchAction { get; }
BlockId
Gets 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.
The value, or null when it was not set.
public string? BlockId { get; }
Hint
Gets helper text shown below the input.
The value, or null when it was not set.
public PlainText? Hint { get; }
Related types: PlainText
Optional
Gets whether the modal can be submitted when this input is empty.
The value, or null when it was not set.
public bool? Optional { get; }
ITableCell
A value that can appear as a table block cell: raw text or a rich text block.
Implemented by RawText, RichTextBlock.
MarkdownBlock
Standard markdown rendered by Slack, intended for AI-generated content.
- Required:
text.
See the Slack reference.
Implements IBlock.
MarkdownBlock
Creates and validates a MarkdownBlock.
public MarkdownBlock(string text, string? blockId = null, IReadOnlyDictionary<string, object?>? additionalFields = null)
| Parameter | Description |
|---|---|
text | Standard markdown content, which Slack renders directly. Required. Must be between 1 and 12000 characters. |
blockId | 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. |
additionalFields | Slack fields that have no named parameter yet, such as a field Slack introduced after this release. Values must be strings, numbers, booleans, lists, dictionaries, JSON nodes, or slackblocks values, and are validated with the rest of the object. Typed properties do not reflect them, and a field cannot be set both here and through its named parameter. |
| Throws | When |
|---|---|
ValidationException | The value breaks a Block Kit rule, such as a missing required field or an exceeded length limit. |
ArgumentException | A collection contains null, or an additional field cannot be written as JSON or repeats a named parameter. |
Related types: MarkdownBlock
Text
Gets standard markdown content, which Slack renders directly.
public string Text { get; }
Related types: Text
BlockId
Gets 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.
The value, or null when it was not set.
public string? BlockId { get; }
PlanBlock
A titled sequence of task cards.
- Required:
title.
See the Slack reference.
Implements IBlock.
PlanBlock
Creates and validates a PlanBlock.
public PlanBlock(string title, IEnumerable<TaskCardBlock>? tasks = null, string? blockId = null, IReadOnlyDictionary<string, object?>? additionalFields = null)
| Parameter | Description |
|---|---|
title | The plan title. Required. |
tasks | Task cards in display order. |
blockId | 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. |
additionalFields | Slack fields that have no named parameter yet, such as a field Slack introduced after this release. Values must be strings, numbers, booleans, lists, dictionaries, JSON nodes, or slackblocks values, and are validated with the rest of the object. Typed properties do not reflect them, and a field cannot be set both here and through its named parameter. |
| Throws | When |
|---|---|
ValidationException | The value breaks a Block Kit rule, such as a missing required field or an exceeded length limit. |
ArgumentException | A collection contains null, or an additional field cannot be written as JSON or repeats a named parameter. |
Related types: PlanBlock, TaskCardBlock
Title
Gets the plan title.
public string Title { get; }
Tasks
Gets task cards in display order.
The values in order, or an empty list when none were set.
public IReadOnlyList<TaskCardBlock> Tasks { get; }
Related types: TaskCardBlock
BlockId
Gets 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.
The value, or null when it was not set.
public string? BlockId { get; }
RichTextBlock
Formatted text built from sections, lists, preformatted blocks, and quotes.
- Required:
elements.
See the Slack reference.
Implements IBlock, IDataTableCell, ITableCell.
RichTextBlock
Creates and validates a RichTextBlock.
public RichTextBlock(IEnumerable<IRichTextBlockElement> elements, string? blockId = null, IReadOnlyDictionary<string, object?>? additionalFields = null)
| Parameter | Description |
|---|---|
elements | Sections, lists, preformatted blocks, and quotes in display order. Required. |
blockId | 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. |
additionalFields | Slack fields that have no named parameter yet, such as a field Slack introduced after this release. Values must be strings, numbers, booleans, lists, dictionaries, JSON nodes, or slackblocks values, and are validated with the rest of the object. Typed properties do not reflect them, and a field cannot be set both here and through its named parameter. |
| Throws | When |
|---|---|
ValidationException | The value breaks a Block Kit rule, such as a missing required field or an exceeded length limit. |
ArgumentException | A collection contains null, or an additional field cannot be written as JSON or repeats a named parameter. |
Related types: IRichTextBlockElement, RichTextBlock
Elements
Gets sections, lists, preformatted blocks, and quotes in display order.
The values in order, or an empty list when none were set.
public IReadOnlyList<IRichTextBlockElement> Elements { get; }
Related types: IRichTextBlockElement
BlockId
Gets 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.
The value, or null when it was not set.
public string? BlockId { get; }
SectionBlock
Text, a grid of fields, or both, with an optional accessory element.
- Provide text, fields, or both.
See the Slack reference.
Implements IBlock.
SectionBlock
Creates and validates a SectionBlock.
public SectionBlock(Text? text = null, IEnumerable<Text>? fields = null, IElement? accessory = null, string? blockId = null, IReadOnlyDictionary<string, object?>? additionalFields = null)
| Parameter | Description |
|---|---|
text | The main text of the section. Slack allows at most 3000 characters. A string is sent as a mrkdwn text object. |
fields | Section fields, shown in a two-column grid, in display order. Slack allows at most 10 items, each at most 2000 characters. Strings are sent as mrkdwn text objects. |
accessory | The element displayed beside the section text. |
blockId | 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. |
additionalFields | Slack fields that have no named parameter yet, such as a field Slack introduced after this release. Values must be strings, numbers, booleans, lists, dictionaries, JSON nodes, or slackblocks values, and are validated with the rest of the object. Typed properties do not reflect them, and a field cannot be set both here and through its named parameter. |
| Throws | When |
|---|---|
ValidationException | The value breaks a Block Kit rule, such as a missing required field or an exceeded length limit. |
ArgumentException | A collection contains null, or an additional field cannot be written as JSON or repeats a named parameter. |
Related types: IElement, SectionBlock, Text
Text
Gets the main text of the section.
The value, or null when it was not set.
public Text? Text { get; }
Related types: Text
Fields
Gets section fields, shown in a two-column grid, in display order.
The values in order, or an empty list when none were set.
public IReadOnlyList<Text> Fields { get; }
Related types: Text
Accessory
Gets the element displayed beside the section text.
The value, or null when it was not set.
public IElement? Accessory { get; }
Related types: IElement
BlockId
Gets 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.
The value, or null when it was not set.
public string? BlockId { get; }
TableBlock
A simple table of raw text and rich text cells.
- Required:
rows. - Every row must have the same number of cells.
- Column settings need one entry for every column.
See the Slack reference.
Implements IBlock.
TableBlock
Creates and validates a TableBlock.
public TableBlock(IEnumerable<IEnumerable<ITableCell>> rows, IEnumerable<ColumnSettings>? columnSettings = null, string? blockId = null, IReadOnlyDictionary<string, object?>? additionalFields = null)
| Parameter | Description |
|---|---|
rows | Complete table rows in display order. Every row must have the same number of cells. Required. |
columnSettings | Per-column settings in column order. Provide one entry for every column. |
blockId | 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. |
additionalFields | Slack fields that have no named parameter yet, such as a field Slack introduced after this release. Values must be strings, numbers, booleans, lists, dictionaries, JSON nodes, or slackblocks values, and are validated with the rest of the object. Typed properties do not reflect them, and a field cannot be set both here and through its named parameter. |
| Throws | When |
|---|---|
ValidationException | The value breaks a Block Kit rule, such as a missing required field or an exceeded length limit. |
ArgumentException | A collection contains null, or an additional field cannot be written as JSON or repeats a named parameter. |
Related types: ColumnSettings, ITableCell, TableBlock
Rows
Gets complete table rows in display order. Every row must have the same number of cells.
The values in order, or an empty list when none were set.
public IReadOnlyList<IReadOnlyList<ITableCell>> Rows { get; }
Related types: ITableCell
ColumnSettings
Gets per-column settings in column order. Provide one entry for every column.
The values in order, or an empty list when none were set.
public IReadOnlyList<ColumnSettings> ColumnSettings { get; }
Related types: ColumnSettings
BlockId
Gets 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.
The value, or null when it was not set.
public string? BlockId { get; }
TaskCardBlock
One task with its status, details, output, and sources.
- Required:
taskId,title.
See the Slack reference.
Implements IBlock.
TaskCardBlock
Creates and validates a TaskCardBlock.
public TaskCardBlock(string taskId, string title, RichTextBlock? details = null, RichTextBlock? output = null, IEnumerable<UrlSource>? sources = null, TaskCardStatus? status = null, string? blockId = null, IReadOnlyDictionary<string, object?>? additionalFields = null)
| Parameter | Description |
|---|---|
taskId | The identifier of the task. Required. |
title | The task title. Required. |
details | A rich text description of the task. |
output | Rich text describing the task's output. |
sources | Links to the sources the task used, in display order. |
status | The task's current state. |
blockId | 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. |
additionalFields | Slack fields that have no named parameter yet, such as a field Slack introduced after this release. Values must be strings, numbers, booleans, lists, dictionaries, JSON nodes, or slackblocks values, and are validated with the rest of the object. Typed properties do not reflect them, and a field cannot be set both here and through its named parameter. |
| Throws | When |
|---|---|
ValidationException | The value breaks a Block Kit rule, such as a missing required field or an exceeded length limit. |
ArgumentException | A collection contains null, or an additional field cannot be written as JSON or repeats a named parameter. |
Related types: RichTextBlock, TaskCardBlock, TaskCardStatus, UrlSource
TaskId
Gets the identifier of the task.
public string TaskId { get; }
Title
Gets the task title.
public string Title { get; }
Details
Gets a rich text description of the task.
The value, or null when it was not set.
public RichTextBlock? Details { get; }
Related types: RichTextBlock
Output
Gets rich text describing the task's output.
The value, or null when it was not set.
public RichTextBlock? Output { get; }
Related types: RichTextBlock
Sources
Gets links to the sources the task used, in display order.
The values in order, or an empty list when none were set.
public IReadOnlyList<UrlSource> Sources { get; }
Related types: UrlSource
Status
Gets the task's current state.
The value, or null when it was not set.
public TaskCardStatus? Status { get; }
Related types: TaskCardStatus
BlockId
Gets 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.
The value, or null when it was not set.
public string? BlockId { get; }
TaskCardStatus
States supported by task card blocks.
ToWireValue() returns the value Slack expects in JSON.
| Constant | Slack value | Meaning |
|---|---|---|
Pending | pending | The task has not started. |
InProgress | in_progress | The task is running. |
Complete | complete | The task finished successfully. |
Error | error | The task failed. |
VideoBlock
An embedded video player.
- Required:
altText,thumbnailUrl,title,videoUrl.
See the Slack reference.
Implements IBlock.
VideoBlock
Creates and validates a VideoBlock.
public VideoBlock(string altText, string thumbnailUrl, PlainText title, string videoUrl, string? blockId = null, string? authorName = null, PlainText? description = null, string? providerIconUrl = null, string? providerName = null, string? titleUrl = null, IReadOnlyDictionary<string, object?>? additionalFields = null)
| Parameter | Description |
|---|---|
altText | A plain-text summary of the image or video for assistive technology. Required. Must be between 1 and 200 characters. |
thumbnailUrl | The URL of the image shown before the video plays. Required. |
title | The video title. Required. Slack allows at most 200 characters. A string is sent as a plain_text text object. |
videoUrl | The embeddable URL of the video. The domain must be listed in the app's unfurl domains. Required. |
blockId | 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. |
authorName | The name of the video's author. Slack allows at most 50 characters. |
description | The video description. Slack allows at most 200 characters. A string is sent as a plain_text text object. |
providerIconUrl | The URL of the video provider's icon. |
providerName | The name of the video provider, such as YouTube. Slack allows at most 50 characters. |
titleUrl | The HTTPS URL opened when the title is clicked. |
additionalFields | Slack fields that have no named parameter yet, such as a field Slack introduced after this release. Values must be strings, numbers, booleans, lists, dictionaries, JSON nodes, or slackblocks values, and are validated with the rest of the object. Typed properties do not reflect them, and a field cannot be set both here and through its named parameter. |
| Throws | When |
|---|---|
ValidationException | The value breaks a Block Kit rule, such as a missing required field or an exceeded length limit. |
ArgumentException | A collection contains null, or an additional field cannot be written as JSON or repeats a named parameter. |
Related types: PlainText, VideoBlock
AltText
Gets a plain-text summary of the image or video for assistive technology.
public string AltText { get; }
ThumbnailUrl
Gets the URL of the image shown before the video plays.
public string ThumbnailUrl { get; }
Title
Gets the video title.
public PlainText Title { get; }
Related types: PlainText
VideoUrl
Gets the embeddable URL of the video. The domain must be listed in the app's unfurl domains.
public string VideoUrl { get; }
BlockId
Gets 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.
The value, or null when it was not set.
public string? BlockId { get; }
AuthorName
Gets the name of the video's author.
The value, or null when it was not set.
public string? AuthorName { get; }
Description
Gets the video description.
The value, or null when it was not set.
public PlainText? Description { get; }
Related types: PlainText
ProviderIconUrl
Gets the URL of the video provider's icon.
The value, or null when it was not set.
public string? ProviderIconUrl { get; }
ProviderName
Gets the name of the video provider, such as YouTube.
The value, or null when it was not set.
public string? ProviderName { get; }
TitleUrl
Gets the HTTPS URL opened when the title is clicked.
The value, or null when it was not set.
public string? TitleUrl { get; }