Installation
Choose Python or TypeScript from the site navigation. The selection applies across the documentation and is preserved as you move between pages.
Install the Python package from PyPI:
- pip
- Poetry
- Pipenv
- uv
pip install slackblocks
poetry add slackblocks
pipenv install slackblocks
uv add slackblocks
Python 2.x requires Python 3.10 or newer and has no runtime dependencies. See Compatibility for the support matrix and 1.x migration guidance.
Verify the installation:
from slackblocks import Message, SectionBlock
print(Message(channel="#general", blocks=SectionBlock("Hello, world!")).json())
Pin the current major release with slackblocks~=2.0, and uninstall with pip uninstall slackblocks (or the equivalent command for your package manager).
Install the ESM package from npm:
- pnpm
- npm
- Yarn
pnpm add @nicklambourne/slackblocks
npm install @nicklambourne/slackblocks
yarn add @nicklambourne/slackblocks
The package requires Node 20.19 or newer, is ESM-only, and emits no runtime imports beyond your own code.
Verify the installation in hello.mjs:
import { message, sectionBlock } from "@nicklambourne/slackblocks";
console.log(message({
channel: "C0123456",
blocks: [sectionBlock({ text: "Hello, world!" })],
}));
Run it with node hello.mjs. Stay on the 2.x release line with @nicklambourne/slackblocks@^2.1.0, and uninstall with pnpm remove @nicklambourne/slackblocks (or your package manager's equivalent).