Metadata-Version: 2.4
Name: hubspot-webhook-model
Version: 0.1.0
Summary: HubSpot webhook message model
Project-URL: Repository, https://github.com/oeklo/hubspot-webhook-model
Project-URL: Issues, https://github.com/oeklo/hubspot-webhook-model
Author-email: Raphael Krupinski <oeklo.it@fastmail.com>
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Web Environment
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: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Internet
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Software Development
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.9
Requires-Dist: msgspec>=0.19.0
Description-Content-Type: text/markdown

# HubSpot web hooks message models

Models for messages that HubSpot sends as web hook calls to your integrations, written as [msgspec](https://jcristharif.com/msgspec/) models.

# Why

It's easier to operate on objects with parsed properties, and the models themselves are missing from [HubSpot client](https://pypi.org/project/hubspot-api-client/).

# How

Incoming messages are lists of events, each of which is either related to a single object or an association between objects.

Message can be parsed with the following code:

```python
import msgspec.json
from hubspot_webhook_model import Message

data: bytes # request body
model = msgspec.json.decode(data, type=Message)
```

Request signatures should be verified using the raw body

# Caveats

1. Messages contain events related to a single event, which can be user action or one of the internal HubSpot mechanisms. They are typically related to a single object, but not always.
2. Events in a message are not ordered. propertyChange enevts may appear before creation events.
3. The model only workds with the new style [generic webhook subscriptions](https://developers.hubspot.com/docs/guides/apps/public-apps/create-generic-webhook-subscriptions).
4. Only small subset of objects is included. Feel free to create Pull Requests with additional models as needed.
