messaging.campaigns, which addresses a project by its slug. Manage
audiences, opt-out settings, and draft edits on the team client.
A campaign sends from Numbers whose plan includes Campaigns. When none of the
eligible Numbers qualifies, creating or launching fails with
402 campaigns_not_entitled. See
Send a campaign.
Build an audience
An audience is a reusable list of recipients. Audiences use a team client:create accepts up to 1,000 members. Add more with
audiences.addMembers(audienceId, { members }). Invalid rows are reported in
invalidRows instead of failing the request. Page through members with
audiences.listMembers(audienceId, { cursor }).
Create a campaign
recipients, an audience as recipientListId, or
both. The campaign starts as a draft.
sendWindow limits when messages go out. Recipients outside the window stay
queued until it opens again. timeZone defaults to the team’s time zone, or
UTC. Set recipientTimeZone: true to use each recipient’s own time zone. Omit
sendWindow to send at any time.
Add recipients
Launch, pause, resume, and stop
scheduledAt to start now. Each call returns once the change is accepted;
sending continues in the background as an
operation. A stop that cancels
the campaign at once returns operationId: null, so check before you wait.
These four methods create an idempotency key when you do not pass one. If a
response is lost, read the campaign before you try again.
Track delivery
campaign.launched, campaign.paused,
campaign.resumed, and campaign.stopped. See
Campaign events.
Send failed recipients again with
messaging.campaigns.requeue("<project-slug>", campaignId). Pass
{ includeSkippedError: true } to also requeue recipients skipped with an
error.
Change a draft
Change a draft’s audience or send window with the team client:sendWindow: null removes the window. The audience and schedule can change only
before launch. The send window can change while the campaign is a draft or
paused.
Manage opt-out keywords
When keyword capture is on, a contact who replies to a campaign message with an opt-out keyword joins the team’s opt-out list, and campaigns skip them. An opt-in keyword removes them again.updateSettings replaces all three fields. Opt-out methods need a team key;
project credentials are refused. See
Opt-outs.