Skip to content

Add message_id to EmailReceipt and EmailEventData#123

Merged
cpenned merged 1 commit into
mainfrom
cursor/message-id-typing-6d7e
Jul 8, 2026
Merged

Add message_id to EmailReceipt and EmailEventData#123
cpenned merged 1 commit into
mainfrom
cursor/message-id-typing-6d7e

Conversation

@cpenned

@cpenned cpenned commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds message_id typing to match the Resend API and Node.js SDK:

  • EmailReceiptGET /emails/:id (and list) responses
  • EmailEventData — email webhook payloads

ReceivedEmail already had MessageId for the receiving API.

Open in Web Open in Cursor 

Summary by cubic

Expose the RFC Message-ID on email receipts and webhook events in the .NET SDK to match the Resend API and Node.js SDK for easier cross-system correlation.

  • New Features
    • Add nullable MessageId (maps to message_id) to EmailReceipt for GET /emails/:id and list responses.
    • Add nullable MessageId to EmailEventData for all email webhooks (e.g., email.sent, email.delivered, email.received).

Written for commit a633bdc. Summary will update on new commits.

Review in cubic

@cpenned
cpenned marked this pull request as ready for review July 8, 2026 19:03
cubic-dev-ai[bot]
cubic-dev-ai Bot previously approved these changes Jul 8, 2026

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 5 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Auto-approved: Adding message_id property to EmailReceipt and EmailEventData models, with mock updates and tests. Low risk, additive change.

Re-trigger cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 5 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="tests/Resend.Webhooks.Tests/WebhookEventConverterTests.cs">

<violation number="1" location="tests/Resend.Webhooks.Tests/WebhookEventConverterTests.cs:44">
P1: The `EmailEventRoundtrip` test calls `expected.DataAs<EmailEventData>()` on the pre-serialization object rather than `actual.DataAs<EmailEventData>()` on the deserialized result. Since `expected.Data` was assigned `expectedEmail` directly, this reads back the original object instead of the roundtripped data — so the new `MessageId` assertion can never fail, regardless of whether `message_id` is correctly serialized or deserialized. Please change `expected.DataAs<EmailEventData>()` to `actual.DataAs<EmailEventData>()` to actually validate the roundtrip.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Assert.Equal( expected.MomentCreated, actual.MomentCreated );
Assert.Equal( expected.Data.GetType(), actual.Data.GetType() );

var actualEmail = expected.DataAs<EmailEventData>();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: The EmailEventRoundtrip test calls expected.DataAs<EmailEventData>() on the pre-serialization object rather than actual.DataAs<EmailEventData>() on the deserialized result. Since expected.Data was assigned expectedEmail directly, this reads back the original object instead of the roundtripped data — so the new MessageId assertion can never fail, regardless of whether message_id is correctly serialized or deserialized. Please change expected.DataAs<EmailEventData>() to actual.DataAs<EmailEventData>() to actually validate the roundtrip.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At tests/Resend.Webhooks.Tests/WebhookEventConverterTests.cs, line 44:

<comment>The `EmailEventRoundtrip` test calls `expected.DataAs<EmailEventData>()` on the pre-serialization object rather than `actual.DataAs<EmailEventData>()` on the deserialized result. Since `expected.Data` was assigned `expectedEmail` directly, this reads back the original object instead of the roundtripped data — so the new `MessageId` assertion can never fail, regardless of whether `message_id` is correctly serialized or deserialized. Please change `expected.DataAs<EmailEventData>()` to `actual.DataAs<EmailEventData>()` to actually validate the roundtrip.</comment>

<file context>
@@ -1,174 +1,174 @@
+        Assert.Equal( expected.MomentCreated, actual.MomentCreated );
+        Assert.Equal( expected.Data.GetType(), actual.Data.GetType() );
+
+        var actualEmail = expected.DataAs<EmailEventData>();
+
+        Assert.Equal( expectedEmail.Subject, actualEmail.Subject );
</file context>

@cubic-dev-ai
cubic-dev-ai Bot dismissed their stale review July 8, 2026 19:43

Dismissed because Cubic found issues in a newer review.

@hermesresend hermesresend left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — nullable MessageId on both EmailReceipt and EmailEventData with JsonIgnore(WhenWritingNull) is the right call for backward compat. Bulk of the diff is CRLF→LF normalization; real changes are small and well-tested.

Co-authored-by: cpenned <cpenned@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants