Metadata-Version: 2.4
Name: django-model-webhooks
Version: 0.1.0
Summary: A plug-and-play Django app for sending outgoing webhooks on model changes
Project-URL: Repository, https://github.com/amarquaye/django-model-webhooks
Project-URL: Documentation, https://django-webhook.readthedocs.io/en/latest/
Author-email: Jesse Amarquaye <engineeramarquaye@gmail.com>
License-Expression: MIT
License-File: AUTHORS
License-File: LICENSE
Keywords: api,django,drf,event,events,http,microservices,model,signal,signals,webhook,webhooks
Classifier: Development Status :: 3 - Alpha
Classifier: Framework :: Celery
Classifier: Framework :: Django
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: System :: Distributed Computing
Classifier: Topic :: Utilities
Requires-Python: >=3.12
Requires-Dist: celery==5.*
Requires-Dist: django-model-utils==4.*
Requires-Dist: django>=6.0
Requires-Dist: requests==2.*
Description-Content-Type: text/markdown

# Django Model Webhooks 

[![Python](https://img.shields.io/badge/Python-3776AB?style=for-the-badge&logo=python&logoColor=white)](https://www.python.org/)
[![Badge](https://img.shields.io/badge/python-3.x-color.svg)](https://www.python.org/downloads/)
[![PyPI](https://img.shields.io/pypi/v/django-model-webhooks.svg)](https://pypi.org/project/django-model-webhooks/)
[![Downloads](https://static.pepy.tech/badge/django-model-webhooks)](https://pepy.tech/project/django-model-webhooks)
[![GitHub](https://img.shields.io/badge/GitHub-100000?style=for-the-badge&logo=github&logoColor=white)](https://github.com/amarquaye/django-model-webhooks)

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

> **Note:** This is a maintained fork of [danihodovic/django-webhook](https://github.com/danihodovic/django-webhook),
> originally created by [Dani Hodovic](https://github.com/danihodovic). The upstream project has been
> inactive since 2024 with unmerged fixes; this fork continues active maintenance, bug fixes, and
> improvements under the same MIT license. See [Credits](#credits) below.

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

Suppose we have a User model
```python
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-model-webhooks
will send an outgoing HTTP request to a third party:
```bash
POST HTTP/1.1
host: webhook.site
user-agent: python-urllib3/2.0.3
django-model-webhooks-uuid: 5e2ee3ba-905e-4360-94bf-18ef21c0e844
django-model-webhooks-signature-v1:
django-model-webhooks-request-timestamp: 1697818014
{
  "topic": "users.User/create",
  "object": {
    "id": 3,
    "name": "Jesse Amarquaye",
    "age": 30
    },
  "object_type": "users.User",
  "webhook_uuid": "5e2ee3ba-905e-4360-94bf-18ef21c0e844"
}
```

### 🔥 Features
- Automatically sends webhooks on model changes
- Leverages Celery for processing
- Webhook authentication using HMAC
- Retries with exponential backoff
- Admin integration
- Audit log with past webhook events
- Protection from replay attacks
- Allows rotating webhook secrets

### 📖 Documentation

https://django-webhook.readthedocs.io

### Credits

This project began as [django-webhook](https://github.com/danihodovic/django-webhook) by
[Dani Hodovic](https://github.com/danihodovic) and other upstream contributors. All credit for the
original design and implementation goes to them. This fork exists to keep the project maintained,
patched, and available on PyPI under active development.

<a href="https://github.com/danihodovic/django-webhook/graphs/contributors">
  <img src="https://contrib.rocks/image?repo=danihodovic/django-webhook" />
</a>

Made with [contrib.rocks](https://contrib.rocks).

### Disclaimer

Django model webhooks is provided as-is and does not require frequent updates. While it remains functional
and usable, future updates will be made only if necessary. If you find the project useful but notice
a lack of recent activity, this does not mean it is abandoned. Contributions are welcome via pull
requests.