Slack Block Kit (version v2.*.*)

A library for Slack's Block Kit provided by Transposit

checkboxes_input

Creates a checkboxes input block. Usable in (input_prompt) modals.

Parameters

field_name (required)

Name of the input field. Must be unique in this workflow.

Type: STRING

label (required)

A label that appears above an input element.

Type: STRING

options (required)

An array of options objects displayed as checkboxes. Each option should have the format: {"value": "retreivable value", "text": "dispalyed text"}

Type: ARRAY

hint

An optional hint that appears below an input element in a lighter grey.

Type: STRING

initial_options

An array of option objects that each exactly match one of the options within options. These options will be selected when the menu initially loads.

Type: ARRAY

optional

Indicates whether the input element may be empty when a user submits the modal. Defaults to false.

Type: BOOLEAN

context_block

Creates a context block that displays message context, which can include both images and text. Usable in messages and (input_prompt) modals.

Parameters

elements (required)

An array of image elements and text objects. Maximum number of items is 10.

Type: ARRAY

date_picker_input

Creates a date picker input block. Usable in (input_prompt) modals.

Parameters

field_name (required)

Name of the input field. Must be unique in this workflow.

Type: STRING

label (required)

A label that appears above an input element.

Type: STRING

hint

An optional hint that appears below an input element in a lighter grey.

Type: STRING

initial_date

The initial date that is selected when the element is loaded. This should be a string in the format YYYY-MM-DD.

Type: STRING

optional

Indicates whether the input element may be empty when a user submits the modal. Defaults to false.

Type: BOOLEAN

placeholder

The placeholder text shown in the plain-text input.

Type: STRING

divider

Returns a divider block.

Parameters

context

The 'context' parameter is often essential to operations published to Mission Control

Type: OBJECT

errors_object

Use when you want to create an error display in a modal. Return this from the execute operation.

Parameters

field_name (required)

Name of the field to associate the error with.

Type: STRING

message (required)

The error message to display. Text only.

Type: STRING

file_block

(Note: Remote file creation not implemented yet) Creates a file block that displays a remote file. Usable in messages.

Parameters

external_id (required)

The external unique ID for this file.

Type: STRING

image_block

Creates an image block that displays a linked image. Usable in messages and (input_prompt) modals.

Parameters

alt_text (required)

A plain-text summary of the image.

Type: STRING

image_url (required)

The URL of the image to be displayed.

Type: STRING

title

An optional title for the image

Type: STRING

image_element

Creates an image element that displays a linked image. This element can be added as a parameter to section or action blocks.

Parameters

alt_text (required)

A plain-text summary of the image.

Type: STRING

image_url (required)

The URL of the image to be displayed.

Type: STRING

input_block

For internal use in block_kit_lib. Creates an input block with an undefined element

Parameters

element (required)

An element usable in input modals

Type: OBJECT

field_name (required)

Type: STRING

label (required)

Type: STRING

hint

Type: STRING

optional

Type: BOOLEAN

Creates a button element that opens a link when pressed.

Parameters

text (required)

The button text

Type: STRING

url (required)

The external URL the button links to

Type: STRING

style

Decorates buttons with alternative visual color schemes. "primary" gives buttons a green outline and text, ideal for affirmation or confirmation actions. primary should only be used for one button within a set. "danger" gives buttons a red outline and text, and should be used when the action is destructive. Use danger even more sparingly than primary.

Type: STRING

markdown_text_object

An object containing some text, formatted as mrkdwn. Useful to populate context blocks or the fields of a section block.

Parameters

text (required)

The text to be displayed.

Type: STRING

verbatim

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.

Type: BOOLEAN

markdown_text_section

Creates a mrkdwn text section block that can optionally contain fields and an accessory element. Usable in messages and (input_prompt) modals.

Parameters

text (required)

Text to display. Markdown allowed.

Type: STRING

accessory

An element object (i.e. link_button_element, image_element)

Type: OBJECT

fields

An array of text_objects. Any text objects included with fields will be rendered in a compact format that allows for 2 columns of side-by-side text. Maximum number of items is 10.

Type: STRING

multi_static_select_input

Creates a multi static select input block. Usable in (input_prompt) modals.

Parameters

field_name (required)

Name of the input field. Must be unique in this workflow.

Type: STRING

label (required)

A label that appears above an input element.

Type: STRING

options (required)

An array of options objects displayed in the select menu. Each option should have the format: {"value": "retreivable value", "text": "dispalyed text"}

Type: ARRAY

hint

An optional hint that appears below an input element in a lighter grey.

Type: STRING

initial_options

An array of option objects that each exactly match one of the options within options. These options will be selected when the menu initially loads.

Type: ARRAY

max_selected_items

Specifies the maximum number of items that can be selected in the menu. Minimum number is 1.

Type: INTEGER

optional

Indicates whether the input element may be empty when a user submits the modal. Defaults to false.

Type: BOOLEAN

placeholder

The placeholder text shown on the menu.

Type: STRING

plain_text_object

An object containing some text, formatted as plain_text. Useful to populate context blocks or the fields of a section block.

