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
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
| Name | Type | Description |
|---|---|---|
| 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 -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"}' 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"}) 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"}); 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
{
"campaign_id": "f_51877",
"name": "VIP drop",
"status": "draft",
"include_segments": [
"VIPACCESS opt-ins"
],
"exclude_recently_messaged": true,
"cancel_on": "Order Created"
}