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
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"`
}
The ID of the broadcast to update.
The updated segment ID to send the broadcast to.
Deprecated: Use SegmentId instead. Audiences have been renamed to Segments.
The updated sender email address.
The updated email subject line.
Updated array of reply-to email addresses.
The updated HTML content of the broadcast.
The updated plain text content of the broadcast.
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"`
}
The unique identifier of the updated broadcast.