Skip to main content

Quick Start

Install slackblocks and build your first valid Block Kit message. The language selector in the top navigation controls the instructions and examples on this page.

Install the package​

Python 3.10 or newer is required.

pip install slackblocks

Build a message​

from slackblocks import Message, SectionBlock

message = Message(
channel="C0123456",
text="Hello from slackblocks!",
blocks=[SectionBlock("Hello, world!")],
)

print(message.json())

Message validates the payload as it is constructed and renders it as Slack-compatible JSON. The text value is the plain-text fallback Slack uses for notifications and accessibility.

Where to go next​

slackblocks constructs the Block Kit content while the established Slack client handles delivery. Continue with Sending Messages for more client options, or explore Using Blocks to build richer layouts.

For package-manager alternatives and environment details, see Installation.

Send the message when your app is ready​

The examples above construct and print JSON without network access. To deliver it, follow Sending Messages: choose a client, configure a bot token with chat:write, select a channel ID the app can access, and ensure the bot has joined it where required. Check both transport failures and Slack’s ok/error response. For incoming webhooks use the app’s configured webhook URL; interactions and views have different request envelopes and lifecycle requirements.