Skip to main content

Composition Objects

Composition-object factories used as fields inside blocks and elements.

These helpers cover text, options, confirmations, workflow metadata, files, table cells, icons, and chart data.

areaChart()

areaChart(series, axis, settings?): SlackObject<"area">

Creates an area chart.

Parameters

ParameterTypeDescription
seriesJsonObject[]One to 12 uniquely named data series.
axisJsonObjectAxis configuration whose categories match every series.
settingsFactorySettingsPer-call validation settings.

Returns

SlackObject<"area">

A validated Slack area chart object.

Throws

InvalidUsageError when series and axis categories do not match.


asText()

asText(value, kind?, settings?): TextObject

Converts a string to a text object while preserving existing text objects.

Parameters

ParameterTypeDefault valueDescription
valueTextLikeundefinedString or existing text object.
kind"plain_text" | "mrkdwn""mrkdwn"Text kind used for strings. Defaults to mrkdwn.
settingsFactorySettings{}Per-call validation settings.

Returns

TextObject

A Slack text composition object.

Throws

InvalidUsageError when the text violates Slack's length constraints.


axisConfig()

axisConfig(input, settings?): JsonObject

Creates category and label configuration for an axis-based chart.

Input fields

Ordered categories and optional axis labels.

Input fieldTypeDescription
categoriesstring[]Unique category labels, in display order.
xLabel?stringOptional horizontal-axis label, up to 50 characters.
yLabel?stringOptional vertical-axis label, up to 50 characters.

Settings

SettingTypeDescription
settingsFactorySettingsPer-call validation settings.

Returns

JsonObject

A validated chart-axis configuration object.

Throws

InvalidUsageError when labels are duplicated or exceed Slack's limits.


AxisConfigInput

Fields accepted by axisConfig.

Properties

PropertyTypeDescription
categoriesstring[]Unique category labels, in display order.
xLabel?stringOptional horizontal-axis label, up to 50 characters.
yLabel?stringOptional vertical-axis label, up to 50 characters.

barChart()

barChart(series, axis, settings?): SlackObject<"bar">

Creates a grouped bar chart.

Parameters

ParameterTypeDescription
seriesJsonObject[]One to 12 uniquely named data series.
axisJsonObjectAxis configuration whose categories match every series.
settingsFactorySettingsPer-call validation settings.

Returns

SlackObject<"bar">

A validated Slack bar chart object.

Throws

InvalidUsageError when series and axis categories do not match.


chartSegment()

chartSegment(input, settings?): JsonObject

Creates one labelled segment for a pie chart.

Input fields

Segment label and positive value.

Input fieldTypeDescription
labelstringSegment label, up to 20 characters.
valuenumberPositive finite segment value.

Settings

SettingTypeDescription
settingsFactorySettingsPer-call validation settings.

Returns

JsonObject

A validated chart-segment object.

Throws

InvalidUsageError when the label or value violates chart constraints.


ChartSegmentInput

Fields accepted by chartSegment.

Properties

PropertyTypeDescription
labelstringSegment label, up to 20 characters.
valuenumberPositive finite segment value.

columnSettings()

columnSettings(input, settings?): JsonObject

Creates display settings for one table column.

Input fields

Horizontal alignment and optional wrapping behavior.

Input fieldTypeDescription
align?"left" | "center" | "right"Horizontal cell alignment.
isWrapped?booleanWhether long cell content wraps.

Settings

SettingTypeDescription
settingsFactorySettingsPer-call validation settings.

Returns

JsonObject

A Slack table column-settings object.


confirmation()

confirmation(input, settings?): JsonObject

Creates a confirmation dialog for an interactive element.

Input fields

Dialog title, question, and button labels.

Input fieldTypeDescription
confirmTextLikePlain-text confirm-button label, up to 30 characters.
denyTextLikePlain-text cancel-button label, up to 30 characters.
textTextLikeConfirmation question, up to 300 characters.
titleTextLikePlain-text dialog title, up to 100 characters.

Settings

SettingTypeDescription
settingsFactorySettingsPer-call validation settings.

Returns

JsonObject

A validated Slack confirmation object.

Throws

InvalidUsageError when a text field exceeds Slack's limit.


ConfirmationInput

Fields accepted by confirmation.

Properties

PropertyTypeDescription
confirmTextLikePlain-text confirm-button label, up to 30 characters.
denyTextLikePlain-text cancel-button label, up to 30 characters.
textTextLikeConfirmation question, up to 300 characters.
titleTextLikePlain-text dialog title, up to 100 characters.

conversationFilter()

conversationFilter(input, settings?): JsonObject

Creates filters for a conversation select menu.

Input fields

Conversation types and optional exclusions. At least one field is required.

Input fieldTypeDescription
excludeBotUsers?booleanExclude direct messages with bots.
excludeExternalSharedChannels?booleanExclude externally shared conversations.
include?string[]Conversation kinds to include, such as im, mpim, private, or public.

