Create a segment from a campaign
Creates a segment of people who opened, clicked or did not open a campaign.
POST https://cotlet.dev/api/v1/campaign-monitor/campaigns/{campaign_id}/segment-from-campaigns
write
Does what Create Segment on the Snapshot page does. Returns the segment ID, which create_campaign_draft takes as recipients. Reaches no one and is deleted with one click in the app, so it does not wait for your OK. A new segment can take a while to calculate, so send to it later.
Parameters
| Name | Type | Description |
|---|---|---|
| campaign_id string required | string | Campaign ID from list_campaigns. |
| audience string required | string | opened (Email opened), clicked (Has any link clicked) or not_opened (Email not opened). |
| list_id string | string | List to build the segment on. Required when the campaign went to more than one list. |
| name string | string | Segment name. Renamed after creation in the segment builder. |
Request
curl -X POST https://cotlet.dev/api/v1/campaign-monitor/campaigns/c8e1d4a07b3f4a9e8d2c5b6a7f901234/segment-from-campaigns \
-H "Authorization: Bearer $COTLET_API_KEY" \
-H "Content-Type: application/json" \
-d '{"audience":"not_opened","list_id":"f2a9b7c1d3e44f08a6b5c4d3e2f10987","name":"Autumn sale: not opened"}' result = client.call("campaign-monitor", "create_segment_from_campaign", {"campaign_id":"c8e1d4a07b3f4a9e8d2c5b6a7f901234","audience":"not_opened","list_id":"f2a9b7c1d3e44f08a6b5c4d3e2f10987","name":"Autumn sale: not opened"}) const result = await cotlet.call('campaign-monitor', 'create_segment_from_campaign', {"campaign_id":"c8e1d4a07b3f4a9e8d2c5b6a7f901234","audience":"not_opened","list_id":"f2a9b7c1d3e44f08a6b5c4d3e2f10987","name":"Autumn sale: not opened"}); cotlet call campaign-monitor create_segment_from_campaign --data '{"campaign_id":"c8e1d4a07b3f4a9e8d2c5b6a7f901234","audience":"not_opened","list_id":"f2a9b7c1d3e44f08a6b5c4d3e2f10987","name":"Autumn sale: not opened"}' Example response
{
"segment_id": "9e2b5d8a1c7f4630b4a9d2e5f8c13706",
"name": "Autumn sale: not opened",
"list_id": "f2a9b7c1d3e44f08a6b5c4d3e2f10987",
"rule": "Email not opened",
"source_campaign_id": "c8e1d4a07b3f4a9e8d2c5b6a7f901234"
}