--- id: slackblocks version: "2.1.0" license: MIT license_treatment: permissive maintenance: active --- # slackblocks — Python wrapper for the Slack Blocks API License: permissive · Maintenance: active · Downloads: 78.5K/mo ## What it is and what it does slackblocks is a typed Python wrapper around Slack's Block Kit API that lets you construct rich Slack messages, modals, and home tabs using concise Python objects instead of verbose JSON. It enforces validation at construction time—character limits, required fields, mutually-exclusive options, element-type restrictions—so errors surface before the API call, not after. The library ships with full type hints and zero runtime dependencies, making it lightweight and IDE-friendly. It integrates directly with official Slack SDKs via unpacking: `client.chat_postMessage(**message)` works without boilerplate. The package supports all current block types (including Alert, Card, Carousel, Container, Data Table, Plan, Task Card), elements (buttons, select menus, date/time pickers, checkboxes, radio groups, workflow buttons), composition objects, rich text, modals, views, and round-trip parsing of incoming Slack JSON back into objects. Use it for: - Build structured build-status notifications with fields, buttons, and dividers without writing JSON templates. - Generate approval-request modals with validation and interactive elements for workflow automation. - Construct data-driven Slack messages (e.g., incident alerts, report summaries) with type-safe field assembly. - Parse incoming Slack interaction payloads back into slackblocks objects for programmatic inspection and response. - Create reusable message templates as Python functions, leveraging type hints for IDE autocomplete and refactoring. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Builds Slack Block Kit messages programmatically in Python with type validation, eliminating hand-written JSON and reducing API errors before they reach Slack. Yes. Zero dependencies, active maintenance, permissive dual licensing, and no known vulnerabilities make it a safe choice. Install if you send structured Slack messages from Python and want to avoid JSON boilerplate and validation errors—the typed API and up-front validation pay off immediately. Requires Python 3.10 or newer. ## Install pip install slackblocks uv add slackblocks poetry add slackblocks ## Installing slackblocks Before you install: Installs with zero runtime dependencies as a pure-Python wheel. Active maintenance with a release on 2026-08-14 and 75 repository stars. License in practice: Dual-licensed under MIT and BSD-3-Clause, permitting use in both permissive and copyleft projects; choose whichever fits your licensing requirements. Quickstart: pip install slackblocks from slackblocks import Message, HeaderBlock, SectionBlock, Button, ActionsBlock message = Message( channel="#general", text="Build passed", blocks=[ HeaderBlock("Build #482 passed :white_check_mark:"), SectionBlock(fields=["*Branch*\n`main`", "*Author*\n@nick"]), ActionsBlock(elements=[Button(text="View", url="https://example.com")]) ] ) Requires Python 3.10 or newer; Python 3.8/3.9 users must pin to the 1.x line. Verify before relying: - Whether the package's round-trip parsing (Block.from_dict) handles all current Slack API responses without data loss. - Performance characteristics when building large messages with hundreds of blocks or elements. - Compatibility with Slack API changes after the 2026-08-14 release date. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 78.5K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags slack message builder python, block kit wrapper, slack blocks api, typed slack messages, slack json generator, slack message validation, slack message construction, slack-integration, message-generation, type-safe [View on SkillFed](https://skillfed.io/packages/slackblocks) · [View on PyPI](https://pypi.org/project/slackblocks/)