Skip to content

Add remaining missing webhook email data fields (#105)#127

Merged
felipefreitag merged 1 commit into
mainfrom
fix/webhook-missing-fields
Jul 9, 2026
Merged

Add remaining missing webhook email data fields (#105)#127
felipefreitag merged 1 commit into
mainfrom
fix/webhook-missing-fields

Conversation

@felipefreitag

@felipefreitag felipefreitag commented Jul 9, 2026

Copy link
Copy Markdown
Member

Closes #105.

Completes EmailEventData parity with the Resend webhook payload. Field shapes verified against the server assembly (monorepo/apps/email-events-webhooks-consumer/src/utils/call-webhook.ts) and the OpenAPI spec. #112 added several fields but left these out:

New fields

  • open (EmailOpenData: ipAddress, timestamp, userAgent) — set for email.opened. Mirrors EmailClickData without link. This was the most notable gap — opens are common and the payload was previously dropped.
  • headers (List<EmailEventHeader>) — custom headers, present on every email event (inbound and outbound). Sent by the server as an array of {name, value}.
  • received_for (EmailAddressList) — inbound email.received only.
  • suppressed.reason and suppressed.diagnosticCode — the server sends {message, type, reason, diagnosticCode}; Updating webhook data fields #112 modeled only message + type.

Corrections to #112's attachment model

  • EmailEventAttachment.Id: Guidstring. The server types it as a plain string and inbound attachment ids are not UUIDs; Guid would throw at deserialization. (The new inbound test uses "att_123" to cover this.)
  • filename, content_disposition, content_id made nullable to match the server (string | null).

Tests

3 new raw-JSON deserialization tests in Resend.Webhooks.Tests (real server-style payloads for opened, received, suppressed). Full suite on .NET 8: all pass (Webhooks 6/6).

Note

suppressed.reason/type are modeled as string (documented enum values in remarks) rather than enums, consistent with the existing bounce.type/subType treatment in this file.


Summary by cubic

Completes EmailEventData parity with the Resend webhook payload and fixes attachment modeling to match the API. Ensures open events, headers, inbound recipients, and suppression details deserialize correctly.

  • New Features

    • open (EmailOpenData: ipAddress, timestamp, userAgent) for email.opened.
    • headers (List<EmailEventHeader>) on all events.
    • received_for (EmailAddressList) for inbound email.received.
    • suppressed.reason and suppressed.diagnosticCode.
  • Bug Fixes

    • EmailEventAttachment.Id: Guidstring to prevent deserialization errors.
    • filename, content_disposition, content_id are now nullable to match the server.
    • Added raw JSON deserialization tests for opened, received, and suppressed events.

Written for commit 55ebbba. Summary will update on new commits.

Review in cubic

Completes EmailEventData parity with the Resend webhook payload
(verified against public-api and the OpenAPI spec):

- open (EmailOpenData: ipAddress, timestamp, userAgent) for email.opened
- headers (List<EmailEventHeader>), present on all email events
- received_for (EmailAddressList) for inbound email.received
- suppressed.reason and suppressed.diagnosticCode

Also corrects EmailEventAttachment to match the API: id is a string
(not Guid; inbound attachment ids are not UUIDs), and filename,
content_disposition and content_id are nullable.

@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 4 files

Confidence score: 5/5

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

Auto-approved: Adds missing webhook email fields (open, headers, received_for, suppressed) and fixes attachment ID type to prevent deserialization errors. Low-risk changes with accompanying tests.

Re-trigger cubic

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.

Add missing fields to Webhook Data

1 participant