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
| Argument | Type | Description |
|---|---|---|
title | TextLike | the text heading presented at the top of the dialogue box (max 100 chars). |
text | TextLike | the text explaining the decision being made by the user through the dialogue box (max 300 chars). |
confirm | TextLike | the text inside the confirmation button of the dialogue box (max 30 chars). |
deny | TextLike | the text inside the deny button of the dialogue box (max 30 chars). |
Errors
| Error | When |
|---|---|
InvalidUsageError | if 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
| Argument | Type | Description |
|---|---|---|
include | Optional[Union[str, List[str]]] | Which types of conversations to include in the list. One of more of im, mpim, private, public. |
exclude_external_shared_channels | Optional[bool] | whether to remove shared public channels from the list. See https://api.slack.com/enterprise/shared-channels. |
exclude_bot_users | Optional[bool] | whether to remove bot users from the list of conversations. |
Errors
| Error | When |
|---|---|
InvalidUsageException | in 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
| Argument | Type | Description |
|---|---|---|
trigger_actions_on | Union[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
| Error | When |
|---|---|
InvalidUsageError | if an invalid value is provided amongst the options fortrigger_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
| Argument | Type | Description |
|---|---|---|
name | str | the name of the input parameter. |
value | str | the 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
| Argument | Type | Description |
|---|---|---|
text | TextLike | the text identifying the option (that the user will see). |
value | str | the underlying value of that option (not seen by the user). |
description | Optional[TextLike] | a more detailed explanation of what the option means (user-facing). |
url | Optional[str] | a URL to load in the user's browser when the option is clicked. Only available in OverflowMenus. |
Errors
| Error | When |
|---|---|
InvalidUsageError | when 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
| Argument | Type | Description |
|---|---|---|
label | TextLike | a label shown above the group of options. |
options | List[Option] | a list of Option objects that will form the contents of the group (max 100). |
Errors
| Error | When |
|---|---|
InvalidUsageError | if 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
| Argument | Type | Description |
|---|---|---|
url | Optional[str] | the URL can be the url_private or the permalink of the Slack file(only one of url or id can be provided). |
id | Optional[str] | the Slack ID of the file (only one of url or id can be provided). |
Errors
| Error | When |
|---|---|
InvalidUsageError | if 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
| Argument | Type | Description |
|---|---|---|
text | str | the text to be rendered in a message (max 3000 characters). |
type_ | TextType | either TextType.MARKDOWN or TextType.PLAINTEXT. |
emoji | bool | only usable with TextType.PLAINTEXT, if True: emoji will beescaped into text format (e.g. :smile:). |
verbatim | bool | only usable with TextType.MARKDOWN, if True: links, channelnames, user names will not automatically be rendered as links. |
Errors
| Error | When |
|---|---|
InvalidUsageException | if 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
| Argument | Type | Description |
|---|---|---|
text | Optional[Union[str, Text]] | the str or Text object to ensure is in Text format. |
force_plaintext | bool | if True, forces the str or Text objectinto a Text object with the type TextType.PLAINTEXT. |
max_length | Optional[int] | text will be checked against this length in additionto the standard Text limit of 3000 characters. |
allow_none | bool | whether 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
| Argument | Type | Description |
|---|---|---|
url | str | a link trigger URL, see https://api.slack.com/automation/triggers/link |
customizable_input_parameters | Optional[Union[InputParameter, List[InputParameter]]] | a list of InputParameter objectswhich map to those parameters defined on the Workflow in which they are provided. |
Errors
| Error | When |
|---|---|
InvalidUsageError | when any of the items incustomizable_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
| Argument | Type | Description |
|---|---|---|
trigger | Trigger | a Trigger object that will initiate the workflow. |