Retrieves a paginated list of all broadcasts.
Methods
List
List() (ListBroadcastsResponse, error)
Lists all broadcasts using the default background context.
ListWithContext
ListWithContext(ctx context.Context) (ListBroadcastsResponse, error)
Lists all broadcasts with a custom context for cancellation and timeout control.
ListWithOptions
ListWithOptions(ctx context.Context, options *ListOptions) (ListBroadcastsResponse, error)
Lists broadcasts with pagination options.
Query Parameters
When using ListWithOptions, you can pass a ListOptions struct with the following fields:
The maximum number of broadcasts to return per page.
The number of broadcasts to skip before starting to return results.
Response
The object type, always list.
An array of broadcast objects.Show Broadcast properties
The object type, always broadcast.
The unique identifier for the broadcast.
The name of the broadcast.
The ID of the segment this broadcast is sent to.
The sender email address.
An array of reply-to email addresses.
The HTML content of the email.
The plain text content of the email.
The preview text that appears in email clients.
The current status of the broadcast.
ISO 8601 timestamp of when the broadcast was created.
ISO 8601 timestamp of when the broadcast is scheduled to be sent.
ISO 8601 timestamp of when the broadcast was sent.
Indicates whether there are more broadcasts available beyond the current page.
Example
package main
import (
"fmt"
"github.com/resend/resend-go/v2"
)
func main() {
client := resend.NewClient("re_123456789")
broadcasts, err := client.Broadcasts.List()
if err != nil {
panic(err)
}
fmt.Println("Total broadcasts:", len(broadcasts.Data))
for _, broadcast := range broadcasts.Data {
fmt.Printf("%s: %s (Status: %s)\n", broadcast.Id, broadcast.Name, broadcast.Status)
}
}
package main
import (
"context"
"fmt"
"github.com/resend/resend-go/v2"
)
func main() {
client := resend.NewClient("re_123456789")
options := &resend.ListOptions{
Limit: 10,
Offset: 0,
}
broadcasts, err := client.Broadcasts.ListWithOptions(context.Background(), options)
if err != nil {
panic(err)
}
fmt.Println("Has more:", broadcasts.HasMore)
}