How the webhook processing lifecycle works
mainThe package follows a specific sequence when a webhook request is received:
- Signature Verification: The package checks if the request signature is valid using the configured
signature_validator. If invalid, it throws an exception, fires anInvalidWebhookSignatureEvent, and discards the request (it is not stored). - Webhook Profile: The request is passed to a
WebhookProfile. This class determines if the specific request is interesting enough to be stored and processed. If it returnsfalse, processing stops. - Storage: If the profile allows it, the request is stored in the
webhook_callstable using aWebhookCallmodel. - Queued Processing: Once stored, the
WebhookCallmodel is passed to a queued job (defined byprocess_webhook_job). This allows for a fast HTTP response to the sender. If queueing fails, the exception is stored in theexceptionattribute of theWebhookCallmodel. - Webhook Response: Finally, a
WebhookResponseclass determines the HTTP response sent back to the sender (defaults to a200 OK).