Registry / communication / slacker

slacker

JSON →
library0.14.0pypypi✓ verified 84d ago

Slacker is a full-featured Python interface for the Slack API. The project is no longer actively maintained since July 2020, with version 0.14.0 being the last release. Users are advised to migrate to the official Slack Python SDK.

pip install slacker
INSTALL
IMPORT
SIG · SLACKER
S
slacker
communicationpythonv0.14.0
Install
3.0s avg
Import
569ms
Disk
20MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.14.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.920 runs
installs and imports cleanly · install 0.0s · import 0.599s · 22.6MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 3.0s · import 0.538s · 23MB
20MB installed
● package 20MB
Code
Verified usage

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

Slacker
from slacker import Slacker

This quickstart demonstrates how to initialize `Slacker` with an API token from an environment variable, test the API connection, and send a simple message to a Slack channel. It also includes an example of fetching user lists. Ensure you set the `SLACK_API_TOKEN` environment variable with your workspace token and optionally `SLACK_CHANNEL` for message posting.

import os from slacker import Slacker # Get your Slack API token from an environment variable slack_token = os.environ.get('SLACK_API_TOKEN', 'YOUR_SLACK_API_TOKEN') if not slack_token or slack_token == 'YOUR_SLACK_API_TOKEN': print("Error: SLACK_API_TOKEN environment variable not set or is default. Please set it.") else: try: slack = Slacker(slack_token) # Test API connection response = slack.api.test() if response.successful: print(f"Successfully connected to Slack API (Team: {slack.team.info().body['team']['name']}).") # Send a message to a channel (replace '#general' with your target channel) channel = os.environ.get('SLACK_CHANNEL', '#general') message = "Hello from Slacker! This library is no longer maintained, consider migrating to the official Slack SDK." post_response = slack.chat.post_message(channel, message) if post_response.successful: print(f"Message sent to {channel}.") else: print(f"Failed to send message: {post_response.error}") # Get users list example users_response = slack.users.list() if users_response.successful: print(f"Found {len(users_response.body['members'])} users.") else: print(f"Failed to retrieve users: {users_response.error}") else: print(f"Failed to connect to Slack API: {response.error}") except Exception as e: print(f"An error occurred: {e}")
Debug
Known issues
breakingThe `os/slacker` GitHub repository has been archived since July 2020, and the project is no longer actively maintained. No further updates or bug fixes will be provided.
fix
Migrate to Slack's official Python SDK (e.g., `slack_sdk`) for continued support and access to new Slack API features.
affects: 0.14.0 and older
breakingVersion 0.13.0 dropped support for Python 2.6. Future versions (though none are expected) would likely continue to drop older Python 2.x versions. [from release notes]
gotchaIn version 0.13.0, the `utils` module was renamed to `utilities`. Code importing `slacker.utils` will break. [from release notes]
fix
Update imports from `from slacker.utils import ...` to `from slacker.utilities import ...`.
affects: >=0.13.0
gotchaExposing API tokens directly in code is a security risk. Slack API tokens can be automatically revoked if exposed in public repositories.
fix
Always use environment variables (e.g., `os.environ.get('SLACK_API_TOKEN')`) or a secure configuration management system to store and access API tokens.
affects: All versions
gotchaDue to the library being unmaintained, it may not be compatible with newer Slack API features, changes in API endpoints, or updated security requirements from Slack. You might encounter unexpected errors or limitations with current Slack functionalities.
fix
Consider migrating to the official Slack Python SDK which is actively maintained and kept up-to-date with Slack's platform changes.
affects: 0.14.0 and older
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'slacker'
The 'slacker' library is not installed in the current Python environment.
fix
Run `pip install slacker` to install the library.
AttributeError: 'slacker.slacker.Slacker' object has no attribute 'chat'
The Slack API methods like 'chat' are accessed via sub-clients (e.g., `slack.chat`) and then the specific method (e.g., `slack.chat.post_message`), not directly on the `Slacker` object.
fix
Access the chat methods through the `chat` client: `response = slack.chat.post_message(channel='your_channel_id', text='Hello')`
{'ok': False, 'error': 'invalid_auth'}
The provided Slack API token is invalid, expired, revoked, or does not have the necessary permissions (scopes) for the requested operation.
fix
Verify that your Slack API token is correct, active, and has the required OAuth scopes for your application in the Slack API dashboard.
{'ok': False, 'error': 'channel_not_found'}
The specified Slack channel ID or name does not exist, or the bot/user associated with the token is not a member of that channel.
fix
Ensure the channel ID or name is correct and that your bot has been invited to or joined the target channel.
Upgrade
Version history
0.14.0latest on PyPI · released Feb 15, 2020
Audit
Dependencies

No dependency data recorded yet.

Agent activity
13 hits · last 30 days
node
12
OpenAI (training)
1
Resources