Models¶
Note
Nearly all classes here have slots defined which means that it is impossible to have dynamic attributes to the data classes.
BaseView¶
View UI blocks
BaseView¶
- class slack.view.BaseView¶
Base class of view object.
This class carries abstract methods for all components.
New in version 1.4.0.
Text¶
- class slack.view.Text¶
- An object containing some text, formatted either as plain_text or using mrkdwn,
our proprietary contribution to the much beloved Markdown standard.
- Parameters:
text (
str) – The text for the block. This field accepts any of the standard text formatting markup when type is mrkdwn. The minimum length is 1 and maximum length is 3000 characters.mrkdown (
bool) – The text is markdown or not.emoji (
bool) –When set to false (as is default) URLs will be auto-converted into links, conversation names will be link-ified, and certain mentions will be automatically parsed.
Using a value of true will skip any preprocessing of this nature, although you can still include manual parsing strings. This field is only usable when type is mrkdwn.
verbatim (
bool) – Indicates whether emojis in a text field should be escaped into the colon emoji format. This field is only usable when type is plain_text.
Examples
initial parameters
from slack import view text = view.Text("New text", emoji=True)
Confirm¶
- class slack.view.Confirm¶
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 a confirm and deny buttons.
- Parameters:
title (
str) – A plain_text-only text object that defines the dialog’s title. Maximum length for this field is 100 characters.field_text (
str) – A plain text-only text object that defines the explanatory text that appears in the confirm dialog. Maximum length for the text in this field is 300 characters.confirm_text (
str) – A plain_text-only text object to define the text of the button that confirms the action. Maximum length for the text in this field is 30 characters.deny_text (
str) – A plain_text-only text object to define the text of the button that cancels the action. Maximum length for the text in this field is 30 characters.
Enums¶
ElementType¶
- class slack.view.ElementType¶
An enumeration.
ViewFrame¶
This is a frame of UI block.
ViewFrame¶
- class slack.view.ViewFrame¶
This class is base class for all components.
This class carries abstract methods for all components.
New in version 1.4.0.
CheckBox¶
- class slack.view.CheckBox¶
A checkbox group that allows a user to choose multiple items from a list of possible options. Checkboxes are only supported in the following :resource:`app surfaces<slack:surfaces>`_ : Home tabs Modals Messages To use interactive components like this, you will need to make some changes to prepare your app. Read our guide to enabling interactivity.
- Parameters:
action_id (
str) – An identifier for the action triggered when the checkbox group is changed. You can use this when you receive an interaction payload to :resource:`identify the source of the action.<handling:payload>`_ Should be unique among all other action_ids in the containing block. Maximum length for this field is 255 characters.options (list[
Option]) – An array of option objects. A maximum of 10 options are allowed.initial_options (list[
Option]) – An array of option objects that exactly matches one or more of the options within options. These options will be selected when the checkbox group initially loads.confirm (
Confirm) –- A confirm object that defines an optional confirmation dialog that appears
after clicking one of the checkboxes in this element.
focus_on_load (
bool) – Indicates whether the element will be set to auto focus within the view object. Only one element can be set to true. Defaults to false.
Option¶
- class slack.view.Option¶
An object that represents a single selectable item in a select menu, multi-select menu, checkbox group, radio button group, or overflow menu.
- Parameters:
text (
Text) – A text object that defines the text shown in the option on the menu. Overflow, select, and multi-select menus can only use plain_text objects, while radio buttons and checkboxes can use mrkdwn text objects. Maximum length for the text in this field is 75 characters.value (
str) – A unique string value that will be passed to your app when this option is chosen. Maximum length for this field is 75 characters.description (
str) – A plain_text only text object that defines a line of descriptive text shown below the text field beside the radio button. Maximum length for the text object within this field is 75 characters.url (
str:) – A URL to load in the user’s browser when the option is clicked. The url attribute is only available in overflow menus. Maximum length for this field is 3000 characters. If you’re using url, you’ll still receive an interaction payload and will need to send an acknowledgement response.