feat: add message_id to Email and webhook EmailBody types#77
Conversation
Expose the RFC Message-ID header value on sent email responses (GET /emails/:id and list) and on all email webhook event payloads, matching the Node.js SDK and current Resend API. Co-authored-by: cpenned <cpenned@users.noreply.github.com>
There was a problem hiding this comment.
No issues found across 2 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Auto-approved: Adds a required message_id field to Email and EmailBody types alongside updated tests and fixtures. The change is type-only for API alignment, has no business logic or infrastructure impact, and is covered by existing tests.
Re-trigger cubic
hermesresend
left a comment
There was a problem hiding this comment.
LGTM — clean addition with solid test coverage across all event fixtures. One non-blocking note: message_id is a required String on Email and EmailBody, so deserialization will hard-fail on any payload that omits it (e.g. older stored events or replayed webhooks). If there's any chance the API omits it for legacy data, Option<String> with #[serde(default)] would be safer — matches the nullable approach in the .NET SDK. Fine as-is if the API guarantees the field.
Summary
Adds
message_idtyping to match the Resend API and Node.js SDK:types::Email—message_idis now deserialized fromGET /emails/:idand list responsesevents::EmailBody—message_idis now available on all email webhook event payloads (not onlyemail.received)The field was previously only exposed on inbound emails (
InboundEmail) and nested inside theReceivedwebhook struct. It is now a top-level field onEmailBody, so consumers can accessevent.data.message_idconsistently across all email webhook types.Changes
message_id: Stringtoemails::types::Emailmessage_id: Stringtoevents::EmailBodymessage_idfromevents::Received(still flattened viaEmailBody)Test plan
cargo test --lib --no-default-features --features rustls-tls deserializecargo test --lib --no-default-features --features rustls-tls events::test::email_Summary by cubic
Expose the RFC Message-ID on sent emails and all email webhook events for consistent access across the API. Aligns with the Resend API and Node.js SDK.
New Features
types::Email: addedmessage_idfrom GET /emails/:id and list responses.events::EmailBody: added top-levelmessage_idon all email webhook payloads.Migration
events::Received.message_idwas removed. UseEmailBody.message_idinstead (e.g.,event.data.message_id).Written for commit e1ab13e. Summary will update on new commits.