Slack SDK (Python)

3.41.0 · active · verified Tue Mar 17

Official Slack SDK for Python. Current version is 3.41.0 (Mar 2026). PyPI package is 'slack-sdk', imports as 'slack_sdk'. The predecessor 'slackclient' is in maintenance mode — vast amounts of tutorial code still references it. This is the official replacement.

Warnings

Install

Imports

Quickstart

Minimal message post and file upload using slack-sdk v3.x.

import os
from slack_sdk import WebClient
from slack_sdk.errors import SlackApiError

client = WebClient(token=os.environ['SLACK_BOT_TOKEN'])

try:
    response = client.chat_postMessage(
        channel='#general',
        text='Hello world!'
    )
except SlackApiError as e:
    print(f"Error: {e.response['error']}")

# File upload (v2 — required for new apps)
client.files_upload_v2(
    channel='C0123456789',
    file='./report.pdf',
    filename='report.pdf'
)

view raw JSON →