Settings

SettingTypeDescription
settingsFactorySettingsPer-call validation settings.

Returns

JsonObject

A validated Slack conversation-filter object.

Throws

MissingRequiredError when no filter field is supplied.


dataPoint()

dataPoint(input, settings?): JsonObject

Creates one labelled data point for an axis-based chart.

Input fields

Category label and finite value.

Input fieldTypeDescription
labelstringCategory label, up to 20 characters.
valuenumberFinite numeric value.

Settings

SettingTypeDescription
settingsFactorySettingsPer-call validation settings.

Returns

JsonObject

A validated data-point object.

Throws

InvalidUsageError when the label or value violates chart constraints.


DataPointInput

Fields accepted by dataPoint.

Properties

PropertyTypeDescription
labelstringCategory label, up to 20 characters.
valuenumberFinite numeric value.

dataSeries()

dataSeries(input, settings?): JsonObject

Creates one named series for an axis-based chart.

Input fields

Series name and ordered data points.

Input fieldTypeDescription
dataJsonObject[]Between one and 20 points created with dataPoint.
namestringUnique series name, up to 20 characters.

Settings

SettingTypeDescription
settingsFactorySettingsPer-call validation settings.

Returns

JsonObject

A validated chart-series object.

Throws

InvalidUsageError when the name or point count violates chart constraints.


DataSeriesInput

Fields accepted by dataSeries.

Properties

PropertyTypeDescription
dataJsonObject[]Between one and 20 points created with dataPoint.
namestringUnique series name, up to 20 characters.

dispatchActionConfiguration()

dispatchActionConfiguration(input, settings?): JsonObject

Creates a dispatch-action configuration for an input element.

Input fields

Interaction events that should dispatch immediately.

Input fieldTypeDescription
triggerActionsOnstring[]Events such as on_enter_pressed or on_character_entered.

Settings

SettingTypeDescription
settingsFactorySettingsPer-call validation settings.

Returns

JsonObject

A Slack dispatch-action configuration object.


inputParameter()

inputParameter(input, settings?): JsonObject

Creates a customizable workflow input parameter.

Input fields

Workflow parameter name and value.

Input fieldTypeDescription
namestringWorkflow parameter name.
valuestringValue passed to the workflow.

Settings

SettingTypeDescription
settingsFactorySettingsPer-call validation settings.

Returns

JsonObject

A Slack workflow input-parameter object.


lineChart()

lineChart(series, axis, settings?): SlackObject<"line">

Creates a line chart.

Parameters

ParameterTypeDescription
seriesJsonObject[]One to 12 uniquely named data series.
axisJsonObjectAxis configuration whose categories match every series.
settingsFactorySettingsPer-call validation settings.

Returns

SlackObject<"line">

A validated Slack line chart object.

Throws

InvalidUsageError when series and axis categories do not match.


MarkdownOptions

Optional behavior for mrkdwn.

Properties

PropertyTypeDescription
verbatim?booleanWhether Slack should treat the text literally instead of auto-parsing links and mentions.

mrkdwn()

mrkdwn(text, options?, settings?): TextObject

Creates a Slack mrkdwn composition object.

Input fields

Optional parsing behavior.

Input fieldTypeDescription
verbatim?booleanWhether Slack should treat the text literally instead of auto-parsing links and mentions.

Settings

SettingTypeDescription
textstringSlack mrkdwn content.
settingsFactorySettingsPer-call validation settings.

Returns

TextObject

A validated Slack mrkdwn object.

Throws

InvalidUsageError when the text violates Slack's length constraints.


option()

option(input, settings?): JsonObject

Creates one option for a select, checkbox, radio, or overflow element.

Input fields

Option label, value, and optional description or URL.

Input fieldTypeDescription
description?TextLikeOptional plain-text supporting copy, up to 75 characters.
textTextLikePlain-text option label, up to 75 characters.
url?stringOptional destination URL for overflow menus.
valuestringApplication-defined value, up to 150 characters.

Settings

SettingTypeDescription
settingsFactorySettingsPer-call validation settings.

Returns

JsonObject

A validated Slack option object.

Throws

InvalidUsageError when text or values exceed Slack's limits.


optionGroup()

optionGroup(input, settings?): JsonObject

Creates a labelled group of options for a static select menu.

Input fields

Group label and option list.

Input fieldTypeDescription
labelTextLikePlain-text group label, up to 75 characters.
optionsJsonObject[]Between one and 100 option objects.

Settings

SettingTypeDescription
settingsFactorySettingsPer-call validation settings.

Returns

JsonObject

A validated Slack option-group object.

Throws

InvalidUsageError when the label or option count violates Slack's limits.


OptionGroupInput

Fields accepted by optionGroup.

Properties

PropertyTypeDescription
labelTextLikePlain-text group label, up to 75 characters.
optionsJsonObject[]Between one and 100 option objects.

