* fix: further remove extraneous transactions * fix: (search) use 2 phase function to reduce un-needed transaction * fix: refactor agent search to perform external operations before making a transaction * fix: reduce scope of queue manager transaction * fix: (bench) add concurrency to test bench * fix: address review findings for search dedup, webhook idempotency, and bench throttling * Fix Leakage in non-session-scoped chat call (#526) * fix: (search) reduce scope for peer based searches * fix: tests * fix: (test) address coderabbit comment * fix: drop db param from deliver_webhook --------- Co-authored-by: Rajat Ahuja <rahuja445@gmail.com> |
||
|---|---|---|
| .. | ||
| README.md | ||
| events.py | ||
| webhook_delivery.py | ||
README.md
Webhooks
Webhooks are used to deliver event notifications to user-configured URLs.
System Architecture
The webhooks system consists of several key components:
- API Endpoints (
routers/webhooks.py): Provides endpoints for users to create, list, delete, and test their webhook subscriptions. - Event Publishing (
webhooks/events.py): Defines the event types and allows us to publish new events to the processing queue. - Webhook Delivery (
webhooks/webhook_delivery.py): Contains the logic for sending the webhook to the subscriber's URL.
Event Flow
- An event is triggered within the application by calling
publish_webhook_eventwith a defined event payload. - This function creates a
QueueItemand stores it in the database. - The
QueueManagerbackground process polls the database for new items. - When a new event is found, it is passed to the
deliver_webhookfunction. deliver_webhookfetches all subscriber URLs for the event's workspace, signs the payload with a secret key, and sends an HTTP POST request to each URL.
Note that the webhooks require the deriver process to be running to facilitate the delivery of the webhook.