Registry / communication / pyslack

pyslack

JSON →
library0.5.0pypypi✓ verified 85d ago

pyslack is a Python API client for interacting with the Slack API. Last updated in September 2019 (version 0.5.0), it provides a synchronous interface for basic Slack operations. It has largely been superseded by the official and actively maintained `slack_sdk` library, which offers a broader feature set, asynchronous support, and better alignment with modern Slack API best practices.

pip install pyslack
INSTALL
IMPORT
SIG · PYSLACK
P
pyslack
communicationpythonv0.5.0
Install
1.5s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.5.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.9MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 1.5s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Slack
import slack
from slack import Slack

Initializes the `pyslack` client with a Slack API token and sends a basic message to a specified channel, then performs an authentication test. This requires a Slack API token (e.g., a legacy token or a bot token) and a channel ID. For new applications, `slack_sdk` is recommended due to its modern authentication and feature set.

import os from slack import Slack SLACK_API_TOKEN = os.environ.get('SLACK_API_TOKEN', 'YOUR_SLACK_API_TOKEN') # Ensure you replace 'YOUR_SLACK_API_TOKEN' with an actual legacy token or bot token # and 'CHANNEL_ID' with the ID of the channel you want to post to. # For modern Slack apps, consider using slack_sdk with Bot User OAuth Tokens. if not SLACK_API_TOKEN or SLACK_API_TOKEN == 'YOUR_SLACK_API_TOKEN': print("Error: SLACK_API_TOKEN environment variable not set or is default. Please set your Slack API token.") else: try: client = Slack(token=SLACK_API_TOKEN) # Example: Post a simple message to a channel response = client.chat_postMessage( channel='CHANNEL_ID', text='Hello from pyslack!' ) if response.get('ok'): print(f"Message sent successfully: {response.get('ts')}") else: print(f"Error sending message: {response.get('error')}") # Example: Get information about the authenticated user user_info = client.auth_test() if user_info.get('ok'): print(f"Authenticated as: {user_info.get('user')}") else: print(f"Auth test failed: {user_info.get('error')}") except Exception as e: print(f"An error occurred: {e}")
Debug
Known issues
breakingpyslack is no longer actively maintained since its last release (0.5.0) in September 2019. It does not support modern Slack API features, authentication methods (e.g., Socket Mode, granular permissions via Bolt), or asynchronous operations.
fix
Migrate to the official `slack_sdk` library, which is actively maintained and supports current Slack API features and best practices. (pip install slack_sdk)
affects: <=0.5.0
deprecatedThe library primarily relies on older Slack API token types. Modern Slack applications use Bot User OAuth Tokens and App-Level Tokens, often managed through the Slack Bolt framework, which `pyslack` does not natively support.
fix
For new development, use `slack_sdk` (and optionally `slack_bolt`) to ensure compatibility with current Slack authentication and app development paradigms.
affects: <=0.5.0
gotchaThe package is installed as `pyslack` but the module to import is `slack`. This can lead to `ModuleNotFoundError` if `from pyslack import Slack` is attempted.
fix
Always use `from slack import Slack` for importing the client class after installing `pyslack`.
affects: <=0.5.0
Upgrade
Version history
0.5.0latest on PyPI · released Sep 21, 2019
Audit
Dependencies

No dependency data recorded yet.

Agent activity
22 hits · last 30 days
node
20
OpenAI (training)
1
Resources
pyslack — pip install pyslack · libregistry