Skip to Content
SDKsGoCampaigns

Campaigns

Scheduled, message-one-to-many blasts over a contact list. The campaign worker handles throttling automatically — use this for thousands of recipients instead of looping the SMS API.

GroupMethods
CampaignsListCampaigns, CreateCampaign, GetCampaign, CancelCampaign, DeleteCampaign, ListCampaignRecipients
campaign, err := client.CreateCampaign(ctx, sendafrica.CreateCampaignRequest{ Name: "Friday blast", Message: "Weekly offer inside", ContactListID: 7, ScheduledAt: time.Now().Add(24 * time.Hour), })
FieldNotes
NameCampaign display name
MessageThe SMS body sent to every recipient
ContactListIDThe contact list from Contacts
ScheduledAtWhen the campaign fires (time.Time)

Manage campaigns

list, err := client.ListCampaigns(ctx, sendafrica.PageQuery{Page: 1, PerPage: 25}) one, err := client.GetCampaign(ctx, campaign.ID) err = client.CancelCampaign(ctx, campaign.ID) // before it fires recipients, err := client.ListCampaignRecipients(ctx, campaign.ID, sendafrica.PageQuery{Page: 1, PerPage: 25}) err = client.DeleteCampaign(ctx, campaign.ID)

Campaigns are the right tool for large audiences. Per-recipient flexibility with live pacing is SMS.SendMany; single-call batching under 100 recipients is SMS.Bulk — see Bulk SMS.

Last updated on