Skip to main content

Slack Python connector

Install with pip install dex-connector-slack==0.5.0.

This package exposes Dex Query Steps for Slack channel pages, the connected workspace identity, channel history pages, thread pages, and replies, plus durable Mutation Steps for posting channel messages, thread replies, and messages with Block Kit buttons. From 0.5.0 it also implements the channelThreadCreated, threadReplyCreated, and buttonClicked Triggers at parity with the Go connector. It uses the static ConnectionName configured in Dex Web. OAuth credentials are resolved at call time; the generated project connection refreshes rotating bot and user tokens through the manifest declaration.

For real Slack use, create a Slack app in Your Apps, configure OAuth, Socket Mode, Event Subscriptions, and, for buttons, Interactivity as described in the connector guide, then connect it in Dex Web.

Every Query Step checks the HTTP status before decoding the body: HTTP 429 and 5xx return Retry and honor Retry-After, even when Slack sends no JSON body. From 0.4.1 this includes thread pages and replies.

Operations

  • new_list_channel_messages_step reads one newest-first page of a channel's top-level messages with the bot token: page_size 1 through 15 (0 reads 15), optional oldest_timestamp and latest_timestamp Slack timestamps, is_inclusive, and the previous page's next_cursor as cursor. The channel history example runs it.
  • new_post_button_message_step posts a top-level message or thread reply whose text section is followed by 1 through 25 MessageButtons, each with a unique action_id, a label, an optional value, and BUTTON_STYLE_PRIMARY, BUTTON_STYLE_DANGER, or no style. validate_post_button_message_input returns the VALIDATION failure the operation selects as defect before sending. A button value reaches every member who can see the message, so never put a secret in it.

Both replay the Go-recorded provider scenarios in tests/test_conformance.py.

Triggers

Slack sends each Socket Mode event to only one of an app's open connections, so give every Trigger route of a connection to one MessageTriggerRunner. new_project_message_trigger_runner(project, connection_name, ...) opens the connection and its stored bindings and wraps each route's target in the binding's durable project inbox, which every replica shares; ProjectChannelThreadCreatedTriggerRoute, ProjectThreadReplyCreatedTriggerRoute, and ProjectButtonClickedTriggerRoute name each stored binding and its target. examples/thread_approval/receiver.py builds one with a Flow-start target and an RPC target.

run replays the inboxes, roots first, then replies, then clicks, and then:

  • with an app_token in the credential, opens Socket Mode through apps.connections.open, records each matching envelope in its inboxes before acknowledging it, and delivers acknowledged events in arrival order, so a retrying Dex target does not delay later acknowledgements. Slack's pings extend a 45-second read timeout; a requested disconnect reconnects after one second and failures back off from one second up to 30 seconds. Before each reconnect it replays the inboxes again, so a reply cannot overtake its root;
  • without one, on a shared connection, serves the Events API callbacks the host relays at relayed_trigger_path(connection_name), which is /triggers/slack/ and the unpadded base64url connection name, and registers that route with the host at /internal/slack-triggers/register, retrying while the host is unavailable. The runner is an ASGI 3 application for that route, and handle_request serves other hosts: 200 once every matching inbox recorded the event, 400 without a valid Dex-Relay-Signature or for an invalid body, 413 over 1 MiB, 405 for another method, and 503 while the runner does not receive relayed events. A host relays only Events API messages, so a relayed runner with button routes raises ValueError, as it does when the connection is not shared or the host does not relay its events.

buttonClicked receives block_actions payloads through Socket Mode only. A click is acknowledged before delivery, within Slack's three seconds, so new_message_trigger_runner requires every route's target, message routes included, to come from new_durable_trigger_target, and the runner of new_button_clicked_trigger always raises; the project runner supplies durable inboxes. A click's event ID joins the team, channel, message timestamp, action ID, and action timestamp; its ButtonClickEvent carries IDs and the button's value, never Slack's response URL, trigger ID, or verification token.

new_channel_thread_created_trigger and new_thread_reply_created_trigger each open their own Socket Mode connection and deliver inline; prefer one runner per connection. The configuration validators raise ValueError for a blank channel, blank or repeated member IDs, and a reply matcher without a poster, as Go does.

SlackTriggerOptions sets the Trigger logger, a Socket Mode dialer, the reconnect and read timings, and the 256-envelope delivery queue. The logger receives slack socket mode connected (INFO), slack socket mode disconnected; reconnecting (INFO), slack socket mode connection failed; reconnecting (WARN), trigger event ignored (DEBUG, with the reason), trigger event skipped: undecodable (WARN), slack relayed trigger registered (INFO), slack relayed trigger registration failed; retrying (WARN), slack relayed request refused (DEBUG for a bad signature), and slack trigger credentials unavailable; retrying (WARN), plus the SDK's delivery records. Records carry IDs and Slack enum values only, never message text, tokens, or the Socket Mode URL. Durable inbox records use the Go connector's event and payload field names, so a Go, TypeScript, or Python process of the same project can replay them.

Examples

Verification

uv sync --locked
uv run ruff check .
uv run mypy --strict src
uv run pytest tests
DEX_FLOW_SERVICE_ADDRESS=127.0.0.1:8801 uv run pytest examples/thread_approval/integration_test.py examples/button_approval/integration_test.py examples/channel_messages/integration_test.py examples/thread_messages/integration_test.py

The integration tests need a running dexcli dev and use local stand-ins for Slack's Socket Mode, the Slack Web API, and a host's relay and credential broker. Live Slack authorization, Socket Mode delivery, Interactivity, and host relay delivery are unverified.

Metadata

Release files for dex-connector-slack 0.5.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 dex-connector-slack 0.5.0
File Size Uploaded Provenance Actions
dex_connector_slack-0.5.0.tar.gz 157.8 kB Without provenance Details for dex_connector_slack-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dex-connector-slack 0.5.0
File Interpreter ABI Platform Actions
dex_connector_slack-0.5.0-py3-none-any.whl Python 3 none any Details for dex_connector_slack-0.5.0-py3-none-any.whl

Total release size: 223.5 kB

Release files / dex_connector_slack-0.5.0.tar.gz

Download URL dex_connector_slack-0.5.0.tar.gz
Size 157.8 kB
Tags Source
SHA-256 checksum
How to use checksums
e29cede77b7ddd8a616f433ffe9e5a01a60850d6ca97d36f5823c0033ac7cc97
BLAKE2b-256 checksum
How to use checksums
f6d95ed36ba068b560f4c754d58078b33e869e00f58fecb1ff58aadf6d947606
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / dex_connector_slack-0.5.0-py3-none-any.whl

Download URL dex_connector_slack-0.5.0-py3-none-any.whl
Size 65.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
26a78333f5b3cb194c8733d30b2d5ffad39551d03e0944ef908881f3011d8600
BLAKE2b-256 checksum
How to use checksums
5d9441df444c681224464dd33143dfae6ac53cd302ed5b92f25e3e6f67bfefc4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for dex-connector-slack 0.5.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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