Create campaign draft

Save a campaign flow draft with its segments and first Send Message block. Sends nothing.

POST https://cotlet.dev/api/v1/postscript/campaigns

write

Creates the flow under Messaging > Create Campaign > Create Campaign Flow and saves it with Save Flow, so status is draft. You choose the Include and Exclude segments (up to 10 in total), whether to exclude customers messaged in the last 16 hours, and an optional cancellation trigger such as Order Created. The draft holds one Send Message block. Splits, delays and branch messages you add in Flow Builder. It reaches nobody, so it does not wait for your OK; schedule_campaign does.

Parameters

Parameters: create_campaign
NameTypeDescription
name string required string Campaign name.
include_segments array required array Segment names to send to.
exclude_segments array array Segment names to leave out.
exclude_recently_messaged boolean boolean Exclude customers messaged in the last 16 hours. Default: false.
cancel_on string string Cancellation trigger that removes a subscriber from the flow, for example Order Created.
message string required string Text of the first Send Message block.

Request

cURL
curl -X POST https://cotlet.dev/api/v1/postscript/campaigns \
  -H "Authorization: Bearer $COTLET_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"VIP drop","include_segments":["VIPACCESS opt-ins"],"exclude_recently_messaged":true,"cancel_on":"Order Created","message":"The VIP drop is open. Shop the new roast before anyone else: northwind.example/vip"}'
Python
result = client.call("postscript", "create_campaign", {"name":"VIP drop","include_segments":["VIPACCESS opt-ins"],"exclude_recently_messaged":True,"cancel_on":"Order Created","message":"The VIP drop is open. Shop the new roast before anyone else: northwind.example/vip"})
Node.js
const result = await cotlet.call('postscript', 'create_campaign', {"name":"VIP drop","include_segments":["VIPACCESS opt-ins"],"exclude_recently_messaged":true,"cancel_on":"Order Created","message":"The VIP drop is open. Shop the new roast before anyone else: northwind.example/vip"});
CLI
cotlet call postscript create_campaign --data '{"name":"VIP drop","include_segments":["VIPACCESS opt-ins"],"exclude_recently_messaged":true,"cancel_on":"Order Created","message":"The VIP drop is open. Shop the new roast before anyone else: northwind.example/vip"}'

Example response

JSON

{
  "campaign_id": "f_51877",
  "name": "VIP drop",
  "status": "draft",
  "include_segments": [
    "VIPACCESS opt-ins"
  ],
  "exclude_recently_messaged": true,
  "cancel_on": "Order Created"
}

Sign in once. Your agent does the rest.

Sign up and add the apps you need. Free 7-day trial with 2,000 credits, no card needed.