Payloads
Fluent builders for complete messages, interaction responses, webhooks, secondary attachments, modals, and App Home tabs. Their built objects can be passed directly to the corresponding Slack SDK or HTTP API method.
Attachment()
function Attachment(): FluentBuilder<{
blocks: JsonObject[];
color?: string;
fallback?: string;
}, JsonObject>;
Creates lower-priority supporting content using Slack's legacy secondary
attachment format. Attachments add context beneath a message, while fallback()
supplies text for notifications and clients that cannot display Block Kit.
See: https://docs.slack.dev/legacy/legacy-messaging/legacy-secondary-message-attachments.
Chainable setters
Call these setters in any order before .build(). Repeating a singular setter replaces its previous value.
Collection setters accept individual values, nested builders, or arrays and append each call.
| Setter | Value type | Required | Description |
|---|---|---|---|
.blocks(...values) | | Yes | Blocks displayed inside the attachment. |
.color(value) | string | No | Optional side-border color: a Color value or a six-digit hex code. |
.fallback(value) | string | No | Plain-text fallback for notifications and clients without Block Kit support. |
Validation and errors
.build() materializes nested builders and validates the finished Slack object. It throws a typed slackblocks validation error when a required value is missing, a value has the wrong type or range, mutually exclusive setters are combined, or Slack rejects the resulting shape. Pass { validate: false } to .build() only when intentionally creating an intermediate partial object.
Returns
FluentBuilder<{
blocks: JsonObject[];
color?: string;
fallback?: string;
}, JsonObject>
HomeTab()
function HomeTab(): FluentBuilder<{
blocks: JsonObject[];
callbackId?: string;
externalId?: string;
privateMetadata?: string;
}, SlackObject<"home">>;
Creates an App Home tab view for Slack's views.publish method. Add up to 100
compatible blocks and optional identifiers or private metadata for the
application.
See: https://docs.slack.dev/surfaces/app-home.
Chainable setters
Call these setters in any order before .build(). Repeating a singular setter replaces its previous value.
Collection setters accept individual values, nested builders, or arrays and append each call.
| Setter | Value type | Required | Description |
|---|---|---|---|
.blocks(...values) | | Yes | Between one and 100 App Home-compatible blocks. |
.privateMetadata(value) | string | No | Opaque application metadata returned with view interactions. |
.callbackId(value) | string | No | Application-defined callback identifier. |
.externalId(value) | string | No | Application-defined external identifier. |
Validation and errors
.build() materializes nested builders and validates the finished Slack object. It throws a typed slackblocks validation error when a required value is missing, a value has the wrong type or range, mutually exclusive setters are combined, or Slack rejects the resulting shape. Pass { validate: false } to .build() only when intentionally creating an intermediate partial object.
Returns
FluentBuilder<{
blocks: JsonObject[];
callbackId?: string;
externalId?: string;
privateMetadata?: string;
}, SlackObject<"home">>
Message()
function Message(): FluentBuilder<MessageInput, JsonObject>;
Creates a message payload for Slack Web API methods such as
chat.postMessage. Set the destination channel and add Block Kit blocks,
secondary attachments, fallback text, metadata, or unfurl behavior as needed.
See: https://docs.slack.dev/reference/methods/chat.postMessage.
Chainable setters
Call these setters in any order before .build(). Repeating a singular setter replaces its previous value.
Collection setters accept individual values, nested builders, or arrays and append each call.
| Setter | Value type | Required | Description |
|---|---|---|---|
.channel(value) | string | Yes | Channel, group, or direct-message conversation identifier. |
.blocks(...values) | | No | Block Kit blocks displayed in the message. |
.attachments(...values) | | No | Optional secondary attachments. |
.text(value) | string | No | Notification and accessibility fallback text. |
.mrkdwn(value) | boolean | No | Whether Slack parses text as mrkdwn. Defaults to true. |
.unfurlLinks(value) | boolean | No | Whether Slack unfurls links. |
.unfurlMedia(value) | boolean | No | Whether Slack unfurls media. |
.metadata(value) | | No | Optional message metadata. |
Validation and errors
.build() materializes nested builders and validates the finished Slack object. It throws a typed slackblocks validation error when a required value is missing, a value has the wrong type or range, mutually exclusive setters are combined, or Slack rejects the resulting shape. Pass { validate: false } to .build() only when intentionally creating an intermediate partial object.
Returns
FluentBuilder<MessageInput, JsonObject>
MessageInput
Destination, Block Kit content, fallback text, attachments, metadata, and unfurl behavior for a Slack Web API message payload.
Properties
| Property | Type | Description |
|---|---|---|
attachments? | JsonObject[] | Optional secondary attachments. |
blocks? | JsonObject[] | Block Kit blocks displayed in the message. |
channel | string | Channel, group, or direct-message conversation identifier. |
metadata? | JsonObject | Optional message metadata. |
mrkdwn? | boolean | Whether Slack parses text as mrkdwn. Defaults to true. |
text? | string | Notification and accessibility fallback text. |
unfurlLinks? | boolean | Whether Slack unfurls links. |
unfurlMedia? | boolean | Whether Slack unfurls media. |
MessageResponse()
function MessageResponse(): FluentBuilder<{
attachments?: JsonObject[];
blocks?: JsonObject[];
mrkdwn?: boolean;
replaceOriginal?: boolean;
responseType?: "ephemeral" | "in_channel";
text?: string;
}, JsonObject>;
Creates the immediate response payload returned for a slash command or interactive request. Configure its blocks, fallback text, visibility, and whether it replaces the original interaction message.
See: https://docs.slack.dev/interactivity/implementing-slash-commands#responding_to_commands.
Chainable setters
Call these setters in any order before .build(). Repeating a singular setter replaces its previous value.
Collection setters accept individual values, nested builders, or arrays and append each call.
| Setter | Value type | Required | Description |
|---|---|---|---|
.blocks(...values) | | No | Block Kit blocks displayed in the response. |
.attachments(...values) | | No | Optional secondary attachments. |
.text(value) | string | No | Notification and accessibility fallback text. |
.mrkdwn(value) | boolean | No | Whether Slack parses text as mrkdwn. Defaults to true. |
.replaceOriginal(value) | boolean | No | Replace the original interaction message. Defaults to false. |
.responseType(value) | "ephemeral" | "in_channel" | No | Response visibility. Defaults to in_channel. |
Validation and errors
.build() materializes nested builders and validates the finished Slack object. It throws a typed slackblocks validation error when a required value is missing, a value has the wrong type or range, mutually exclusive setters are combined, or Slack rejects the resulting shape. Pass { validate: false } to .build() only when intentionally creating an intermediate partial object.
Returns
FluentBuilder<{
attachments?: JsonObject[];
blocks?: JsonObject[];
mrkdwn?: boolean;
replaceOriginal?: boolean;
responseType?: "ephemeral" | "in_channel";
text?: string;
}, JsonObject>
Modal()
function Modal(): FluentBuilder<{
blocks: JsonObject[];
callbackId?: string;
clearOnClose?: boolean;
close?: TextLike;
externalId?: string;
notifyOnClose?: boolean;
privateMetadata?: string;
submit?: TextLike;
submitDisabled?: boolean;
title: TextLike;
}, SlackObject<"modal">>;
Creates a modal view for Slack's views.open, views.update, and views.push
methods. Configure the title, compatible blocks, controls, metadata, and close
behavior before building the payload.
See: https://docs.slack.dev/surfaces/modals.
Chainable setters
Call these setters in any order before .build(). Repeating a singular setter replaces its previous value.
Collection setters accept individual values, nested builders, or arrays and append each call.
| Setter | Value type | Required | Description |
|---|---|---|---|
.title(value) | | Yes | Plain-text modal title, up to 24 characters. |
.blocks(...values) | | Yes | Between one and 100 modal-compatible blocks. |
.close(value) | | No | Optional plain-text close-button label. |
.submit(value) | | No | Optional plain-text submit-button label. |
.privateMetadata(value) | string | No | Opaque application metadata returned with view interactions. |
.callbackId(value) | string | No | Application-defined callback identifier. |
.clearOnClose(value) | boolean | No | Close every view above this modal when it closes. |
.notifyOnClose(value) | boolean | No | Send a view_closed event when the modal closes. |
.externalId(value) | string | No | Application-defined external identifier. |
.submitDisabled(value) | boolean | No | Keep the submit button disabled until an input changes. |
Validation and errors
.build() materializes nested builders and validates the finished Slack object. It throws a typed slackblocks validation error when a required value is missing, a value has the wrong type or range, mutually exclusive setters are combined, or Slack rejects the resulting shape. Pass { validate: false } to .build() only when intentionally creating an intermediate partial object.
Returns
FluentBuilder<{
blocks: JsonObject[];
callbackId?: string;
clearOnClose?: boolean;
close?: TextLike;
externalId?: string;
notifyOnClose?: boolean;
privateMetadata?: string;
submit?: TextLike;
submitDisabled?: boolean;
title: TextLike;
}, SlackObject<"modal">>
WebhookMessage()
function WebhookMessage(): FluentBuilder<{
attachments?: JsonObject[];
blocks?: JsonObject[];
deleteOriginal?: boolean;
metadata?: JsonObject;
replaceOriginal?: boolean;
responseType?: "ephemeral" | "in_channel";
text?: string;
unfurlLinks?: boolean;
unfurlMedia?: boolean;
}, JsonObject>;
Creates a payload for an incoming webhook or an interaction response URL. Unlike a Web API message, this form can replace or delete the original message and does not require a destination channel field.
See: https://docs.slack.dev/messaging/sending-messages-using-incoming-webhooks.
Chainable setters
Call these setters in any order before .build(). Repeating a singular setter replaces its previous value.
Collection setters accept individual values, nested builders, or arrays and append each call.
| Setter | Value type | Required | Description |
|---|---|---|---|
.blocks(...values) | | No | Block Kit blocks displayed in the message. |
.attachments(...values) | | No | Optional secondary attachments. |
.text(value) | string | No | Notification and accessibility fallback text. |
.responseType(value) | "ephemeral" | "in_channel" | No | Response visibility for response URLs. |
.replaceOriginal(value) | boolean | No | Replace the original interaction message. |
.deleteOriginal(value) | boolean | No | Delete the original interaction message. |
.unfurlLinks(value) | boolean | No | Whether Slack unfurls links. |
.unfurlMedia(value) | boolean | No | Whether Slack unfurls media. |
.metadata(value) | | No | Optional message metadata. |
Validation and errors
.build() materializes nested builders and validates the finished Slack object. It throws a typed slackblocks validation error when a required value is missing, a value has the wrong type or range, mutually exclusive setters are combined, or Slack rejects the resulting shape. Pass { validate: false } to .build() only when intentionally creating an intermediate partial object.
Returns
FluentBuilder<{
attachments?: JsonObject[];
blocks?: JsonObject[];
deleteOriginal?: boolean;
metadata?: JsonObject;
replaceOriginal?: boolean;
responseType?: "ephemeral" | "in_channel";
text?: string;
unfurlLinks?: boolean;
unfurlMedia?: boolean;
}, JsonObject>