Skip to content

feat(events): accept an idempotency key when sending an event - #276

Open
NicolasLopes7 wants to merge 2 commits into
mainfrom
feat/events-idempotency-key
Open

NicolasLopes7 wants to merge 2 commits into
mainfrom
feat/events-idempotency-key

Conversation

@NicolasLopes7

@NicolasLopes7 NicolasLopes7 commented Dec 4, 2026 •

Copy link
Copy Markdown

Summary

Resend::Events.send now takes an options: keyword, and options: { idempotency_key: "..." } sends the Idempotency-Key header on POST /events/send. It uses the same option name and header code as Resend::Emails.send and Resend::Batch.send. Callers that don't pass options: see no change.

The API has accepted Idempotency-Key on this endpoint since Dec 3 (contract: resend/resend-docs#2039). This matches resend-node's resend.events.send(payload, { idempotencyKey }) from resend/resend-node#1205.

Resend::Events.send(
  { event: "order.created", email: "ana@example.com" },
  options: { idempotency_key: "order_created:123" }
)

Also adds this call to examples/events.rb and bumps the version to 1.23.0, as recent feature PRs do.

Testing

  • New spec in spec/events_spec.rb checks that the header is sent when a key is given. It fails without the lib change.
  • bundle exec rake spec: 497 examples, 0 failures (Ruby 4.0.9)
  • bundle exec rubocop: no offenses

🤖 Generated with Claude Code


Summary by cubic

Resend::Events.send now accepts an options: keyword so callers can pass an idempotency key, which is sent as the Idempotency-Key header on POST /events/send. This mirrors how Resend::Emails.send and Resend::Batch.send already handle idempotency keys, and callers that don't pass options: see no change.

  • Adds the options: keyword to send and forwards it to the underlying request.
  • Updates examples/events.rb with an idempotent event example and bumps the gem version to 1.23.0.
  • Adds a spec verifying the header is sent when a key is provided.

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

View guided diff

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 5 files

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

View guided diff | Re-trigger cubic

Comment thread examples/events.rb Resolved
Comment thread spec/events_spec.rb Resolved
@NicolasLopes7
NicolasLopes7 marked this pull request as ready for review December 4, 2026 21:11
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@NicolasLopes7

Copy link
Copy Markdown
Author

@cubic-dev-ai both issues from your review are fixed in c318454: example steps renumbered (10–14), and the new spec renamed to sends the Idempotency-Key header.

@cubic-dev-ai

cubic-dev-ai Bot commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai both issues from your review are fixed in c318454: example steps renumbered (10–14), and the new spec renamed to sends the Idempotency-Key header.

@NicolasLopes7 Both fixes are in place in c318454 — confirmed:

  • examples/events.rb renumbers the remaining steps 10–14 after the new step 9, so the sequence reads cleanly top to bottom.
  • spec/events_spec.rb now uses it "sends the Idempotency-Key header", and the assertion matches the actual header name sent by the request.

Nothing else jumps out. The Gemfile.lock → 1.23.0 bump alongside lib/resend/version.rb also keeps the lockfile in sync, per the team convention. Looks ready.

Tip: get faster answers by chatting with cubic’s review copilot in the review UI

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

0 issues found across 2 files (changes from recent commits).

Confidence score: 5/5

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

Auto-approved: Adds optional idempotency-key support to Resend::Events.send via an options keyword, with an example and version bump. The diff is a small, backward-compatible additive change with a focused spec; non-options callers are unaffected.

View guided diff | Re-trigger cubic

@github-actions github-actions Bot added the linear-synced PR has been synced to Linear label Dec 5, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

linear-synced PR has been synced to Linear

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants