flyteplugins-slack
Receive Slack webhooks in Flyte.
pip install "flyteplugins-slack[app]"
Using it
Hand a SlackProvider() to a WebhookAppEnvironment and register handlers with the
typed constants in events:
import flyte
from flyte.extras.webhooks import WebhookAppEnvironment, run_once
from flyteplugins.slack import SlackProvider, events
# SlackProvider.default_secret_env is mounted for you.
app_env = WebhookAppEnvironment(name="slack-webhooks", providers=[SlackProvider()])
@app_env.on_event(events.AppMention.ANY)
async def handle(event):
import flyte.remote as remote
task = remote.Task.get(name="my-env.my_task", auto_version="latest")
result = await run_once.aio(task, key=event.dedupe_key(), resource=event.resource_id)
if not result.created:
return {"skipped": result.run.name, "url": result.run.url}
return {"run": result.run.name}
flyte.serve(app_env)
Handlers must await run_once.aio(...). The blocking form stalls the
app's event loop, and Slack times deliveries out in seconds.
One app can serve several products at once — hand it one provider per product.
Try it
examples/slack_webhooks.py runs two ways. The first needs no Slack account:
python examples/slack_webhooks.py --local # replay a real sample delivery in-process
python examples/slack_webhooks.py # deploy the receiver to Flyte
--local posts this plugin's SAMPLE_DELIVERY through the app with FastAPI's
test client, so you see a delivery verified, normalized, and dispatched — plus
an unsigned one refused with a 401, and the same delivery replayed to show the
dedupe key is stable.
Setup
- Store the secret and mount it on the app:
flyte create secret SLACK_SIGNING_SECRET --value <secret>
- Point Slack at
<app-url>/webhook/slack, from api.slack.com/apps → Event Subscriptions, then subscribe to bot events.
Slack POSTs a url_verification challenge before events flow; it is echoed automatically, so the Request URL field verifies itself.
Verification: HMAC-SHA256 over v0:{timestamp}:{body}, with a five-minute replay window (X-Slack-Signature).
Messages are keyed per message, so each one launches its own run. To collapse a whole thread onto one run, pass event.payload["event"]["thread_ts"] as your own key.
Event constants
events spells every event this plugin can dispatch, as str enums grouped by
event type, so a typo fails at import rather than by silently never matching.
Raw strings still work, for events the constants do not cover yet.
What this plugin does not do
Call the Slack API. Use slack_sdk directly from your tasks — see
examples/external_saas_integrations. This plugin owns only the part that is
Flyte's: authenticating an inbound delivery and turning it into a run.
Release files for flyteplugins-slack 2.7.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| flyteplugins_slack-2.7.0-py3-none-any.whl | Python 3 | none | any | Details |
Release files / flyteplugins_slack-2.7.0-py3-none-any.whl
| Download URL | flyteplugins_slack-2.7.0-py3-none-any.whl |
|---|---|
| Size | 6.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
81b1e580aee730eb397a7959fb3c748813a6630e5e63f64a6db0a96f16679980
|
|
BLAKE2b-256 checksum How to use checksums |
c05436343fd6aa38ff632ed03ac543a1c3a407340e17b2268774e44a419575bd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.15
|