Create segment

Create a reusable segment on a list from conditions on tags, fields, dates, source or campaign and contact activity.

MCP tool emailoctopus_write → create_segment

write

Saves a segment on the Segments tab of the Contacts page and returns it. match is all, any or none, as in the segment editor. Each condition has a type, an operator in the words of the editor (for example "did not open", "was sent", "active or added within") and a value such as a campaign name, a tag or a number of days. Contact activity looks back at most 365 days. The segment holds no email by itself, so creating it reaches no one; it only changes who a later campaign or bulk action can pick.

Parameters

Parameters: create_segment
NameTypeDescription
list_id string required string List ID from list_lists.
name string required string Name of the segment.
match enum required enum all, any or none of the conditions must match.
conditions array required array Objects with type, operator and value. type: first_name, last_name, field, date_created, last_updated, source, segment, campaign_activity, contact_activity or tag.

tools/call

JSON-RPC

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "emailoctopus_write",
    "arguments": {
      "operation": "create_segment",
      "arguments": {
        "list_id": "4d1c8e5a-7f2b-4c1e-9a63-0b5d2e8f1a37",
        "name": "Did not open: Autumn offer",
        "match": "all",
        "conditions": [
          {
            "type": "campaign_activity",
            "operator": "did not open",
            "value": "Autumn offer"
          },
          {
            "type": "campaign_activity",
            "operator": "was sent",
            "value": "Autumn offer"
          }
        ]
      }
    }
  }
}

Example response

JSON

{
  "content": [
    {
      "type": "text",
      "text": "{ ... same JSON as structuredContent ... }"
    }
  ],
  "structuredContent": {
    "segment": "Did not open: Autumn offer",
    "list_id": "4d1c8e5a-7f2b-4c1e-9a63-0b5d2e8f1a37",
    "match": "all",
    "conditions": [
      "Campaign activity: did not open, Autumn offer",
      "Campaign activity: was sent, Autumn offer"
    ],
    "created": true
  },
  "isError": false
}

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.