Slack Blocks#

class SlackLabelValueListBlock(*entries: SlackLabelValuePair, **kwargs)[source]#

Bases: SlackMessageMarkdown

A Slack message label/value list block

Parameters:

*entries – any SlackLabelValuePair entries

add_entry(entry: SlackLabelValuePair) None[source]#

Add an entry to the list.

render() list[source]#

Render the block to JSON.

class SlackLabelValuePair(label: str = '', value: str = '', label_url: str = '', value_url: str = '')[source]#

Bases: object

A label/value pair

Parameters:
  • label – the label

  • value – the value

  • label_url – the label URL

  • value_url – the value URL

render() str[source]#

Render the label/value pair to Markdown.

class SlackMessageBlock(*blocks)[source]#

Bases: object

A Slack message block

Parameters:

*blocks – any child blocks

render() list[source]#

Render the block to JSON.

class SlackMessageContext(*elements: SlackElementType, **kwargs)[source]#

Bases: SlackMessageBlock

A Slack message context

Parameters:

*elements – any SlackElementType elements

add_element(element: SlackElementType) None[source]#

Add an element to the context.

render() list[source]#

Render the context to JSON.

class SlackMessageDivider(*blocks)[source]#

Bases: SlackMessageBlock

A Slack message divider

render() list[source]#

Render the divider to JSON.

class SlackMessageHeader(*args, text: str = '', emoji: bool = True, **kwargs)[source]#

Bases: SlackMessageBlock

A Slack message header

Parameters:
  • text – the header text

  • emoji – whether to allow emojis

render() list[source]#

Render the header to JSON.

class SlackMessageMarkdown(*args, text: str = '', image_url: str = '', alt_text: str = '', **kwargs)[source]#

Bases: SlackMessageBlock

A Slack message markdown

Parameters:
  • text – the markdown text

  • image_url – the image URL

  • alt_text – the alternative text

render() list[source]#

Render the markdown to JSON.

class SlackMessageValueBlock(*args, label: str = '', value: str = '', secondary_label: str = '', secondary_value: str = '', **kwargs)[source]#

Bases: SlackMessageBlock

A Slack message value block

Parameters:
  • label – the label

  • value – the value

  • secondary_label – the secondary label

  • secondary_value – the secondary value

render() list[source]#

Render the block to JSON.