Skip to main content

slack-objects

A focused Python package for working with Slack objects commonly used in administration and automation workflows.

slack-objects provides opinionated, testable wrappers around the Slack Web API, Admin API, SCIM API, and Discovery API—favoring object-based access over raw endpoint calls.


Supported Slack Objects

The following Slack object types are supported:

  • Users
  • Conversations (e.g, channels)
  • Messages
  • Files
  • Workspaces
  • IDP Groups (SCIM - e.g., Okta groups)

Overview

slack-objects is designed for:

  • Slack administration automation
  • Identity and access management (IAM) workflows
  • Internal tooling and bots
  • Auditing and cleanup scripts

This package is not a replacement for slack_sdk. Instead, it focuses on higher-level object operations that typically require:

  • multiple API calls
  • pagination
  • rate limiting
  • Admin API, SCIM, or Discovery API usage
  • non-trivial orchestration logic

Design Highlights

Factory-based API

All object helpers are created from a single entry point:

from slack_objects import SlackObjectsClient, SlackObjectsConfig

cfg = SlackObjectsConfig(
    bot_token="xoxb-...",
    user_token="xoxp-...",
    scim_token="xoxp-...",
    # see SlackObjectsConfig for additional options (team_id, scim_base_url, http_timeout_seconds, etc.)
)

slack = SlackObjectsClient(cfg)

users = slack.users()       # unbound
alice = slack.users("U123") # bound to user_id

conversations = slack.conversations()
conversations = slack.conversations("C123") # bound to channel_id

files = slack.files("F123") # bound to file_id

msgs = slack.messages(channel_id="C123", ts="...")  # bound to message

ws = slack.workspaces("T123")   # bound to workspace_id

idp = slack.idp_groups("S123")  # bound to group_id

This avoids global state while keeping usage concise and consistent.


Explicit token model

Slack APIs have different authorization requirements. This package keeps tokens explicit and separate:

Token Used for
bot_token Slack Web API (most read/write operations)
user_token Slack Admin API
scim_token Slack SCIM API (IdP / provisioning)

Tokens are optional in configuration, but required by methods that need them. Errors are raised at call time with clear messages.


Strict method boundaries

Each object follows a consistent internal structure:

public method
    → wrapper method
        → SlackApiCaller / SCIM request

Keyword-only APIs

Methods with multiple optional parameters use keyword-only arguments to avoid ambiguity and future breaking changes.


Testability

The codebase is designed to be tested without hitting Slack.


Installation

Requires Python 3.9+.

pip install slack-objects

Configuration

from slack_objects import SlackObjectsClient, SlackObjectsConfig, RateTier

cfg = SlackObjectsConfig(
    bot_token="xoxb-...",
    user_token="xoxp-...",
    scim_token="xoxp-...",
    team_id="T0123ABC",                 # workspace ID; required for org-wide tokens calling workspace-scoped Web APIs
    default_rate_tier=RateTier.TIER_2,  # fallback sleep between API calls when no specific tier matches (default)
)

Testing

Run unit tests:

python -m pytest tests/UnitTests -v --tb=short

Run all smoke tests:

python -m tests.Smoke.run_all_smoke

Rate Limiting

All Slack Web/Admin API calls go through SlackApiCaller, which:

  • Sleeps according to the resolved rate tier after every successful call
  • Automatically retries on HTTP 429 (rate-limited) responses up to 5 times, respecting the Retry-After header

Rate tiers are resolved in priority order: explicit per-call tier → method-specific override → prefix rule → default_rate_tier from config.


Notes

  • SCIM v2 is the default; v1 is supported where applicable
  • PC_Utils is a required dependency (used for datetime handling in set_guest_expiration_date)
  • This package is intended for automation and administration workflows
  • resolve_user_id accepts flexible identifiers (user ID, email, or @username) and verifies existence via Web API + SCIM fallback
  • is_user_authorized supports IdP-group-based authorization checks with configurable read/write access levels
  • SCIM user operations are available on Users: create, deactivate, reactivate, update attributes, update email, and convert to multi-channel guest
  • SCIM group operations are available on IDP_groups: list groups, get a group and its members, check membership, and remove selected members. get_group() (and so members, get_members(), and is_member()) raises RuntimeError when Slack returns an incomplete or malformed member list, rather than returning a short list that would make users look like non-members. remove_members(["U111", "U222"]) sends a targeted PATCH (v1 or v2) that leaves other members and group fields untouched. It accepts a non-empty list of up to 5,000 unique user IDs (Slack's recommended SCIM batch size), raises on HTTP errors, and returns a ScimResponse whose ok callers must check. It changes the group in Slack only, not in Entra/Okta, so upstream provisioning may restore members
  • Discovery API is used for Users.get_channels and Conversations.get_members (requires appropriate token scopes)
  • Users.get_channels(include_channels_user_left=True) and Conversations.get_members(include_members_who_left=True) opt into historical data; both default to False so the common case makes fewer paginated calls

Metadata

Release files for slack-objects 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for slack-objects 0.4.0
File Size Uploaded Provenance Actions
slack_objects-0.4.0.tar.gz 85.2 kB With provenance Details for slack_objects-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for slack-objects 0.4.0
File Interpreter ABI Platform Actions
slack_objects-0.4.0-py3-none-any.whl Python 3 none any Details for slack_objects-0.4.0-py3-none-any.whl

Total release size: 125.5 kB

Release files / slack_objects-0.4.0.tar.gz

Download URL slack_objects-0.4.0.tar.gz
Size 85.2 kB
Tags Source
SHA-256 checksum
How to use checksums
1619e4b19ad792ff22be9c1fdb2dda4f101d546259190d4da3a6944d9f0614da
BLAKE2b-256 checksum
How to use checksums
8186bb14d5542eaeb4ab8f611acc20b547b3fd3d46b9aa8f02bfba3040b6c665
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.

Transparency log

Release files / slack_objects-0.4.0-py3-none-any.whl

Download URL slack_objects-0.4.0-py3-none-any.whl
Size 40.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4f503fb298793c0284f4af004a888a88d9df75267d2db37695099dff94a12acc
BLAKE2b-256 checksum
How to use checksums
1634d26efa35cf92b0d40ab80f22d5ee6f665653bddccd973be19a3bac9c8a50
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.

Transparency log

Security for slack-objects 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for slack_objects-0.4.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page