Create an email campaign draft
Create an email campaign draft from a template, with subject and recipients.
POST https://cotlet.dev/api/v1/privy/email-campaigns
write
Does what Campaigns > Send email does up to the Review step. The design is the template as saved, so a Saved Template you update each week carries the content. From name, From Email and Reply To use your Settings defaults. The draft sends nothing, reaches no one and can be deleted from the Campaigns menu, so it does not wait for your OK.
Parameters
| Name | Type | Description |
|---|---|---|
| name string required | string | Campaign name |
| template string required | string | Name of a Privy Template or Saved Template as shown in the template picker |
| subject_line string required | string | Subject line |
| preview_text string | string | Preview text |
| segment_ids array required | array | Segments to send to (ids from list_segments) |
| exclude_segment_ids array | array | Segments to leave out |
Request
curl -X POST https://cotlet.dev/api/v1/privy/email-campaigns \
-H "Authorization: Bearer $COTLET_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name":"Weekly picks, 27 Oct","template":"Weekly picks","subject_line":"Five picks for your weekend","preview_text":"New arrivals and one restock","segment_ids":["seg_2b11"]}' result = client.call("privy", "create_email_campaign", {"name":"Weekly picks, 27 Oct","template":"Weekly picks","subject_line":"Five picks for your weekend","preview_text":"New arrivals and one restock","segment_ids":["seg_2b11"]}) const result = await cotlet.call('privy', 'create_email_campaign', {"name":"Weekly picks, 27 Oct","template":"Weekly picks","subject_line":"Five picks for your weekend","preview_text":"New arrivals and one restock","segment_ids":["seg_2b11"]}); cotlet call privy create_email_campaign --data '{"name":"Weekly picks, 27 Oct","template":"Weekly picks","subject_line":"Five picks for your weekend","preview_text":"New arrivals and one restock","segment_ids":["seg_2b11"]}' Example response
{
"campaign_id": "cmp_6c15",
"title": "Weekly picks, 27 Oct",
"status": "draft",
"template": "Weekly picks",
"subject_line": "Five picks for your weekend",
"audience": {
"included_segments": [
"Engaged Contacts"
],
"excluded_segments": []
}
}