OptionInput

Fields accepted by option.

Properties

PropertyTypeDescription
description?TextLikeOptional plain-text supporting copy, up to 75 characters.
textTextLikePlain-text option label, up to 75 characters.
url?stringOptional destination URL for overflow menus.
valuestringApplication-defined value, up to 150 characters.

pieChart()

pieChart(segments, settings?): SlackObject<"pie">

Creates a pie chart.

Parameters

ParameterTypeDescription
segmentsJsonObject[]One to 12 segments created with chartSegment.
settingsFactorySettingsPer-call validation settings.

Returns

SlackObject<"pie">

A validated Slack pie chart object.

Throws

InvalidUsageError when segment data violates Slack's chart constraints.


plainText()

plainText(text, options?, settings?): TextObject

Creates a plain-text composition object.

Input fields

Optional emoji behavior.

Input fieldTypeDescription
emoji?booleanWhether Slack should render emoji shortcodes.

Settings

SettingTypeDescription
textstringText content.
settingsFactorySettingsPer-call validation settings.

Returns

TextObject

A validated Slack plain_text object.

Throws

InvalidUsageError when the text violates Slack's length constraints.


PlainTextOptions

Optional behavior for plainText.

Properties

PropertyTypeDescription
emoji?booleanWhether Slack should render emoji shortcodes.

rawNumber()

rawNumber(value, text, settings?): SlackObject<"raw_number">

Creates a sortable numeric cell for a data table.

Parameters

ParameterTypeDescription
valuenumberFinite number used for sorting.
textstringHuman-readable cell text.
settingsFactorySettingsPer-call validation settings.

Returns

SlackObject<"raw_number">

A validated Slack raw_number object.

Throws

TypeMismatchError when value is not finite.


rawText()

rawText(text, settings?): SlackObject<"raw_text">

Creates an unformatted text cell for a table or data table.

Parameters

ParameterTypeDescription
textstringCell content.
settingsFactorySettingsPer-call validation settings.

Returns

SlackObject<"raw_text">

A validated Slack raw_text object.

Throws

InvalidUsageError when the cell text violates Slack's constraints.


slackFile()

slackFile(input, settings?): JsonObject

Creates a Slack-hosted image reference.

Input fields

Exactly one Slack file ID or Slack file URL.

Input fieldTypeDescription
id?stringSlack file identifier.
url?stringSlack-hosted file URL.

Settings

SettingTypeDescription
settingsFactorySettingsPer-call validation settings.

Returns

JsonObject

A validated Slack file-reference object.

Throws

InvalidUsageError when both or neither source is supplied.


slackIcon()

slackIcon(name, settings?): SlackObject<"icon">

Creates a Slack-provided icon for a card.

Parameters

ParameterTypeDescription
nameSlackIconNameOne of Slack's supported icon names.
settingsFactorySettingsPer-call validation settings.

Returns

SlackObject<"icon">

A validated Slack icon object.

Throws

TypeMismatchError when the icon name is unsupported at runtime.


SlackIconName

SlackIconName = "archive" | "book" | "bookmark" | "bot" | "bug" | "calendar" | "call" | "caret-left" | "caret-right" | "check" | "clipboard" | "code" | "comment" | "compass" | "copy" | "cube" | "download" | "edit" | "email" | "eye-closed" | "eye-open" | "file" | "flag" | "folder" | "gear" | "globe" | "heart" | "help" | "image" | "info" | "key" | "lightbulb" | "link" | "map" | "mobile" | "new-window" | "pin" | "plus" | "refine" | "refresh" | "rocket" | "save" | "screen" | "share" | "sparkle" | "star" | "star-filled" | "tag" | "thumbs-down" | "thumbs-up" | "trash" | "upload" | "user" | "warning"

Slack-provided icon name accepted by slackIcon.


TextLike

TextLike = string | TextObject

Text accepted by factories: a string or an existing Slack text object.


TextObject

TextObject = SlackObject<"plain_text" | "mrkdwn">

A Slack plain-text or mrkdwn composition object.


trigger()

trigger(input, settings?): JsonObject

Creates a workflow trigger definition.

Input fields

Trigger URL and optional customizable parameters.

Input fieldTypeDescription
customizableInputParameters?JsonObject[]Optional parameters created with inputParameter.
urlstringSlack workflow trigger URL.

Settings

SettingTypeDescription
settingsFactorySettingsPer-call validation settings.

Returns

JsonObject

A Slack workflow-trigger object.


workflow()

workflow(input, settings?): JsonObject

Wraps a trigger for use by a workflow button.

Input fields

Workflow trigger object.

Input fieldTypeDescription
triggerJsonObjectTrigger created with trigger.

Settings

SettingTypeDescription
settingsFactorySettingsPer-call validation settings.

Returns

JsonObject

A Slack workflow object.