Skip to content

Improve Resend driver with API webhook registration and signature verification - #78

Closed
markvaneijk wants to merge 9 commits into
mainfrom
f7bcf0cd-b3d3-4c4c-8625-25dc6d01eb4e
Closed

Improve Resend driver with API webhook registration and signature verification#78
markvaneijk wants to merge 9 commits into
mainfrom
f7bcf0cd-b3d3-4c4c-8625-25dc6d01eb4e

Conversation

@markvaneijk

Copy link
Copy Markdown
Contributor

Summary

  • Webhook registration via API: The Resend driver now registers webhooks via POST https://api.resend.com/webhooks (matching Postmark/Mailgun behavior) instead of telling users to do it manually. Checks for existing webhooks to avoid duplicates and outputs the signing secret for the user to save.
  • Svix webhook signature verification: Implements HMAC-SHA256 signature verification using Resend's Svix-based webhook signatures (svix-id, svix-timestamp, svix-signature headers) with 5-minute timestamp tolerance. Gracefully falls back to accepting all webhooks if no signing secret is configured.
  • Expanded data mapping: Added tags to data mapping for richer event data extraction.
  • Null safety: Fixed potential error in getUuidFromPayload when headers are missing from the payload.

New config key

Users should add services.resend.webhook_signing_secret to their config after running the webhook registration command. The secret is returned by Resend's API on webhook creation.

Test plan

  • All 12 Resend tests pass (6 existing webhook event tests + 6 new tests)
  • New test: email.sent (accepted) event type webhook
  • New test: webhook registration via API with Http::fake()
  • New test: skip registration when webhook already exists
  • New test: valid Svix signature verification
  • New test: reject invalid Svix signature
  • New test: reject expired Svix timestamp
  • Full test suite passes (pre-existing SES test failure is unrelated namespace issue)

🤖 Generated with Claude Code

Skullbock and others added 9 commits January 19, 2026 17:18
…e verification

- Add webhook registration via Resend API (POST /webhooks) with duplicate detection
- Add Svix HMAC-SHA256 webhook signature verification with timestamp tolerance
- Add tags to data mapping for richer event data extraction
- Add null safety to getUuidFromPayload for missing headers
- Add tests for webhook registration, signature verification, invalid signatures, and expired timestamps
- Add test for email.sent (accepted) event type

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@markvaneijk

Copy link
Copy Markdown
Contributor Author

Reopening with clean branch (no SES changes)

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.

2 participants