Skip to main content

Opinionated, testable Python wrappers for Slack’s Web, Admin, and SCIM APIs, organized by object domain (users, conversations, messages, files, workspaces, and IdP groups). Designed for automation and administration workflows.

Project description

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
  • Discovery API is used for Users.get_channels and Conversations.get_members (requires appropriate token scopes)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

slack_objects-0.1.2.tar.gz (74.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

slack_objects-0.1.2-py3-none-any.whl (36.3 kB view details)

Uploaded Python 3

File details

Details for the file slack_objects-0.1.2.tar.gz.

File metadata

  • Download URL: slack_objects-0.1.2.tar.gz
  • Upload date:
  • Size: 74.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for slack_objects-0.1.2.tar.gz
Algorithm Hash digest
SHA256 7f38fbeaef98dc26164e39866fab04653c7939b3aa813207e489cf5b2de7d41e
MD5 6a486491ff2893711decaaa172ed6bc7
BLAKE2b-256 3d16490bcf422e5ecbb01baf1b969efc1a71e40a69975c63b04c2afd8a8adfcb

See more details on using hashes here.

Provenance

The following attestation bundles were made for slack_objects-0.1.2.tar.gz:

Publisher: publish-pypi.yml on mmercad0/slack-objects

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file slack_objects-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: slack_objects-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 36.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for slack_objects-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8dafc1acaca34811fa9a05b4c1e7594e0db1461719c46496a8c4b2a3382a197c
MD5 f80824c14d611b291f3ff8b187f64680
BLAKE2b-256 e4f7febba1a8b6c4f1438db2785d22585f16e3754cd126217d817b97c865f2cd

See more details on using hashes here.

Provenance

The following attestation bundles were made for slack_objects-0.1.2-py3-none-any.whl:

Publisher: publish-pypi.yml on mmercad0/slack-objects

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page