Skip to main content

Send outgoing webhooks on Django model changes, reliably.

Project description

Django Webhooks badge

A plug-and-play Django app for sending outgoing webhooks on model changes.

Published on PyPI as django-webhook2. This is a reliability-focused fork of django-webhook by Dani Hodovic. The Python import path is unchanged (django_webhook), so it remains a drop-in replacement — install with pip install django-webhook2.

Django has a built-in signal system which allows programmers to schedule functions to be executed on model changes. django-webhook leverages the signal system together with Celery to send HTTP requests when models change.

Suppose we have a User model

class User(models.Model):
    name = models.CharField(max_length=50)
    age = models.PositiveIntegerField()

If a webhook is configured, any time the above model is created, updated or deleted django-webhook will send an outgoing HTTP request to a third party:

POST HTTP/1.1
host: webhook.site
user-agent: python-urllib3/2.0.3
django-webhook-uuid: 5e2ee3ba-905e-4360-94bf-18ef21c0e844
django-webhook-signature-v1:
django-webhook-request-timestamp: 1697818014

{
  "event_id": "1b9d6bcd-bbfd-4b2d-9b5d-ab8dfbbd4bed",
  "occurred_at": "2023-10-20T18:06:54+00:00",
  "topic": "users.User/create",
  "object": {
    "id": 3,
    "name": "Dani Doo",
    "age": 30
  },
  "object_type": "users.User",
  "webhook_uuid": "5e2ee3ba-905e-4360-94bf-18ef21c0e844"
}

🔥 Features

  • Automatically sends webhooks on model changes
  • Dispatch only after the database transaction commits — a rollback never publishes
  • Event production is isolated from the writer: a serializer or broker error can never fail save()
  • Leverages Celery for processing
  • Webhook authentication using HMAC
  • Retries every failure mode (connection, timeout, error response) with exponential backoff
  • Configurable request timeout
  • Per-event id and occurrence time in the envelope for safe dedup/ordering
  • Manual re-send of recorded deliveries, from the admin or programmatically
  • Independent retention windows for succeeded and failed deliveries
  • Pluggable per-model payload serializers
  • Public emission API for set-based writes (QuerySet.update, bulk_create, bulk_update)
  • Admin integration (configurable admin site)
  • Audit log with past webhook events
  • Protection from replay attacks
  • Allows rotating webhook secrets

📖 Documentation

https://django-webhook2.readthedocs.io

Contributors

Made with contrib.rocks.

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

django_webhook2-0.9.0.tar.gz (23.7 kB view details)

Uploaded Source

Built Distribution

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

django_webhook2-0.9.0-py3-none-any.whl (33.1 kB view details)

Uploaded Python 3

File details

Details for the file django_webhook2-0.9.0.tar.gz.

File metadata

  • Download URL: django_webhook2-0.9.0.tar.gz
  • Upload date:
  • Size: 23.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for django_webhook2-0.9.0.tar.gz
Algorithm Hash digest
SHA256 49ba102cf8d0b608d1b4e02c272c901200e071efb0f006631fa9fce873143fbf
MD5 aece129de412db3ac3a64b8b6e309e7c
BLAKE2b-256 9d583f93caffe02a5fa62fa17e03be5687b540c2113384791f2d907f906b080f

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_webhook2-0.9.0.tar.gz:

Publisher: publish.yml on edi-monefy/django-webhook

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

File details

Details for the file django_webhook2-0.9.0-py3-none-any.whl.

File metadata

  • Download URL: django_webhook2-0.9.0-py3-none-any.whl
  • Upload date:
  • Size: 33.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for django_webhook2-0.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 36ac4c0b40d43d7e26994ad22b1b9938890cf223664e2465e744d96f1e8fbd40
MD5 49c28c612d0d22df2e6251bd62b967f6
BLAKE2b-256 98410252584e7a06007c2b7cbbea0b4abc752f93ee3078873d596c29ecb3d909

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_webhook2-0.9.0-py3-none-any.whl:

Publisher: publish.yml on edi-monefy/django-webhook

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