Skip to main content

stapel-webhooks

The reaction layer. Your modules already emit facts — user.registered, listing.published, payment.completed — as schema-typed comm Actions riding a transactional outbox. This is the consumer side: a declarative "when X happens, deliver it to Y" that the app layer and external systems can both use.

comm Action (already there)
   │
   ▼  subscription registry + matcher
   ├─► webhook       HTTP POST, HMAC-signed, retried, dead-lettered
   ├─► notification  email/push/SMS via stapel-notifications
   ├─► ws            live frame on a realtime stream
   └─► custom        allowlisted dotted path in your app

Part of the Stapel framework.

Install

pip install stapel-webhooks
INSTALLED_APPS = [..., "stapel_webhooks"]

path("webhooks/", include("stapel_webhooks.urls"))   # -> /webhooks/api/v1/...

Then schedule the drain — with the default deferred dispatch, nothing is delivered until it runs:

from stapel_webhooks.tasks import get_webhooks_beat_schedule
CELERY_BEAT_SCHEDULE = {**get_webhooks_beat_schedule(), ...}

…or from cron: manage.py deliver_webhooks. (A system check tells you if you forget.)

Subscribe to something

POST /webhooks/api/v1/subscriptions
{
  "event_type": "listing.published",
  "delivery": "webhook",
  "target": {"url": "https://crm.example.com/hooks/stapel"},
  "filter": {"city": "berlin", "price": {"$gte": 500}}
}
→ 201 {"id": "3fa8…", "secret": "whsec_…"}

The secret is returned once, on creation (and again only on rotation) — like an API key.

What is subscribable

Not a list somebody maintains: every event any installed module ships a schema for, scanned out of schemas/emits/.

python manage.py webhooks_event_catalog

Install a module and its facts become subscribable. Uninstall it and they stop being offered. No release of this package either way.

What your receiver gets

X-Stapel-Delivery: 9aa1c0de-…      ← identical across retries; de-duplicate on it
X-Stapel-Event: listing.published
X-Stapel-Signature: t=1755993600,v1=6f1e…c3

{"id":"9aa1…","type":"listing.published","created_at":"…","data":{ … }}

Verify: HMAC-SHA256(secret, f"{t}.{raw_body}"), compared in constant time against the raw bytes — and refuse a t outside your tolerance window, which is the replay guard. In Python, stapel_webhooks.verify(secret, body, header) does it for you and accepts a list of secrets so rotation has an overlap.

When the receiver is down

Exponential backoff with a cap and jitter (8 attempts over ~2 h by default), then a dead letter — a row that keeps the payload and can be replayed from the API with the full ladder again. A 4xx that is not 408/425/429 skips the ladder entirely: eight identical refusals teach nobody anything. A rule that keeps dying deactivates itself and says so on the bus.

Closed by default

  • webhook targets must be https and must resolve to a public address — private, loopback, link-local and the cloud metadata endpoint are refused, with no second DNS lookup between check and connect;
  • delivery does not happen on your request thread;
  • the custom delivery type — a dotted path named by a database row — is unusable until you allowlist your handlers, and can be removed outright.

Each of those has a system check that reports it if you open it.

Documentation

  • MODULE.md — the integration contract: HTTP surface, comm surface, the delivery state machine, every extension point, and the known limitations.
  • CONFIG.MD — every setting, and the four that are decisions rather than tuning.

License

MIT

Metadata

Release files for stapel-webhooks 0.1.4

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

Source distribution (sdist)

Source distribution for stapel-webhooks 0.1.4
File Size Uploaded Provenance Actions
stapel_webhooks-0.1.4.tar.gz 101.9 kB With provenance Details for stapel_webhooks-0.1.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for stapel-webhooks 0.1.4
File Interpreter ABI Platform Actions
stapel_webhooks-0.1.4-py3-none-any.whl Python 3 none any Details for stapel_webhooks-0.1.4-py3-none-any.whl

Total release size: 186.9 kB

Release files / stapel_webhooks-0.1.4.tar.gz

Download URL stapel_webhooks-0.1.4.tar.gz
Size 101.9 kB
Tags Source
SHA-256 checksum
How to use checksums
5b11d46d3a3011a5d6f041f1594078b3f2621a45e627f851da2005a9aa36a6b0
BLAKE2b-256 checksum
How to use checksums
7da7ac383035eb7c50df87667ca0307f4db33a5363a16a23b808b7d270e047be
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 20, 2026.

Transparency log

Release files / stapel_webhooks-0.1.4-py3-none-any.whl

Download URL stapel_webhooks-0.1.4-py3-none-any.whl
Size 85.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d5555b02516895d2c686b72e50eb9db2467bd8e5b9a64c0a96ccc46881ebccf3
BLAKE2b-256 checksum
How to use checksums
fa94dcf0af68f5f073109aa383f820e33cade8624b4f6c0db14a516c272b5176
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 20, 2026.

Transparency log

Security for stapel-webhooks 0.1.4

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 stapel_webhooks-0.1.4.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 20, 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