SectionBlock

init

Creates an SectionBlock instance.

NameTypeRequiredDefaultDescription

No arguments

Return: The SectionBlock instance.

id

Sets a custom identifier for the SectionBlock instance.

NameTypeRequiredDefaultDescription

id

string

true

The custom identifier for the SectionBlock instance.

Return: The SectionBlock instance.

text

Sets the text for the SectionBlock instance.

NameTypeRequiredDefaultDescription

text

string

true

The text for the section. Maximum of 3000 characters.

Return: The SectionBlock instance.

field

Adds a text field to the SectionBlock instance.

NameTypeRequiredDefaultDescription

text

string

true

The text for the new text field. Maximum of 2000 characters.

Return: The TextObject added to the SectionBlock instance.

accessory

Sets the accessory for the SectionBlock instance.

NameTypeRequiredDefaultDescription

element

BlockKitElement

true

The Slack BlockKit element to set as the accessory for this SectionBlock instance.

Return: The SectionBlock instance.

getMemento

Converts the SectionBlock instance to a serializable format.

NameTypeRequiredDefaultDescription

No arguments

Return: (struct) A struct representing this SectionBlock instance.

{
    "type": "section",
    "text": {
        "type": "text",
        "text": "optional, either this or fields must be set"
    },
    "fields": [ ... ],
    "accessory": { ... },
    "block_id": "optional"
}

Last updated