Skip to main content

Views

HomeTabView

Class

HomeTabView(blocks: 'Block | list[Block]', private_metadata: 'str | None' = None, callback_id: 'str | None' = None, external_id: 'str | None' = None) -> 'None'

HomeTabViews are used with the views.publish Web API method.

See: https://api.slack.com/reference/surfaces/views#home.

Arguments

ArgumentTypeDescription
blocksBlock | list[Block]A list of blocks that defines the content of the view (max 100).
private_metadatastr | Nonea string (max 3000 chars) that will be sent to your app
in view_submission.
callback_idstr | NoneA string that will identify submissions of this view.
external_idstr | NoneA custom identifier that is unique within the views of a
given Slack team.

to_dict

to_dict() -> 'dict[str, Any]'

No public documentation is available.

ModalView

Class

ModalView(title: 'TextLike', blocks: 'Block | list[Block]', close: 'TextLike | None' = None, submit: 'TextLike | None' = None, private_metadata: 'str | None' = None, callback_id: 'str | None' = None, clear_on_close: 'bool | None' = False, notify_on_close: 'bool | None' = False, external_id: 'str | None' = None, submit_disabled: 'bool | None' = False) -> 'None'

Modal views are used with the views.open, views.update and views.push Slack Web API methods.

See: https://api.slack.com/reference/surfaces/views#modal

Arguments

ArgumentTypeDescription
titleTextLikeheading that appears at the top left of the view.
blocksBlock | list[Block]a list of blocks (max 100) that define the content of the view.
closeTextLike | Nonethe text of the close button (max 24 chars) in the view.
Must be Text.PLAINTEXT.
submitTextLike | Nonethe text of the submit button (max 24 chars) in the view.
Must be Text.PLAINTEXT.
private_metadatastr | Nonea string (max 3000 chars) that will be sent to your app
in view_submission.
callback_idstr | NoneA string that will identify submissions of this view.
clear_on_closebool | Nonewhen True all views in the model will be cleared when
it is closed.
notify_on_closebool | Nonewhen True a view_closed event will be sent when the
modal is closed.
external_idstr | NoneA custom identifier that is unique within the views of a
given Slack team.
submit_disabledbool | Nonewhen True disabled submitting the form until one or
more inputs have been provided. Used only for
configuaration models.

to_dict

to_dict() -> 'dict[str, Any]'

No public documentation is available.

View

Class

View(type: 'ViewType', blocks: 'Block | list[Block]', private_metadata: 'str | None' = None, callback_id: 'str | None' = None, external_id: 'str | None' = None) -> 'None'

Base class for Slack app surfaces -- the visual areas an app can populate with blocks. Concrete subclasses are ModalView (for pop-up modals) and HomeTabView (for the per-user App Home tab).

See: https://api.slack.com/reference/surfaces/views.

Arguments

ArgumentTypeDescription
typeViewTypeone of the ViewType enum members. Concrete subclasses set
this for you; in practice you should construct ModalView or
HomeTabView rather than View directly.
blocksBlock | list[Block]1-100 blocks that make up the contents of the view.
private_metadatastr | Nonea string (max 3000 characters) that will be sent
back to your app in any view-related interaction payloads.
Useful for stashing per-view server-side context.
callback_idstr | Nonean identifier (max 255 characters) for distinguishing
this view's submissions from other views your app exposes.
external_idstr | Nonea custom identifier that is unique within the views of
a given Slack team. Slack uses it to find views your app has
previously published.

Errors

ErrorWhen
InvalidUsageErrorif any of the validation checks fail.

to_dict

to_dict() -> 'dict[str, Any]'

No public documentation is available.