Danh mục thao tác

Tạo / sửa phân khúc

crm.segments.saveMCP:crm_segments_saveBộ công cụ: Khách hàng

Create or change a saved contact filter.

Cần Idempotency-Key
Quyền: Khách hàng

Gọi bằng REST v2

curl -X POST https://zl.builera.app/api/public/v2/ops/crm.segments.save \
  -H "Authorization: Bearer za_live_…" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"name":"Nguyễn Văn A","filter":{}}'

Mỗi khoá/kết nối tối đa 300 lệnh đọc và 60 lệnh ghi mỗi phút. Gọi lại cùng Idempotency-Key trả đúng kết quả cũ, không làm lại.

Gọi qua MCP

{
  "method": "tools/call",
  "params": {
    "name": "crm_segments_save",
    "arguments": {
      "name": "Nguyễn Văn A",
      "filter": {}
    }
  }
}

Thêm https://zl.builera.app/mcp vào ứng dụng AI rồi cho phép kết nối; AI chỉ thấy công cụ trong bộ bạn chọn.

Kết quả

HTTP 200
{ "status": "succeeded", "operationId": "…", "data": { … } }

Ví dụ đầu vào

{
  "name": "Nguyễn Văn A",
  "filter": {}
}

Thay mã (id) mẫu bằng mã thật lấy từ các thao tác liệt kê/tìm kiếm.

Lược đồ đầu vào (JSON Schema)

{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 80
    },
    "filter": {
      "type": "object",
      "properties": {
        "search": {
          "type": "string",
          "maxLength": 100
        },
        "labelIds": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "uuid"
          },
          "maxItems": 50
        },
        "labelMode": {
          "type": "string",
          "enum": [
            "any",
            "all"
          ],
          "default": "any"
        },
        "excludeLabelIds": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "uuid"
          },
          "maxItems": 50
        },
        "stageIds": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "uuid"
          },
          "maxItems": 50
        },
        "noStage": {
          "type": "boolean"
        },
        "ownerIds": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "uuid"
          },
          "maxItems": 50
        },
        "sources": {
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 40
          },
          "maxItems": 20
        },
        "listIds": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "uuid"
          },
          "maxItems": 20
        },
        "accountId": {
          "type": "string",
          "format": "uuid"
        },
        "relations": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "stranger",
              "request_sent",
              "request_received",
              "friend",
              "blocked"
            ]
          },
          "maxItems": 5
        },
        "hasPhone": {
          "type": "boolean"
        },
        "hasZalo": {
          "type": "boolean"
        },
        "dnc": {
          "type": "string",
          "enum": [
            "exclude",
            "only",
            "include"
          ],
          "default": "include"
        },
        "interactedWithinDays": {
          "type": "integer",
          "minimum": 1,
          "maximum": 3650
        },
        "notInteractedDays": {
          "type": "integer",
          "minimum": 1,
          "maximum": 3650
        }
      },
      "additionalProperties": false
    },
    "expectedRevision": {
      "type": "integer",
      "minimum": 1,
      "description": "The `revision` you read; if it changed meanwhile the save answers conflict instead of overwriting."
    }
  },
  "required": [
    "name",
    "filter"
  ],
  "additionalProperties": false
}

Cùng bộ công cụ