Skip to main content

parse_webhook_event

Function parse_webhook_event 

Source
pub fn parse_webhook_event(
    body: impl AsRef<[u8]>,
) -> Result<WebhookEventPayload>
Expand description

Parses a webhook delivery body without verifying it; prefer construct_webhook_event.

The body must be a JSON object with string id, type and projectId, a numeric createdAt, and its other fields, when present, must have the API’s types: severity and title strings, description a string or null, resource null or an object with a string kind and id and a numeric sequence (any kind, so kinds added later parse), actor an object with a string type and an id string or null, and facts an array of {key, value, url?} objects with a string key and url. Anything else returns sdk/invalid-webhook-payload. Unknown fields are kept: WebhookEventPayload::json returns the body as received.