Skip to main content

Update

Update a broadcast using the default context.
func (s *BroadcastsSvcImpl) Update(params *UpdateBroadcastRequest) (UpdateBroadcastResponse, error)

Parameters

params
*UpdateBroadcastRequest
required
The broadcast update parameters.

Returns

Returns an UpdateBroadcastResponse containing the updated broadcast ID.

Example

updateParams := &resend.UpdateBroadcastRequest{
  BroadcastId: "broadcast_123",
  Subject:     "Updated: Flash Sale Extended!",
  Html:        "<h1>Sale extended by 24 hours!</h1>",
  Text:        "Our flash sale has been extended!",
}

response, err := client.Broadcasts.Update(updateParams)
if err != nil {
  panic(err)
}

fmt.Println("Broadcast updated:", response.Id)

UpdateWithContext

Update a broadcast with a custom context.
func (s *BroadcastsSvcImpl) UpdateWithContext(ctx context.Context, params *UpdateBroadcastRequest) (UpdateBroadcastResponse, error)

Parameters

ctx
context.Context
required
Context for the request, useful for timeouts and cancellation.
params
*UpdateBroadcastRequest
required
The broadcast update parameters.

Returns

Returns an UpdateBroadcastResponse containing the updated broadcast ID.

Example

ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()

updateParams := &resend.UpdateBroadcastRequest{
  BroadcastId: "broadcast_123",
  Name:        "Summer Sale Campaign - Extended",
  Subject:     "Last Chance: Summer Sale!",
}

response, err := client.Broadcasts.UpdateWithContext(ctx, updateParams)
if err != nil {
  panic(err)
}

Types

UpdateBroadcastRequest

Request payload for updating a broadcast.
type UpdateBroadcastRequest struct {
  BroadcastId string   `json:"broadcast_id,omitempty"`
  SegmentId   string   `json:"segment_id,omitempty"`
  AudienceId  string   `json:"audience_id,omitempty"` // Deprecated: Use SegmentId instead
  From        string   `json:"from,omitempty"`
  Subject     string   `json:"subject,omitempty"`
  ReplyTo     []string `json:"reply_to,omitempty"`
  Html        string   `json:"html,omitempty"`
  Text        string   `json:"text,omitempty"`
  Name        string   `json:"name,omitempty"`
}
BroadcastId
string
required
The ID of the broadcast to update.
SegmentId
string
The updated segment ID to send the broadcast to.
AudienceId
string
Deprecated: Use SegmentId instead. Audiences have been renamed to Segments.
From
string
The updated sender email address.
Subject
string
The updated email subject line.
ReplyTo
[]string
Updated array of reply-to email addresses.
Html
string
The updated HTML content of the broadcast.
Text
string
The updated plain text content of the broadcast.
Name
string
The updated internal name for the broadcast.
You can only update broadcasts that are in “draft” status. Sent or scheduled broadcasts cannot be modified.

UpdateBroadcastResponse

Response from updating a broadcast.
type UpdateBroadcastResponse struct {
  Id string `json:"id"`
}
Id
string
The unique identifier of the updated broadcast.

Build docs developers (and LLMs) love