Welcome to slackblocks
!
slackblocks
is Python package for creating complex Slack messages
using the Slack BlockKit API.
It exists so you don't have to define block-based Slack messages by hand-writing JSON.
Components
The Slack BlockKit API defines a number of different resource types (all defined in JSON) which work together to define Block-based messages.
slackblocks
makes using this API easier by providing a hierarchy of Python
classes that represent these resources.
Objects
Objects
(e.g. Text
)
are the lowest level pimitives that are used to populate
Elements
and Blocks
.
Elements
Elements
are typically interactive UI elements that take
in Object
to define their content. For example, the
CheckboxGroup
element takes in one or
more Option
items and presents a
checkbox menu to the user with those options.
Blocks
Blocks
are the core element of the API, with different
Blocks
used to create different types of visual
elements. For example, the DividerBlock
,
when rendered, will show a visual element similar to a <hr>
HTML element. The
RichTextBlock
on the other hand
allows for the display of text elements with visual styling like italics,
block quotes, lists and code blocks.
Messages
Messages
are a convenience wrapper around Blocks
that
can be unpacked as arguments straight into the official Slack Python SDK (or
its legacy slackclient
counterpart).
Views
Views
are an alternative usage for Blocks
that allow for the creation of custom UI "surfaces" within Slack, e.g. for
third-party apps.
Guides
In addition to a complete reference of all classes and functions provided by the
slackblocks
library, this documentation contains guides on: