{"id":93,"library":"slack-sdk","title":"Slack SDK (Python)","description":"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.","status":"active","version":"3.41.0","language":"python","source_language":"en","source_url":"https://github.com/slackapi/python-slack-sdk","tags":["slack","messaging","chat","api","bot","webhook","python"],"install":[{"cmd":"pip install slack-sdk","lang":"bash","label":"Python (current — official)"},{"cmd":"pip install slackclient","lang":"bash","label":"Python (deprecated — do not use for new projects)"}],"dependencies":[{"reason":"Required for AsyncWebClient and AsyncWebhookClient. Not auto-installed by slack-sdk v3+. Must be added explicitly.","package":"aiohttp","optional":true}],"imports":[{"note":"Package installs as slack-sdk but imports as slack_sdk. 'from slack import WebClient' is the old slackclient v2 pattern — raises AttributeError: module 'slack' has no attribute 'WebClient' if slack-sdk is installed instead.","wrong":"from slack import WebClient","symbol":"WebClient","correct":"from slack_sdk import WebClient"},{"note":"Same package rename issue. Error class moved to slack_sdk.errors in v3.","wrong":"from slack.errors import SlackApiError","symbol":"SlackApiError","correct":"from slack_sdk.errors import SlackApiError"}],"quickstart":{"code":"import os\nfrom slack_sdk import WebClient\nfrom slack_sdk.errors import SlackApiError\n\nclient = WebClient(token=os.environ['SLACK_BOT_TOKEN'])\n\ntry:\n    response = client.chat_postMessage(\n        channel='#general',\n        text='Hello world!'\n    )\nexcept SlackApiError as e:\n    print(f\"Error: {e.response['error']}\")\n\n# File upload (v2 — required for new apps)\nclient.files_upload_v2(\n    channel='C0123456789',\n    file='./report.pdf',\n    filename='report.pdf'\n)","lang":"python","description":"Minimal message post and file upload using slack-sdk v3.x."},"warnings":[{"fix":"pip uninstall slackclient && pip install slack-sdk. Update imports from 'from slack import' to 'from slack_sdk import'.","message":"slackclient (pip install slackclient) is in maintenance mode. slack-sdk (pip install slack-sdk) is the official successor. They have different import paths: slack vs slack_sdk.","severity":"breaking","affected_versions":"slackclient all"},{"fix":"Use client.files_upload_v2() instead. Parameter change: channels= renamed to channel_id=, no longer accepts multiple channels or channel names.","message":"files.upload API is retired (Nov 12, 2025). New apps blocked from it since May 2024. Calling client.files_upload() on new apps returns method_deprecated error.","severity":"breaking","affected_versions":"all"},{"fix":"client.files_upload_v2(channel_id='C0123456789', file=filepath)","message":"files_upload_v2 channel parameter is channel_id= (not channels= plural). Passing channels= silently fails or is ignored.","severity":"breaking","affected_versions":"all"},{"fix":"Add aiohttp to requirements.txt explicitly when using async clients.","message":"aiohttp is no longer a required dependency in slack-sdk v3. AsyncWebClient and AsyncWebhookClient will raise ImportError if aiohttp is not explicitly installed.","severity":"breaking","affected_versions":">= 3.0"},{"fix":"Replace WebClient(token=..., run_async=True) with AsyncWebClient(token=...)","message":"WebClient.run_async option removed in v3. Use AsyncWebClient for async operations instead of the v2 run_async=True flag.","severity":"gotcha","affected_versions":">= 3.0"},{"fix":"Do not assume file is available in channel immediately after upload response.","message":"files_upload_v2 is asynchronous on the Slack server side. Even after a successful response, the file may not immediately appear in channel. Polling files.info or using Events API is required for post-upload processing.","severity":"gotcha","affected_versions":"all"},{"fix":"Use xoxb- bot tokens for standard bot operations. xapp- tokens are only for Socket Mode handshake.","message":"Token type matters: Bot tokens (xoxb-) for most operations, User tokens (xoxp-) for user-scoped actions, App-level tokens (xapp-) for Socket Mode only. Mixing them causes invalid_auth or missing_scope errors.","severity":"gotcha","affected_versions":"all"},{"fix":"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').","message":"KeyError: 'SLACK_BOT_TOKEN' occurs when the SLACK_BOT_TOKEN environment variable is not set. The Slack SDK's WebClient and AsyncWebClient require a token for authentication, typically provided via this environment variable.","severity":"breaking","affected_versions":"all"},{"fix":"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')`.","message":"The SLACK_BOT_TOKEN environment variable is not set. The WebClient constructor (and other client constructors) expects a token, either passed directly as an argument or available via the SLACK_BOT_TOKEN environment variable.","severity":"breaking","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-12T08:00:14.274Z","next_check":"2026-06-17T00:00:00.000Z","problems":[{"fix":"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.","cause":"You've installed `slack-sdk` but are using code or tutorials written for the deprecated `slackclient` library.","error":"ModuleNotFoundError: No module named 'slackclient'"},{"fix":"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.","cause":"The API call failed on the Slack server side, often due to an invalid token, missing permissions (scopes), or rate limiting.","error":"slack_sdk.errors.SlackApiError: The request to the Slack API failed."},{"fix":"Change the import statement to `from slack_sdk.web import WebClient`.","cause":"The `WebClient` class is located within the `slack_sdk.web` submodule, not directly under the top-level `slack_sdk` package.","error":"from slack_sdk import WebClient"},{"fix":"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.","cause":"The signature in the incoming Slack event request does not match the signature calculated by the SDK, usually due to an incorrect `SLACK_SIGNING_SECRET` or a modified request body.","error":"slack_sdk.errors.SlackRequestVerificationError: signature verification failed"}],"ecosystem":"pypi","meta_description":null,"install_score":100,"install_tag":"verified","quickstart_score":80,"quickstart_tag":"verified","pypi_latest":null,"install_checks":{"last_tested":"2026-05-12","tag":"verified","tag_description":"installs cleanly on critical runtimes, fast import, recently tested","results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.23,"mem_mb":8.1,"disk_size":"21.6M"},{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.16,"mem_mb":8.1,"disk_size":"22M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.39,"mem_mb":9.4,"disk_size":"24.2M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.35,"mem_mb":9.4,"disk_size":"25M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.59,"mem_mb":9.9,"disk_size":"15.9M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.54,"mem_mb":9.9,"disk_size":"16M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.58,"mem_mb":10.4,"disk_size":"15.5M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.54,"mem_mb":10.4,"disk_size":"16M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.21,"mem_mb":8.1,"disk_size":"21.2M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.19,"mem_mb":8.1,"disk_size":"22M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null}]},"quickstart_checks":{"last_tested":"2026-05-12","tag":"verified","tag_description":"quickstart runs on critical runtimes, recently tested","results":[{"runtime":"python:3.10-alpine","exit_code":0},{"runtime":"python:3.10-slim","exit_code":0},{"runtime":"python:3.11-alpine","exit_code":0},{"runtime":"python:3.11-slim","exit_code":0},{"runtime":"python:3.12-alpine","exit_code":0},{"runtime":"python:3.12-slim","exit_code":0},{"runtime":"python:3.13-alpine","exit_code":0},{"runtime":"python:3.13-slim","exit_code":0},{"runtime":"python:3.9-alpine","exit_code":0},{"runtime":"python:3.9-slim","exit_code":0}]}}