The campaign endpoints are in beta: through the API, you can read campaigns,
create, edit and delete drafts, review them and edit their messages. Launch
them in the app.
Campaign, step and message
- A campaign is what the app calls a campaign: its recipients, its steps and its status.
- A step is one email of the campaign: a template, written once with
{{variables}}, and sent to every recipient. The first step is the first email; the next ones are follow-ups, sent a number of days after the previous step, in the same email thread or not. A campaign with more than one step is what the app calls a sequence. - A message is the version of a step for one recipient, with the variables filled in. There is one message per recipient and per step.
Hi {{firstName}}, and the message to Alice reads Hi Alice.
Writing a step
The subject is plain text and the body is HTML, with variables written{{key}}, such as {{firstName}}. The create endpoint lists every variable. A text or numeric custom field of the campaign’s group is {{customFieldValues.grp_<uuid>.<field name>}}. A variable without a value for a recipient is removed.
Set bodyFormat: "text" to write the body as plain text: a blank line starts a new paragraph, and a single newline is a line break. Bodies always read back as HTML.
To sign a step with the sender’s signature, end its body with <p>{{signature}}</p>, and don’t write the signature yourself. A body without {{signature}} is sent unsigned. When you write back a body you read, the token keeps the step’s signature as it is, even if it was edited in the app.
Recipients
A campaign sends to people or to companies, never both. Pick its recipients from a list of ids, or from the contacts of a group, optionally filtered with the filter syntax of the people and companies endpoints. Recipients you can’t access are skipped, and recipients without an email address get no message: both are listed in thewarnings of the response.
Senders
Every step is sent from a sender of the workspace, set up in the app. Write it as{ "id": "snd_…" } or { "email": "…" }, either once for every step, or on every step. Without one, the campaign uses the sender you last used. Gmail senders can only send campaigns with a single step.
Review
Reviewing a campaign generates its messages from its steps, as the app does before launch. Create the campaign withtarget: "review", or review a draft with POST /v1/campaigns/:campaignId/review. Both answer 202 with the campaign processing: it becomes in_review within seconds, to poll with GET /v1/campaigns/:campaignId. If generation fails, the campaign is in_review with an error.
Every step needs a sender, a subject and a body, apart from follow-ups sent in the same thread, which take the subject of the first step.
While a campaign is in review:
- Edit a message with
PATCH /v1/campaigns/:campaignId/messages/:messageId, or up to 100 at once with the batch endpoint. The content of a message is final, so variables are rejected, apart from{{signature}}, which keeps the message’s signature, and{{unsubscribeLink}}, which links to the unsubscribe page of that message. - Remove a recipient with
DELETE /v1/campaigns/:campaignId/recipients/:contactId, which also works on drafts. - Put it back to draft with
POST /v1/campaigns/:campaignId/draftto edit its steps. Its messages are generated again on the next review, so edits to single messages are lost, as in the app.
409, with a Retry-After header while the campaign is processing.