{"id":5723,"library":"slackclient","title":"Slack Client (Legacy Package)","description":"The `slackclient` library is the legacy Python client for the Slack Web API and RTM API. Version 2.9.4 is the last release, and the project is officially deprecated. Users are strongly advised to migrate to the `slack-sdk` package, which is the actively maintained and officially supported Slack Python SDK. While `slackclient` v2.x shared similar import paths with `slack-sdk` (e.g., `from slack import WebClient`), the `slack-sdk` project has continued development and introduced new features and improvements.","status":"deprecated","version":"2.9.4","language":"en","source_language":"en","source_url":"https://github.com/slackapi/python-slack-sdk","tags":["slack","api","web api","rtm api","chat","messaging","deprecated"],"install":[{"cmd":"pip install slackclient","lang":"bash","label":"Install `slackclient` (Legacy)"},{"cmd":"pip install slack-sdk","lang":"bash","label":"Install `slack-sdk` (Recommended)"}],"dependencies":[],"imports":[{"symbol":"WebClient","correct":"from slack import WebClient"},{"symbol":"RTMClient","correct":"from slack.rtm import RTMClient"},{"note":"The `SlackClient` class was for `slackclient` v1.x. For v2.x and `slack-sdk`, use `WebClient`.","wrong":"from slackclient import SlackClient","symbol":"SlackClient","correct":"from slack_sdk import WebClient"}],"quickstart":{"code":"import os\nfrom slack import WebClient\n\n# This quickstart is for the legacy `slackclient` v2.x.\n# It is highly recommended to use `slack-sdk` instead.\n\n# Get a Slack bot token from environment variable\nSLACK_BOT_TOKEN = os.environ.get('SLACK_BOT_TOKEN', 'xoxb-YOUR-TOKEN')\n\nif not SLACK_BOT_TOKEN:\n    print(\"Error: SLACK_BOT_TOKEN environment variable not set.\")\n    exit(1)\n\nclient = WebClient(token=SLACK_BOT_TOKEN)\n\ntry:\n    # Call the chat.postMessage method using the WebClient\n    response = client.chat_postMessage(\n        channel=\"#general\", # Replace with your channel ID or name\n        text=\"Hello from `slackclient` (legacy)! Please consider using `slack-sdk` instead.\"\n    )\n    print(f\"Message sent: {response['ts']}\")\nexcept Exception as e:\n    print(f\"Error sending message: {e}\")","lang":"python","description":"This example demonstrates how to send a message to a Slack channel using the `WebClient` from the `slackclient` library (v2.x). Ensure you have a Slack bot token (`SLACK_BOT_TOKEN`) set as an environment variable or hardcoded for testing. This pattern is similar to `slack-sdk`, but future compatibility and new features are only available in `slack-sdk`."},"warnings":[{"fix":"Uninstall `slackclient` (`pip uninstall slackclient`) and install `slack-sdk` (`pip install slack-sdk`). Update your import statements and code to use `slack_sdk` if you were relying on implicit `slackclient` features.","message":"The `slackclient` Python package is deprecated. Its last version is 2.9.4. All new development and maintenance occurs in the `slack-sdk` package. You should migrate to `slack-sdk` for active support and new features.","severity":"deprecated","affected_versions":"2.x"},{"fix":"Refactor your code to use `WebClient` and `RTMClient` (now part of `slack-sdk`) and adapt to the new method signatures and argument requirements, especially around token handling and API call patterns.","message":"Major API changes occurred between `slackclient` v1.x and v2.x. The `SlackClient` class was removed, and the `WebClient` and `RTMClient` classes were introduced with different constructor arguments and method signatures. This change also introduced the new `from slack import ...` import paths.","severity":"breaking","affected_versions":">1.x, <=2.x"},{"fix":"Always explicitly install and use `slack-sdk` (`pip install slack-sdk`) to ensure you're on the actively maintained version. Verify your installed packages with `pip freeze | grep slack`.","message":"Confusion often arises because `slackclient` v2.x introduced imports like `from slack import WebClient`, which are identical to `slack-sdk`. However, `slackclient` is a distinct (and now deprecated) package from `slack-sdk`. Installing `slackclient` will NOT give you the latest `slack-sdk` features or fixes.","severity":"gotcha","affected_versions":"2.x"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}