import { Resend } from 'resend';const resend = new Resend('re_xxxxxxxxx');// Create a draft broadcastconst { data, error } = await resend.broadcasts.create({ segmentId: '78261eea-8f8b-4381-83c6-79fa7120f1cf', from: 'Acme <onboarding@resend.dev>', subject: 'hello world', html: 'Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}',});// Create and send immediatelyconst { data: sent, error: sendError } = await resend.broadcasts.create({ segmentId: '78261eea-8f8b-4381-83c6-79fa7120f1cf', from: 'Acme <onboarding@resend.dev>', subject: 'hello world', html: 'Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}', send: true,});// Create and scheduleconst { data: scheduled, error: scheduleError } = await resend.broadcasts.create({ segmentId: '78261eea-8f8b-4381-83c6-79fa7120f1cf', from: 'Acme <onboarding@resend.dev>', subject: 'hello world', html: 'Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}', send: true, scheduledAt: 'in 1 hour', });
$resend = Resend::client('re_xxxxxxxxx');// Create a draft broadcast$resend->broadcasts->create([ 'segment_id' => '78261eea-8f8b-4381-83c6-79fa7120f1cf', 'from' => 'Acme <onboarding@resend.dev>', 'subject' => 'hello world', 'html' => 'Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}',]);// Create and send immediately$resend->broadcasts->create([ 'segment_id' => '78261eea-8f8b-4381-83c6-79fa7120f1cf', 'from' => 'Acme <onboarding@resend.dev>', 'subject' => 'hello world', 'html' => 'Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}', 'send' => true,]);// Create and schedule$resend->broadcasts->create([ 'segment_id' => '78261eea-8f8b-4381-83c6-79fa7120f1cf', 'from' => 'Acme <onboarding@resend.dev>', 'subject' => 'hello world', 'html' => 'Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}', 'send' => true, 'scheduled_at' => 'in 1 hour',]);
import resendresend.api_key = "re_xxxxxxxxx"# Create a draft broadcastparams: resend.Broadcasts.CreateParams = { "segment_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "from": "Acme <onboarding@resend.dev>", "subject": "Hello, world!", "html": "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}",}resend.Broadcasts.create(params)# Create and send immediatelyparams: resend.Broadcasts.CreateParams = { "segment_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "from": "Acme <onboarding@resend.dev>", "subject": "Hello, world!", "html": "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}", "send": True,}resend.Broadcasts.create(params)# Create and scheduleparams: resend.Broadcasts.CreateParams = { "segment_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "from": "Acme <onboarding@resend.dev>", "subject": "Hello, world!", "html": "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}", "send": True, "scheduled_at": "in 1 hour",}resend.Broadcasts.create(params)
require "resend"Resend.api_key = "re_xxxxxxxxx"# Create a draft broadcastparams = { "segment_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "from": "Acme <onboarding@resend.dev>", "subject": "hello world", "html": "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}",}Resend::Broadcasts.create(params)# Create and send immediatelyparams = { "segment_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "from": "Acme <onboarding@resend.dev>", "subject": "Hello, world!", "html": "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}", "send": true,}Resend::Broadcasts.create(params)# Create and scheduleparams = { "segment_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "from": "Acme <onboarding@resend.dev>", "subject": "Hello, world!", "html": "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}", "send": true, "scheduled_at": "in 1 hour",}Resend::Broadcasts.create(params)
package mainimport "github.com/resend/resend-go/v4"func main() { client := resend.NewClient("re_xxxxxxxxx") // Create a draft broadcast params := &resend.CreateBroadcastRequest{ SegmentId: "78261eea-8f8b-4381-83c6-79fa7120f1cf", From: "Acme <onboarding@resend.dev>", Html: "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}", Subject: "Hello, world!", } client.Broadcasts.Create(params) // Create and send immediately params = &resend.CreateBroadcastRequest{ SegmentId: "78261eea-8f8b-4381-83c6-79fa7120f1cf", From: "Acme <onboarding@resend.dev>", Subject: "Hello, world!", Html: "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}", Send: true, } client.Broadcasts.Create(params) // Create and schedule params = &resend.CreateBroadcastRequest{ SegmentId: "78261eea-8f8b-4381-83c6-79fa7120f1cf", From: "Acme <onboarding@resend.dev>", Subject: "Hello, world!", Html: "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}", Send: true, ScheduledAt: "in 1 hour", } client.Broadcasts.Create(params)}
use resend_rs::{types::CreateBroadcastOptions, Resend, Result};#[tokio::main]async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let segment_id = "78261eea-8f8b-4381-83c6-79fa7120f1cf"; let from = "Acme <onboarding@resend.dev>"; let subject = "hello world"; let html = "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}"; let opts = CreateBroadcastOptions::new(segment_id, from, subject).with_html(html); // Create a draft broadcast let _broadcast = resend.broadcasts.create(opts.clone()).await?; // Create and send immediately let _broadcast = resend .broadcasts .create(opts.clone().with_send(true)) .await?; // Create and schedule let _broadcast = resend .broadcasts .create(opts.with_send(true).with_scheduled_at("in 1 hour")) .await?; Ok(())}
import com.resend.Resend;import com.resend.services.broadcasts.model.CreateBroadcastOptions;import com.resend.services.broadcasts.model.CreateBroadcastResponseSuccess;Resend resend = new Resend("re_xxxxxxxxx");// Create a draft broadcastCreateBroadcastOptions params = CreateBroadcastOptions.builder() .segmentId("78261eea-8f8b-4381-83c6-79fa7120f1cf") .from("Acme <onboarding@resend.dev>") .subject("hello world") .html("Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}") .build();CreateBroadcastResponseSuccess data = resend.broadcasts().create(params);// Create and send immediatelyCreateBroadcastOptions sendParams = CreateBroadcastOptions.builder() .segmentId("78261eea-8f8b-4381-83c6-79fa7120f1cf") .from("Acme <onboarding@resend.dev>") .subject("hello world") .html("Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}") .send(true) .build();CreateBroadcastResponseSuccess sent = resend.broadcasts().create(sendParams);// Create and scheduleCreateBroadcastOptions scheduleParams = CreateBroadcastOptions.builder() .segmentId("78261eea-8f8b-4381-83c6-79fa7120f1cf") .from("Acme <onboarding@resend.dev>") .subject("hello world") .html("Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}") .send(true) .scheduledAt("in 1 hour") .build();CreateBroadcastResponseSuccess scheduled = resend.broadcasts().create(scheduleParams);
using Resend;IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI// Create a draft broadcastvar resp = await resend.BroadcastAddAsync( new BroadcastData() { DisplayName = "Example Broadcast", SegmentId = new Guid( "78261eea-8f8b-4381-83c6-79fa7120f1cf" ), From = "Acme <onboarding@resend.dev>", Subject = "Hello, world!", HtmlBody = "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}", });Console.WriteLine( "Broadcast Id={0}", resp.Content );// Create and send immediatelyvar sent = await resend.BroadcastAddAsync( new BroadcastData() { DisplayName = "Example Broadcast", SegmentId = new Guid( "78261eea-8f8b-4381-83c6-79fa7120f1cf" ), From = "Acme <onboarding@resend.dev>", Subject = "Hello, world!", HtmlBody = "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}", SendAfterAdd = true, });Console.WriteLine( "Broadcast Id={0}", sent.Content );// Create and schedulevar scheduled = await resend.BroadcastAddAsync( new BroadcastData() { DisplayName = "Example Broadcast", SegmentId = new Guid( "78261eea-8f8b-4381-83c6-79fa7120f1cf" ), From = "Acme <onboarding@resend.dev>", Subject = "Hello, world!", HtmlBody = "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}", SendAfterAdd = true, MomentSchedule = DateTime.UtcNow.AddHours( 1 ), });Console.WriteLine( "Broadcast Id={0}", scheduled.Content );
# Create a draft broadcastcurl -X POST 'https://api.resend.com/broadcasts' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'{ "segment_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "from": "Acme <onboarding@resend.dev>", "subject": "hello world", "html": "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}"}'# Create and send immediatelycurl -X POST 'https://api.resend.com/broadcasts' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'{ "segment_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "from": "Acme <onboarding@resend.dev>", "subject": "hello world", "html": "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}", "send": true}'# Create and schedulecurl -X POST 'https://api.resend.com/broadcasts' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'{ "segment_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "from": "Acme <onboarding@resend.dev>", "subject": "hello world", "html": "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}", "send": true, "scheduled_at": "in 1 hour"}'
# Create a draft broadcastresend broadcasts create \ --from "Acme <onboarding@resend.dev>" \ --subject "hello world" \ --segment-id 78261eea-8f8b-4381-83c6-79fa7120f1cf \ --html "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}"# Create and send immediatelyresend broadcasts create \ --from "Acme <onboarding@resend.dev>" \ --subject "hello world" \ --segment-id 78261eea-8f8b-4381-83c6-79fa7120f1cf \ --html "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}" \ --send# Create and scheduleresend broadcasts create \ --from "Acme <onboarding@resend.dev>" \ --subject "hello world" \ --segment-id 78261eea-8f8b-4381-83c6-79fa7120f1cf \ --html "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}" \ --send \ --scheduled-at "in 1 hour"
import { Resend } from 'resend';const resend = new Resend('re_xxxxxxxxx');// Create a draft broadcastconst { data, error } = await resend.broadcasts.create({ segmentId: '78261eea-8f8b-4381-83c6-79fa7120f1cf', from: 'Acme <onboarding@resend.dev>', subject: 'hello world', html: 'Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}',});// Create and send immediatelyconst { data: sent, error: sendError } = await resend.broadcasts.create({ segmentId: '78261eea-8f8b-4381-83c6-79fa7120f1cf', from: 'Acme <onboarding@resend.dev>', subject: 'hello world', html: 'Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}', send: true,});// Create and scheduleconst { data: scheduled, error: scheduleError } = await resend.broadcasts.create({ segmentId: '78261eea-8f8b-4381-83c6-79fa7120f1cf', from: 'Acme <onboarding@resend.dev>', subject: 'hello world', html: 'Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}', send: true, scheduledAt: 'in 1 hour', });
$resend = Resend::client('re_xxxxxxxxx');// Create a draft broadcast$resend->broadcasts->create([ 'segment_id' => '78261eea-8f8b-4381-83c6-79fa7120f1cf', 'from' => 'Acme <onboarding@resend.dev>', 'subject' => 'hello world', 'html' => 'Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}',]);// Create and send immediately$resend->broadcasts->create([ 'segment_id' => '78261eea-8f8b-4381-83c6-79fa7120f1cf', 'from' => 'Acme <onboarding@resend.dev>', 'subject' => 'hello world', 'html' => 'Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}', 'send' => true,]);// Create and schedule$resend->broadcasts->create([ 'segment_id' => '78261eea-8f8b-4381-83c6-79fa7120f1cf', 'from' => 'Acme <onboarding@resend.dev>', 'subject' => 'hello world', 'html' => 'Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}', 'send' => true, 'scheduled_at' => 'in 1 hour',]);
import resendresend.api_key = "re_xxxxxxxxx"# Create a draft broadcastparams: resend.Broadcasts.CreateParams = { "segment_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "from": "Acme <onboarding@resend.dev>", "subject": "Hello, world!", "html": "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}",}resend.Broadcasts.create(params)# Create and send immediatelyparams: resend.Broadcasts.CreateParams = { "segment_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "from": "Acme <onboarding@resend.dev>", "subject": "Hello, world!", "html": "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}", "send": True,}resend.Broadcasts.create(params)# Create and scheduleparams: resend.Broadcasts.CreateParams = { "segment_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "from": "Acme <onboarding@resend.dev>", "subject": "Hello, world!", "html": "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}", "send": True, "scheduled_at": "in 1 hour",}resend.Broadcasts.create(params)
require "resend"Resend.api_key = "re_xxxxxxxxx"# Create a draft broadcastparams = { "segment_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "from": "Acme <onboarding@resend.dev>", "subject": "hello world", "html": "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}",}Resend::Broadcasts.create(params)# Create and send immediatelyparams = { "segment_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "from": "Acme <onboarding@resend.dev>", "subject": "Hello, world!", "html": "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}", "send": true,}Resend::Broadcasts.create(params)# Create and scheduleparams = { "segment_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "from": "Acme <onboarding@resend.dev>", "subject": "Hello, world!", "html": "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}", "send": true, "scheduled_at": "in 1 hour",}Resend::Broadcasts.create(params)
package mainimport "github.com/resend/resend-go/v4"func main() { client := resend.NewClient("re_xxxxxxxxx") // Create a draft broadcast params := &resend.CreateBroadcastRequest{ SegmentId: "78261eea-8f8b-4381-83c6-79fa7120f1cf", From: "Acme <onboarding@resend.dev>", Html: "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}", Subject: "Hello, world!", } client.Broadcasts.Create(params) // Create and send immediately params = &resend.CreateBroadcastRequest{ SegmentId: "78261eea-8f8b-4381-83c6-79fa7120f1cf", From: "Acme <onboarding@resend.dev>", Subject: "Hello, world!", Html: "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}", Send: true, } client.Broadcasts.Create(params) // Create and schedule params = &resend.CreateBroadcastRequest{ SegmentId: "78261eea-8f8b-4381-83c6-79fa7120f1cf", From: "Acme <onboarding@resend.dev>", Subject: "Hello, world!", Html: "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}", Send: true, ScheduledAt: "in 1 hour", } client.Broadcasts.Create(params)}
use resend_rs::{types::CreateBroadcastOptions, Resend, Result};#[tokio::main]async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let segment_id = "78261eea-8f8b-4381-83c6-79fa7120f1cf"; let from = "Acme <onboarding@resend.dev>"; let subject = "hello world"; let html = "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}"; let opts = CreateBroadcastOptions::new(segment_id, from, subject).with_html(html); // Create a draft broadcast let _broadcast = resend.broadcasts.create(opts.clone()).await?; // Create and send immediately let _broadcast = resend .broadcasts .create(opts.clone().with_send(true)) .await?; // Create and schedule let _broadcast = resend .broadcasts .create(opts.with_send(true).with_scheduled_at("in 1 hour")) .await?; Ok(())}
import com.resend.Resend;import com.resend.services.broadcasts.model.CreateBroadcastOptions;import com.resend.services.broadcasts.model.CreateBroadcastResponseSuccess;Resend resend = new Resend("re_xxxxxxxxx");// Create a draft broadcastCreateBroadcastOptions params = CreateBroadcastOptions.builder() .segmentId("78261eea-8f8b-4381-83c6-79fa7120f1cf") .from("Acme <onboarding@resend.dev>") .subject("hello world") .html("Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}") .build();CreateBroadcastResponseSuccess data = resend.broadcasts().create(params);// Create and send immediatelyCreateBroadcastOptions sendParams = CreateBroadcastOptions.builder() .segmentId("78261eea-8f8b-4381-83c6-79fa7120f1cf") .from("Acme <onboarding@resend.dev>") .subject("hello world") .html("Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}") .send(true) .build();CreateBroadcastResponseSuccess sent = resend.broadcasts().create(sendParams);// Create and scheduleCreateBroadcastOptions scheduleParams = CreateBroadcastOptions.builder() .segmentId("78261eea-8f8b-4381-83c6-79fa7120f1cf") .from("Acme <onboarding@resend.dev>") .subject("hello world") .html("Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}") .send(true) .scheduledAt("in 1 hour") .build();CreateBroadcastResponseSuccess scheduled = resend.broadcasts().create(scheduleParams);
using Resend;IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI// Create a draft broadcastvar resp = await resend.BroadcastAddAsync( new BroadcastData() { DisplayName = "Example Broadcast", SegmentId = new Guid( "78261eea-8f8b-4381-83c6-79fa7120f1cf" ), From = "Acme <onboarding@resend.dev>", Subject = "Hello, world!", HtmlBody = "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}", });Console.WriteLine( "Broadcast Id={0}", resp.Content );// Create and send immediatelyvar sent = await resend.BroadcastAddAsync( new BroadcastData() { DisplayName = "Example Broadcast", SegmentId = new Guid( "78261eea-8f8b-4381-83c6-79fa7120f1cf" ), From = "Acme <onboarding@resend.dev>", Subject = "Hello, world!", HtmlBody = "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}", SendAfterAdd = true, });Console.WriteLine( "Broadcast Id={0}", sent.Content );// Create and schedulevar scheduled = await resend.BroadcastAddAsync( new BroadcastData() { DisplayName = "Example Broadcast", SegmentId = new Guid( "78261eea-8f8b-4381-83c6-79fa7120f1cf" ), From = "Acme <onboarding@resend.dev>", Subject = "Hello, world!", HtmlBody = "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}", SendAfterAdd = true, MomentSchedule = DateTime.UtcNow.AddHours( 1 ), });Console.WriteLine( "Broadcast Id={0}", scheduled.Content );
# Create a draft broadcastcurl -X POST 'https://api.resend.com/broadcasts' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'{ "segment_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "from": "Acme <onboarding@resend.dev>", "subject": "hello world", "html": "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}"}'# Create and send immediatelycurl -X POST 'https://api.resend.com/broadcasts' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'{ "segment_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "from": "Acme <onboarding@resend.dev>", "subject": "hello world", "html": "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}", "send": true}'# Create and schedulecurl -X POST 'https://api.resend.com/broadcasts' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'{ "segment_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "from": "Acme <onboarding@resend.dev>", "subject": "hello world", "html": "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}", "send": true, "scheduled_at": "in 1 hour"}'
# Create a draft broadcastresend broadcasts create \ --from "Acme <onboarding@resend.dev>" \ --subject "hello world" \ --segment-id 78261eea-8f8b-4381-83c6-79fa7120f1cf \ --html "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}"# Create and send immediatelyresend broadcasts create \ --from "Acme <onboarding@resend.dev>" \ --subject "hello world" \ --segment-id 78261eea-8f8b-4381-83c6-79fa7120f1cf \ --html "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}" \ --send# Create and scheduleresend broadcasts create \ --from "Acme <onboarding@resend.dev>" \ --subject "hello world" \ --segment-id 78261eea-8f8b-4381-83c6-79fa7120f1cf \ --html "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}" \ --send \ --scheduled-at "in 1 hour"
Send the broadcast immediately after creation. Defaults to false.
When set to true, the broadcast will be sent or scheduled (if scheduled_at is provided) without requiring a separate call to the Send Broadcast endpoint.
import { Resend } from 'resend';const resend = new Resend('re_xxxxxxxxx');// Create a draft broadcastconst { data, error } = await resend.broadcasts.create({ segmentId: '78261eea-8f8b-4381-83c6-79fa7120f1cf', from: 'Acme <onboarding@resend.dev>', subject: 'hello world', html: 'Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}',});// Create and send immediatelyconst { data: sent, error: sendError } = await resend.broadcasts.create({ segmentId: '78261eea-8f8b-4381-83c6-79fa7120f1cf', from: 'Acme <onboarding@resend.dev>', subject: 'hello world', html: 'Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}', send: true,});// Create and scheduleconst { data: scheduled, error: scheduleError } = await resend.broadcasts.create({ segmentId: '78261eea-8f8b-4381-83c6-79fa7120f1cf', from: 'Acme <onboarding@resend.dev>', subject: 'hello world', html: 'Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}', send: true, scheduledAt: 'in 1 hour', });
$resend = Resend::client('re_xxxxxxxxx');// Create a draft broadcast$resend->broadcasts->create([ 'segment_id' => '78261eea-8f8b-4381-83c6-79fa7120f1cf', 'from' => 'Acme <onboarding@resend.dev>', 'subject' => 'hello world', 'html' => 'Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}',]);// Create and send immediately$resend->broadcasts->create([ 'segment_id' => '78261eea-8f8b-4381-83c6-79fa7120f1cf', 'from' => 'Acme <onboarding@resend.dev>', 'subject' => 'hello world', 'html' => 'Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}', 'send' => true,]);// Create and schedule$resend->broadcasts->create([ 'segment_id' => '78261eea-8f8b-4381-83c6-79fa7120f1cf', 'from' => 'Acme <onboarding@resend.dev>', 'subject' => 'hello world', 'html' => 'Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}', 'send' => true, 'scheduled_at' => 'in 1 hour',]);
import resendresend.api_key = "re_xxxxxxxxx"# Create a draft broadcastparams: resend.Broadcasts.CreateParams = { "segment_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "from": "Acme <onboarding@resend.dev>", "subject": "Hello, world!", "html": "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}",}resend.Broadcasts.create(params)# Create and send immediatelyparams: resend.Broadcasts.CreateParams = { "segment_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "from": "Acme <onboarding@resend.dev>", "subject": "Hello, world!", "html": "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}", "send": True,}resend.Broadcasts.create(params)# Create and scheduleparams: resend.Broadcasts.CreateParams = { "segment_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "from": "Acme <onboarding@resend.dev>", "subject": "Hello, world!", "html": "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}", "send": True, "scheduled_at": "in 1 hour",}resend.Broadcasts.create(params)
require "resend"Resend.api_key = "re_xxxxxxxxx"# Create a draft broadcastparams = { "segment_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "from": "Acme <onboarding@resend.dev>", "subject": "hello world", "html": "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}",}Resend::Broadcasts.create(params)# Create and send immediatelyparams = { "segment_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "from": "Acme <onboarding@resend.dev>", "subject": "Hello, world!", "html": "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}", "send": true,}Resend::Broadcasts.create(params)# Create and scheduleparams = { "segment_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "from": "Acme <onboarding@resend.dev>", "subject": "Hello, world!", "html": "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}", "send": true, "scheduled_at": "in 1 hour",}Resend::Broadcasts.create(params)
package mainimport "github.com/resend/resend-go/v4"func main() { client := resend.NewClient("re_xxxxxxxxx") // Create a draft broadcast params := &resend.CreateBroadcastRequest{ SegmentId: "78261eea-8f8b-4381-83c6-79fa7120f1cf", From: "Acme <onboarding@resend.dev>", Html: "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}", Subject: "Hello, world!", } client.Broadcasts.Create(params) // Create and send immediately params = &resend.CreateBroadcastRequest{ SegmentId: "78261eea-8f8b-4381-83c6-79fa7120f1cf", From: "Acme <onboarding@resend.dev>", Subject: "Hello, world!", Html: "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}", Send: true, } client.Broadcasts.Create(params) // Create and schedule params = &resend.CreateBroadcastRequest{ SegmentId: "78261eea-8f8b-4381-83c6-79fa7120f1cf", From: "Acme <onboarding@resend.dev>", Subject: "Hello, world!", Html: "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}", Send: true, ScheduledAt: "in 1 hour", } client.Broadcasts.Create(params)}
use resend_rs::{types::CreateBroadcastOptions, Resend, Result};#[tokio::main]async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let segment_id = "78261eea-8f8b-4381-83c6-79fa7120f1cf"; let from = "Acme <onboarding@resend.dev>"; let subject = "hello world"; let html = "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}"; let opts = CreateBroadcastOptions::new(segment_id, from, subject).with_html(html); // Create a draft broadcast let _broadcast = resend.broadcasts.create(opts.clone()).await?; // Create and send immediately let _broadcast = resend .broadcasts .create(opts.clone().with_send(true)) .await?; // Create and schedule let _broadcast = resend .broadcasts .create(opts.with_send(true).with_scheduled_at("in 1 hour")) .await?; Ok(())}
import com.resend.Resend;import com.resend.services.broadcasts.model.CreateBroadcastOptions;import com.resend.services.broadcasts.model.CreateBroadcastResponseSuccess;Resend resend = new Resend("re_xxxxxxxxx");// Create a draft broadcastCreateBroadcastOptions params = CreateBroadcastOptions.builder() .segmentId("78261eea-8f8b-4381-83c6-79fa7120f1cf") .from("Acme <onboarding@resend.dev>") .subject("hello world") .html("Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}") .build();CreateBroadcastResponseSuccess data = resend.broadcasts().create(params);// Create and send immediatelyCreateBroadcastOptions sendParams = CreateBroadcastOptions.builder() .segmentId("78261eea-8f8b-4381-83c6-79fa7120f1cf") .from("Acme <onboarding@resend.dev>") .subject("hello world") .html("Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}") .send(true) .build();CreateBroadcastResponseSuccess sent = resend.broadcasts().create(sendParams);// Create and scheduleCreateBroadcastOptions scheduleParams = CreateBroadcastOptions.builder() .segmentId("78261eea-8f8b-4381-83c6-79fa7120f1cf") .from("Acme <onboarding@resend.dev>") .subject("hello world") .html("Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}") .send(true) .scheduledAt("in 1 hour") .build();CreateBroadcastResponseSuccess scheduled = resend.broadcasts().create(scheduleParams);
using Resend;IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI// Create a draft broadcastvar resp = await resend.BroadcastAddAsync( new BroadcastData() { DisplayName = "Example Broadcast", SegmentId = new Guid( "78261eea-8f8b-4381-83c6-79fa7120f1cf" ), From = "Acme <onboarding@resend.dev>", Subject = "Hello, world!", HtmlBody = "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}", });Console.WriteLine( "Broadcast Id={0}", resp.Content );// Create and send immediatelyvar sent = await resend.BroadcastAddAsync( new BroadcastData() { DisplayName = "Example Broadcast", SegmentId = new Guid( "78261eea-8f8b-4381-83c6-79fa7120f1cf" ), From = "Acme <onboarding@resend.dev>", Subject = "Hello, world!", HtmlBody = "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}", SendAfterAdd = true, });Console.WriteLine( "Broadcast Id={0}", sent.Content );// Create and schedulevar scheduled = await resend.BroadcastAddAsync( new BroadcastData() { DisplayName = "Example Broadcast", SegmentId = new Guid( "78261eea-8f8b-4381-83c6-79fa7120f1cf" ), From = "Acme <onboarding@resend.dev>", Subject = "Hello, world!", HtmlBody = "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}", SendAfterAdd = true, MomentSchedule = DateTime.UtcNow.AddHours( 1 ), });Console.WriteLine( "Broadcast Id={0}", scheduled.Content );
# Create a draft broadcastcurl -X POST 'https://api.resend.com/broadcasts' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'{ "segment_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "from": "Acme <onboarding@resend.dev>", "subject": "hello world", "html": "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}"}'# Create and send immediatelycurl -X POST 'https://api.resend.com/broadcasts' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'{ "segment_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "from": "Acme <onboarding@resend.dev>", "subject": "hello world", "html": "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}", "send": true}'# Create and schedulecurl -X POST 'https://api.resend.com/broadcasts' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'{ "segment_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "from": "Acme <onboarding@resend.dev>", "subject": "hello world", "html": "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}", "send": true, "scheduled_at": "in 1 hour"}'
# Create a draft broadcastresend broadcasts create \ --from "Acme <onboarding@resend.dev>" \ --subject "hello world" \ --segment-id 78261eea-8f8b-4381-83c6-79fa7120f1cf \ --html "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}"# Create and send immediatelyresend broadcasts create \ --from "Acme <onboarding@resend.dev>" \ --subject "hello world" \ --segment-id 78261eea-8f8b-4381-83c6-79fa7120f1cf \ --html "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}" \ --send# Create and scheduleresend broadcasts create \ --from "Acme <onboarding@resend.dev>" \ --subject "hello world" \ --segment-id 78261eea-8f8b-4381-83c6-79fa7120f1cf \ --html "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}" \ --send \ --scheduled-at "in 1 hour"