Skip to main content

Objects

Confirm

Class

Confirm(*args, **kwargs)

Alias for ConfirmationDialogue to retain backwards compatibility.

See: ConfirmationDialogue.

ConfirmationDialogue

Class

ConfirmationDialogue(title: TextLike, text: TextLike, confirm: TextLike, deny: TextLike)

An object that defines a dialog that provides a confirmation step to any interactive element. This dialog will ask the user to confirm their action by offering confirm and deny buttons.

Arguments

ArgumentTypeDescription
titleTextLikethe text heading presented at the top of the dialogue box (max 100 chars).
textTextLikethe text explaining the decision being made by the user through
the dialogue box (max 300 chars).
confirmTextLikethe text inside the confirmation button of the dialogue box (max 30 chars).
denyTextLikethe text inside the deny button of the dialogue box (max 30 chars).

Errors

ErrorWhen
InvalidUsageErrorif any of the arguments fail to pass validation checks.

ConversationFilter

Class

ConversationFilter(include: Optional[Union[str, List[str]]] = None, exclude_external_shared_channels: Optional[bool] = None, exclude_bot_users: Optional[bool] = None)

Provides a way to filter the list of options in a conversations select menu or conversations multi-select menu.

See: https://api.slack.com/reference/block-kit/composition-objects#filter_conversations.

At least one of the available arguments must be provided.

Arguments

ArgumentTypeDescription
includeOptional[Union[str, List[str]]]Which types of conversations to include in the list.
One of more of im, mpim, private, public.
exclude_external_shared_channelsOptional[bool]whether to remove shared public channels
from the list. See https://api.slack.com/enterprise/shared-channels.
exclude_bot_usersOptional[bool]whether to remove bot users from the list of conversations.

Errors

ErrorWhen
InvalidUsageExceptionin the event that the user provides none of include,
exclude_external_shared_channels, or exclude_bot_users arguments.

DispatchActionConfiguration

Class

DispatchActionConfiguration(trigger_actions_on: Union[str, List[str]] = None)

Determines when a plain-text input element will return a block_actions interaction payload.

Arguments

ArgumentTypeDescription
trigger_actions_onUnion[str, List[str]]a list of strings representing interaction types that should return
a block_actions payload. One or both of on_enter_pressed, on_character_entered.

Errors

ErrorWhen
InvalidUsageErrorif an invalid value is provided amongst the options for
trigger_actions_on.

InputParameter

Class

InputParameter(name: str, value: str)

Contains information about an input parameter.

See https://api.slack.com/automation/workflows#defining-input-parameters.

Arguments

ArgumentTypeDescription
namestrthe name of the input parameter.
valuestrthe value associated with the input parameter.

Option

Class

Option(text: TextLike, value: str, description: Optional[TextLike] = None, url: Optional[str] = None)

An object that represents a single selectable item in a select menu, multi-select menu, checkbox group, radio button group, or overflow menu.

See https://api.slack.com/reference/block-kit/composition-objects#option.

Arguments

ArgumentTypeDescription
textTextLikethe text identifying the option (that the user will see).
valuestrthe underlying value of that option (not seen by the user).
descriptionOptional[TextLike]a more detailed explanation of what the option means (user-facing).
urlOptional[str]a URL to load in the user's browser when the option is clicked.
Only available in OverflowMenus.

Errors

ErrorWhen
InvalidUsageErrorwhen any of the provided arguments fail validation.

OptionGroup

Class

OptionGroup(label: TextLike, options: List[Option])

Provides a way to group options in a select menu or multi-select menu.

See https://api.slack.com/reference/block-kit/composition-objects#option_group.

Arguments

ArgumentTypeDescription
labelTextLikea label shown above the group of options.
optionsList[Option]a list of Option objects that will form the contents of the group (max 100).

Errors

ErrorWhen
InvalidUsageErrorif no options are provided or the label is not valid.

SlackFile

Class

SlackFile(url: Optional[str], id: Optional[str])

Defines an object containing Slack file information to be used in an image block or image element.

This file must be an image and you must provide either the URL or ID (not both).

See: https://api.slack.com/reference/block-kit/composition-objects#slack_file.

Arguments

ArgumentTypeDescription
urlOptional[str]the URL can be the url_private or the permalink of the Slack file
(only one of url or id can be provided).
idOptional[str]the Slack ID of the file
(only one of url or id can be provided).

Errors

ErrorWhen
InvalidUsageErrorif both url and id are provided

Text

Class

Text(text: str, type_: TextType = TextType.MARKDOWN, emoji: bool = False, verbatim: bool = False)

An object containing some text, formatted either as plain_text or using Slack's mrkdwn.

Arguments

ArgumentTypeDescription
textstrthe text to be rendered in a message (max 3000 characters).
type_TextTypeeither TextType.MARKDOWN or TextType.PLAINTEXT.
emojiboolonly usable with TextType.PLAINTEXT, if True: emoji will be
escaped into text format (e.g. :smile:).
verbatimboolonly usable with TextType.MARKDOWN, if True: links, channel
names, user names will not automatically be rendered as links.

Errors

ErrorWhen
InvalidUsageExceptionif the provided text fails validation.

to_text staticmethod

to_text(text: Optional[Union[str, Text]], force_plaintext: bool = False, max_length: Optional[int] = None, allow_none: bool = False) -> Optional[Text]

Coerces str or Text objects into Text objects.

Arguments

ArgumentTypeDescription
textOptional[Union[str, Text]]the str or Text object to ensure is in Text format.
force_plaintextboolif True, forces the str or Text object
into a Text object with the type TextType.PLAINTEXT.
max_lengthOptional[int]text will be checked against this length in addition
to the standard Text limit of 3000 characters.
allow_noneboolwhether to accept None as a valid value for text.

TextType

Class

Allowable types for Slack Text objects.

MARKDOWN: tradional markdown formatting, see https://api.slack.com/reference/surfaces/formatting#basic-formatting PLAINTEXT: simple Unicode text with no formatting (e.g. bold) features.

N.B: some usages of Text objects only allow the PLAINTEXT variety.

Trigger

Class

Trigger(url: str, customizable_input_parameters: Optional[Union[InputParameter, List[InputParameter]]])

Contains information about a trigger.

See: https://api.slack.com/automation/triggers.

Arguments

ArgumentTypeDescription
urlstra link trigger URL, see
https://api.slack.com/automation/triggers/link
customizable_input_parametersOptional[Union[InputParameter, List[InputParameter]]]a list of InputParameter objects
which map to those parameters defined on the Workflow in
which they are provided.

Errors

ErrorWhen
InvalidUsageErrorwhen any of the items in
customizable_input_parameters is not a valid InputParameter.

Workflow

Class

Workflow(trigger: Trigger)

Contains information about a workflow.

See https://api.slack.com/automation/workflows.

Arguments

ArgumentTypeDescription
triggerTriggera Trigger object that will initiate the workflow.