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.
pip install slack-sdkVerified import paths — ran on the pinned version, not inferred.
Minimal message post and file upload using slack-sdk v3.x.
pip uninstall slackclient && pip install slack-sdk. Update imports from 'from slack import' to 'from slack_sdk import'.
Use client.files_upload_v2() instead. Parameter change: channels= renamed to channel_id=, no longer accepts multiple channels or channel names.
client.files_upload_v2(channel_id='C0123456789', file=filepath)
Add aiohttp to requirements.txt explicitly when using async clients.
Replace WebClient(token=..., run_async=True) with AsyncWebClient(token=...)
Do not assume file is available in channel immediately after upload response.
Use xoxb- bot tokens for standard bot operations. xapp- tokens are only for Socket Mode handshake.
Ensure the SLACK_BOT_TOKEN environment variable is set before running the application (e.g., export SLACK_BOT_TOKEN='xoxb-YOUR-TOKEN' in your shell or Dockerfile) or pass the token directly as a string to the client constructor: client = WebClient(token='xoxb-YOUR-TOKEN').
Ensure the SLACK_BOT_TOKEN environment variable is set in your environment before running the script, or pass the token explicitly to the client constructor, e.g., `WebClient(token='xoxb-YOUR-BOT-TOKEN')`.
Update your code to use `slack-sdk` classes and methods (e.g., `from slack_sdk.web import WebClient` instead of `from slackclient import WebClient`), or install `slackclient` if you must use legacy code.
Verify your bot token/user token is correct and has the necessary scopes for the API method being called. Check Slack API documentation for endpoint-specific requirements and review the `response` property for detailed error information.
Change the import statement to `from slack_sdk.web import WebClient`.
Ensure the `SLACK_SIGNING_SECRET` environment variable or configuration value exactly matches the 'Signing Secret' found in your Slack app's 'Basic Information' settings. Also, verify that no middleware is altering the raw request body before the SDK processes it.