decode
Decodes a Resend webhook request body with json.
Unknown fields are ignored, so an email.* event carrying fields these models do not declare still decodes. Only email.* events are supported: Data requires email_id and from, which other event families (such as contact.* and domain.*) do not send, so their payloads throw kotlinx.serialization.MissingFieldException. An endpoint subscribed to other events should read type first, for example with json.parseToJsonElement(body).jsonObject["type"], and decode only email.* ones.
Return
the decoded message
Parameters
body
the raw JSON request body
Throws
kotlinx.serialization.SerializationException
if body is not a valid webhook payload