Skip to main content

construct_webhook_event

Function construct_webhook_event 

Source
pub fn construct_webhook_event(
    raw_body: &[u8],
    signature: &str,
    endpoint_secret: &str,
    timestamp: Option<&str>,
) -> Result<Article, WebhookVerificationError>
Expand description

Verifies a finlight webhook and returns the contained article.

raw_body must be the unmodified request body. signature is the value of the X-Webhook-Signature header (with or without the sha256= prefix). endpoint_secret is your webhook secret from the finlight dashboard. timestamp is the X-Webhook-Timestamp header; pass None if the webhook has none, otherwise it is included in the signed message and checked against a 5-minute replay tolerance.