From 08ed457b70f10cc8389106686c04d16c2cdd44bd Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Fri, 10 Jul 2026 20:54:57 +0000 Subject: [PATCH 1/3] docs(batch): document schedule, tags, and attachments support Each batch email accepts the same fields as Resend::Emails.send, including scheduled_at, tags, and attachments. Add a spec that verifies these fields are passed through in the request body. Co-authored-by: cpenned --- lib/resend/batch.rb | 9 ++++++++- spec/batch_spec.rb | 46 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/lib/resend/batch.rb b/lib/resend/batch.rb index 554e2e8..0b7b2a8 100644 --- a/lib/resend/batch.rb +++ b/lib/resend/batch.rb @@ -6,7 +6,14 @@ module Batch class << self # Send a batch of emails # - # @param params [Array] Array of email parameters (max 100 emails) + # Each email in +params+ accepts the same fields as {Resend::Emails.send}, + # including +scheduled_at+, +tags+, and +attachments+. + # + # @param params [Array] Array of email parameters (max 100 emails). + # Each hash accepts the same fields as {Resend::Emails.send}, including: + # - +scheduled_at+ [String] ISO 8601 schedule time + # - +tags+ [Array] Key/value tags, e.g. [{ name: "category", value: "welcome" }] + # - +attachments+ [Array] File attachments with +filename+ and +content+ or +path+ # @param options [Hash] Additional options for the request # @option options [String] :idempotency_key Optional idempotency key # @option options [String] :batch_validation Batch validation mode: "strict" (default) or "permissive" diff --git a/spec/batch_spec.rb b/spec/batch_spec.rb index 9312499..146fd3a 100644 --- a/spec/batch_spec.rb +++ b/spec/batch_spec.rb @@ -266,6 +266,52 @@ expect(result[:errors][0][:message]).to include("valid email address") end + it "passes scheduled_at, tags, and attachments in the request body" do + resp = { + "data": [ + { "id": "ae2014de-c168-4c61-8267-70d2662a1ce1" } + ] + } + + params = [ + { + from: "from@e.io", + to: ["email1@email.com"], + subject: "Scheduled with metadata", + html: "

Hello

", + scheduled_at: "2024-09-05T11:52:01.858Z", + tags: [ + { name: "category", value: "welcome" } + ], + attachments: [ + { + filename: "invoice.pdf", + content: "dGVzdA==" + } + ] + } + ] + + allow(resp).to receive(:body).and_return(resp) + allow(HTTParty).to receive(:send).and_return(resp) + + Resend::Batch.send(params) + + expect(HTTParty).to have_received(:send).with( + :post, + "#{Resend::Request::BASE_URL}emails/batch", + { + headers: { + "Content-Type" => "application/json", + "Accept" => "application/json", + "Authorization" => "Bearer re_123", + "User-Agent" => "resend-ruby:#{Resend::VERSION}", + }, + body: params.to_json + } + ) + end + it "sends batch email with templates" do resp = { "data": [ From e6276e7e78859ee9c4d236a0e71e2cb4a9e2951b Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Mon, 13 Jul 2026 16:16:23 +0000 Subject: [PATCH 2/3] docs(batch): document tags support only Batch emails support tags per email. scheduled_at and attachments are not supported in batch and are documented as such. Co-authored-by: cpenned --- lib/resend/batch.rb | 7 +++---- spec/batch_spec.rb | 11 ++--------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/lib/resend/batch.rb b/lib/resend/batch.rb index 0b7b2a8..3798fd6 100644 --- a/lib/resend/batch.rb +++ b/lib/resend/batch.rb @@ -7,13 +7,12 @@ class << self # Send a batch of emails # # Each email in +params+ accepts the same fields as {Resend::Emails.send}, - # including +scheduled_at+, +tags+, and +attachments+. + # except +scheduled_at+ and +attachments+, which are not supported in batch. + # +tags+ are supported per email. # # @param params [Array] Array of email parameters (max 100 emails). - # Each hash accepts the same fields as {Resend::Emails.send}, including: - # - +scheduled_at+ [String] ISO 8601 schedule time + # Each hash accepts the same fields as {Resend::Emails.send}, except: # - +tags+ [Array] Key/value tags, e.g. [{ name: "category", value: "welcome" }] - # - +attachments+ [Array] File attachments with +filename+ and +content+ or +path+ # @param options [Hash] Additional options for the request # @option options [String] :idempotency_key Optional idempotency key # @option options [String] :batch_validation Batch validation mode: "strict" (default) or "permissive" diff --git a/spec/batch_spec.rb b/spec/batch_spec.rb index 146fd3a..cd1be7b 100644 --- a/spec/batch_spec.rb +++ b/spec/batch_spec.rb @@ -266,7 +266,7 @@ expect(result[:errors][0][:message]).to include("valid email address") end - it "passes scheduled_at, tags, and attachments in the request body" do + it "passes tags in the request body" do resp = { "data": [ { "id": "ae2014de-c168-4c61-8267-70d2662a1ce1" } @@ -277,17 +277,10 @@ { from: "from@e.io", to: ["email1@email.com"], - subject: "Scheduled with metadata", + subject: "Tagged email", html: "

Hello

", - scheduled_at: "2024-09-05T11:52:01.858Z", tags: [ { name: "category", value: "welcome" } - ], - attachments: [ - { - filename: "invoice.pdf", - content: "dGVzdA==" - } ] } ] From b4884ef6f7093052ba878982d276a6089d1d438f Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Wed, 15 Jul 2026 03:32:29 +0000 Subject: [PATCH 3/3] docs(batch): remove unsupported attachments mention Co-authored-by: cpenned --- lib/resend/batch.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/resend/batch.rb b/lib/resend/batch.rb index 3798fd6..addfdcf 100644 --- a/lib/resend/batch.rb +++ b/lib/resend/batch.rb @@ -7,11 +7,10 @@ class << self # Send a batch of emails # # Each email in +params+ accepts the same fields as {Resend::Emails.send}, - # except +scheduled_at+ and +attachments+, which are not supported in batch. - # +tags+ are supported per email. + # including +tags+ per email. # # @param params [Array] Array of email parameters (max 100 emails). - # Each hash accepts the same fields as {Resend::Emails.send}, except: + # Each hash accepts the same fields as {Resend::Emails.send}, including: # - +tags+ [Array] Key/value tags, e.g. [{ name: "category", value: "welcome" }] # @param options [Hash] Additional options for the request # @option options [String] :idempotency_key Optional idempotency key