Create segment

Create a segment from activity, list and contact property filters.

MCP tool mailjet_write → create_segment

write

Does what Create a segment does on the Segmentation page. match "all" combines the filters with AND and "any" with OR. Pass list_id to get the number of contacts that match, as Calculate number of contacts does. The segment reaches no one and is undone by deleting it in the Dashboard, so it does not wait for your OK. Mailjet recalculates it at send time.

Parameters

Parameters: create_segment
NameTypeDescription
name string required string Name of the segment.
match enum enum all (AND) or any (OR). Default: all.
conditions array required array Filters as {type, value}. type: campaign_opened, campaign_not_opened, campaign_clicked or campaign_not_clicked (value: campaign_id); opened_last_days, not_opened_last_days, clicked_last_days or not_clicked_last_days (value: number of days); subscribed_to_list or not_subscribed_to_list (value: list_id); property (also field, operator and value).
list_id integer integer List to count the matching contacts against.

tools/call

JSON-RPC

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "mailjet_write",
    "arguments": {
      "operation": "create_segment",
      "arguments": {
        "name": "Did not open: Autumn offer",
        "match": "all",
        "conditions": [
          {
            "type": "campaign_not_opened",
            "value": 7164820931
          },
          {
            "type": "subscribed_to_list",
            "value": 10234567
          }
        ],
        "list_id": 10234567
      }
    }
  }
}

Example response

JSON

{
  "content": [
    {
      "type": "text",
      "text": "{ ... same JSON as structuredContent ... }"
    }
  ],
  "structuredContent": {
    "segment_id": 2938471,
    "name": "Did not open: Autumn offer",
    "match": "all",
    "conditions": 2,
    "matching_contacts": 1121,
    "list_id": 10234567
  },
  "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.