A collection of simple, pre-configured Slack block kit components to use to construct Slack notification messages.
This package is available for installation via PyPi:
uv add ca-slack-block-kit
poetry add ca-slack-block-kit
pip install ca-slack-block-kit
To form a Slack message, import the required components from the package and use them to build your message payload as a list of Block instances.
from ca_slack_block_kit import Block, Divider, Header, MarkdownSection, render_blocks
message: list[Block] = []
message.append(Header("This is a header"))
message.append(Divider())
message.append(MarkdownSection("**This is a markdown section**"))
# The message can then be sent using the Slack SDK
client = slack_sdk.WebClient(token=slack_bot_token)
client.chat_postMessage(
channel=<slack_channel_id>,
text=<title_text>,
blocks=render_blocks(message),
)See the full documentation for a list of available blocks and their usage.