Skip to content

feat(webhooks): add inbox webhook events - #1118

Merged
joaopcm merged 2 commits into
preview-inboxesfrom
feature/mes-1787-add-the-inbox-webhook-events-to-the-nodejs-sdk
Sep 29, 2026
Merged

joaopcm merged 2 commits into
preview-inboxesfrom
feature/mes-1787-add-the-inbox-webhook-events-to-the-nodejs-sdk

Conversation

@joaopcm

@joaopcm joaopcm commented Sep 29, 2026 •

Copy link
Copy Markdown
Member

WebhookEvent is missing the 14 inbox.* types the API already accepts, so this doesn't typecheck:

resend.webhooks.create({
  endpoint: 'https://example.com/webhooks',
  events: ['inbox.email.received'],
});

this adds them to WebhookEvent, and adds a payload type per event to WebhookEventPayload, so the result of verify() narrows on type.

every inbox event's data has source and inbox_id, plus optional thread_id, email_id, draft_id, thread, email, draft and inbox. keys that don't apply are left out, not sent as null. on top of that:

  • inbox.thread.folder.updated: from, to
  • inbox.thread.assigned: assignee_email, assigned_by_email, previous_assignee_email
  • inbox.thread.unassigned: previous_assignee_email
  • inbox.thread.labels.updated: added, removed

thread, email and draft reuse InboxThreadSummary, InboxMessage and InboxDraft, with html and text dropped from the last two. inbox has its own type, since the webhook sends object, domain_id, receiving_address and created_at, and Inbox has none of those.

the shapes come from packages/inboxes/src/api/*.ts and apps/inbox-events-webhooks-consumer/src/deliver.ts in the monorepo.

this targets preview-inboxes because the inbox types only exist there, and bumps to 6.28.1-preview-inboxes.2.

pnpm lint, pnpm typecheck and pnpm test pass. I also typechecked a throwaway file that narrows WebhookEventPayload on a few inbox events and expects data.email.html to be an error. no live call, there was no API key in this checkout.

not in this PR: the API also accepts topic.* and contact.topics.updated, and WebhookEvent doesn't have those either.


Summary by cubic

Adds the 14 inbox.* webhook event types to WebhookEvent and WebhookEventPayload, so creating webhooks with inbox events typechecks and verify() narrows the payload on type.

  • Payload types reuse the existing inbox thread, message, and draft types, dropping html and text from email and draft.
  • Events with extra fields get them: folder changes send from/to, assignments send assignee fields, and label changes send added/removed.
  • Non-applicable ids and objects are omitted rather than sent as null, so they're optional keys.
  • Bumps the package to 6.28.1-preview-inboxes.2.

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

Review in cubic

@pkg-pr-new

pkg-pr-new Bot commented Sep 29, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/resend@1118

commit: e645c6a

@klotty klotty 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.

cubic analysis

No issues found across 4 files

Confidence score: 5/5

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

Linked issue analysis

Linked issue: MES-1787: add the inbox webhook events to the Node.js SDK

Status Acceptance criteria Notes
✅ Add all 14 specified `inbox.*` event names to `WebhookEvent` and `WebhookEventPayload`, with payloads narrowing by `type`. The diff adds all 14 event names and corresponding event interfaces to the payload union.
✅ Include shared inbox payload fields, with non-applicable IDs and objects optional rather than nullable. The shared data type includes `source`, `inbox_id`, and optional ID/object properties.
✅ Include the specified event-specific fields for folder updates, assignments, unassignments, and label updates. Each of the four event interfaces adds the fields and value types described in the issue.
✅ Use the specified public SDK object types where available, omitting `html` and `text` from email and draft payloads. The diff reuses inbox thread, message, and draft types, omitting `html` and `text` from message and draft; it defines a separate inbox shape.
⚠️ Match the issue's per-event mapping of which IDs and objects appear. The shared data type makes every listed ID and object optional for every inbox event; the diff does not encode distinct per-event applicability from the referenced table.

Auto-approved: Adds 14 inbox.* webhook event names and matching payload interfaces to the SDK webhook types, fixing typechecking for events the API already accepts. The change is type-only with a preview version bump, so its impact is bounded and clearly beneficial.

Re-trigger cubic

@joaopcm joaopcm self-assigned this Sep 29, 2026
@joaopcm
joaopcm marked this pull request as ready for review September 29, 2026 16:46
@joaopcm
joaopcm requested a review from a team as a code owner September 29, 2026 16:46
@joaopcm
joaopcm requested review from fabiokubo and isabellaaquino and removed request for a team and fabiokubo September 29, 2026 16:46
@joaopcm
joaopcm merged commit 46c80f0 into preview-inboxes Sep 29, 2026
9 of 10 checks passed
@joaopcm
joaopcm deleted the feature/mes-1787-add-the-inbox-webhook-events-to-the-nodejs-sdk branch September 29, 2026 19:24
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.

3 participants