Every provider that signs webhooks publishes three things: a header or headers carrying the signature, a timestamp to anchor the payload in time, and an algorithm to recompute. Twilio SendGrid, for example, generates a private and public key pair and posts the signature in the X-Twilio-Email-Event-Webhook-Signature header, with the signed timestamp in X-Twilio-Email-Event-Webhook-Timestamp (SendGrid security features). SendGrid uses ECDSA rather than HMAC, so you verify with a public key instead of a shared secret, and a guide on building SendGrid integrations notes that the provider also supplies dual verification headers so you can bind the signature to a time (SendGrid webhooks guide).
Providers that use HMAC follow the same shape. The secret is a string you generate in the provider's dashboard. The signature is HMAC-SHA256(secret, raw_body) or, where a timestamp is included, HMAC-SHA256(secret, timestamp + "." + raw_body) or the timestamp concatenated directly with the body. The exact concatenation differs between providers, so the only reliable source is the provider's own documentation. The Stack Overflow thread on verifying SendGrid signatures shows a developer hashing the timestamp bytes concatenated with the body bytes and then verifying with ECDSA over SHA-256, which illustrates how easy it is to get the input string wrong when you copy an example (Stack Overflow).
A signed payload also carries event identity. SendGrid batches events into a JSON array, and each event includes sg_event_id and sg_message_id alongside the recipient address, a Unix timestamp and the event type, with bounce events adding a reason and SMTP status (Hookdeck SendGrid guide). You need that ID for replay defense even when the signature is valid, because a valid signature proves origin, not freshness.
Amazon SES approaches the same problem differently: it publishes bounce and complaint events to an Amazon SNS topic, and the AWS documentation states plainly that every SES sender must have a system in place for managing bounces and complaints (AWS SES notifications). If you consume those through an HTTP endpoint rather than an SQS queue, you inherit the job of validating the SNS message signature yourself. Either way, the decision rule is the same: no verification, no write.



