slackclient (Legacy Python Slack SDK)
The Latest SDK Go to GitHub

Important Notice

The slackclient PyPI project is in maintenance mode now and slack-sdk project is the successor. The v3 SDK provides more functionalities such as Socket Mode, OAuth flow module, SCIM API, Audit Logs API, better asyncio support, retry handlers, and many more.

Refer to the migration guide to learn how to smoothly migrate your existing code.


slackclient (Legacy Python Slack SDK)

Slack’s APIs allow anyone to build full featured integrations that extend and expand the capabilities of your Slack workspace. These APIs allow you to build applications that interact with Slack just like the people on your team – they can post messages, respond to events that happen – as well as build complex UIs for getting work done.

To make it easier for Python programmers to build Slack applications, we’ve provided this open source SDK. slackclient (Legacy Python Slack SDK) will let you get started building Python apps as quickly as possible. The current version, 2.0, is built for Python 3.6 and higher – if you need to target Python 2.x, you might consider using v1 of the SDK.

Slack Platform Basics

If you’re new to the Slack platform, we have a general purpose guide for building apps that isn’t specific to any language or framework. It’s a great place to learn all about the concepts that go into building a great Slack app.

Before you get started building on the Slack platform, you need to set up your app’s configuration. This is where you define things like your app’s permissions and the endpoints that Slack should use for interacting with the backend you will build with Python.

The app configuration page is also where you will acquire the OAuth token you will use to call Slack’s APIs. Treat this token with care, just like you would a password, because it has access to workspace and can potentially read and write data to and from it.

Installation

We recommend using PyPI to install slackclient (Legacy Python Slack SDK)

pip install slackclient

Of course, you can always pull the source code directly into your project:

git clone https://github.com/slackapi/python-slackclient.git

And then, save a few lines of code as ./test.py.

# test.py
import sys
# Load the local source directly
sys.path.insert(1, "./python-slackclient")
# Enable debug logging
import logging
logging.basicConfig(level=logging.DEBUG)
# Verify it works
from slack import WebClient
client = WebClient()
api_response = client.api_test()

You can run the code this way.

python test.py

It’s also good to try on the Python REPL.

Getting Help

If you get stuck, we’re here to help. The following are the best ways to get assistance working through your issue:

  • Use our Github Issue Tracker for reporting bugs or requesting features.

  • Visit the Slack Developer Community for getting help using slackclient (Legacy Python Slack SDK) or just generally bond with your fellow Slack developers.