Parameters

text (required)

The text to be displayed.

Type: STRING

emoji

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.

Type: BOOLEAN

plain_text_section

Creates a plain text section block that can optionally contain fields and an accessory element. Usable in messages and (input_prompt) modals.

Parameters

text (required)

The text to be displayed. Markdown not allowed.

Type: STRING

accessory

An element object (i.e. link_button_element, image_element)

Type: OBJECT

fields

An array of text_objects. Any text objects included with fields will be rendered in a compact format that allows for 2 columns of side-by-side text. Maximum number of items is 10.

Type: ARRAY

radio_buttons_input

Create a radio buttons input block. Usable in (input_prompt) modals.

Parameters

field_name (required)

Name of the input field. Must be unique in this workflow.

Type: STRING

label (required)

A label that appears above an input element.

Type: STRING

options (required)

An array of options objects displayed as radio buttons. Each option should have the format: {"value": "retreivable value", "text": "dispalyed text"}

Type: ARRAY

hint

An optional hint that appears below an input element in a lighter grey.

Type: STRING

initial_option

A single option object that exactly matches one of the options within options. This option will be selected when the menu initially loads.

Type: OBJECT

optional

Indicates whether the input element may be empty when a user submits the modal. Defaults to false.

Type: BOOLEAN

retrieve_all_option_values

Retrieves the values for all options that populated an input field. Should only be used in execute operations.

Parameters

context (required)

The MC context.

Type: OBJECT

field_name (required)

The field_name provided in the corresponding static_select call

Type: STRING

retrieve_input

Retrieves the value from an input field. Should only be used in execute operations.

Parameters

context (required)

The MC context.

Type: OBJECT

field_name (required)

The field_name provided in the corresponding static_select call

Type: STRING

default_value

A default value if no value was selected or one cannot be found.

Type: STRING

retrieve_input_as_boolean

Returns true if the input field contains a truthy value. Should only be used in execute operations.

Parameters

context (required)

The 'context' parameter is often essential to operations published to Mission Control

Type: OBJECT

field_name (required)

Type: STRING

section_block

Creates a section block that can optionally contain fields and an accessory element. Usable in messages and (input_prompt) modals.

Parameters

text (required)

The text object to be displayed.

Type: OBJECT

accessory

An element object (i.e. button_element, image_element)

Type: OBJECT

fields

An array of text objects. Any text objects included with fields will be rendered in a compact format that allows for 2 columns of side-by-side text. Maximum number of items is 10.

Type: ARRAY

static_select_input

Create a static select input block. Usable in (input_prompt) modals.

Parameters

field_name (required)

Name of the input field. Must be unique in this workflow.

Type: STRING

label (required)

A label that appears above an input element.

Type: STRING

options (required)

An array of options objects displayed in the select menu. Each option should have the format: {"value": "retreivable value", "text": "dispalyed text"}

Type: ARRAY

hint

An optional hint that appears below an input element in a lighter grey.

Type: STRING

initial_option

A single option object that exactly matches one of the options within options. This option will be selected when the menu initially loads.

Type: OBJECT

optional

Indicates whether the input element may be empty when a user submits the modal. Defaults to false.

Type: BOOLEAN

placeholder

The placeholder text shown on the menu.

Type: STRING

text_input

Creates a text input block. Usable in (input_prompt) modals.

Parameters

field_name (required)

Name of the input field. Must be unique in this workflow.

Type: STRING

label (required)

A label that appears above an input element.

Type: STRING

hint

An optional hint that appears below an input element in a lighter grey.

Type: STRING

initial_value

The initial value in the plain-text input when it is loaded. Defaults to blank.

Type: STRING

max_length

The maximum length of input that the user can provide. If the user provides more, they will receive an error.

Type: INTEGER

min_length

The minimum length of input that the user must provide. If the user provides less, they will receive an error.

Type: INTEGER

multiline

Indicates whether the input will be a single line (false) or a larger textarea (true). Defaults to false.

Type: BOOLEAN

optional

Indicates whether the input element may be empty when a user submits the modal. Defaults to false.

Type: BOOLEAN

placeholder

The placeholder text shown in the plain-text input.

Type: STRING

text_object

An object containing some text, formatted either as plain_text or using mrkdwn, a proprietary textual markup that's just different enough from Markdown to frustrate you

Parameters

text (required)

The text to be displayed.

Type: STRING

type (required)

The formatting to use for this text object. Can be one of plain_textor mrkdwn.

Type: STRING

emoji

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.

Type: BOOLEAN

verbatim

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.

Type: BOOLEAN

transposit_file_block

Create a Transposit file block from base64 encoded content.

Parameters

content (required)

base64 encoded content.

Type: STRING

content_type (required)

content MIME type. Plain text should use and specify utf-8 charset. Examples: "image/jpeg", "text/plain; charset=utf-8".

Type: STRING

transposit_text_file_block

Create a Transposit file block from plain-text content.

Parameters

text (required)

Plain text to be encoded and returned as a Transposit file block

Type: STRING