Create a segment
createSegmentSave a segment: subscribers that match rules. A segment only ever holds subscribed contacts. Rules: source eq (where they came from); created_at or last_order_at before or after a day; has_purchased eq true or false; order_count or total_spent gte or lte a number (spend in the store's currency); purchased_product_ids contains or excludes a product (bought it, or never did: a membership or a subscription sold as a product separates members from the rest); searched_terms contains or excludes a search exactly as typed on the store. match 'all' needs every rule, 'any' one of them. Answers with the segment's id and how many subscribers it holds now; the id names it for previewSend and draftCampaign. Nobody is mailed. readSegments lists the ones there are.
A change inside Kooga: it runs at once, as the person.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | What the segment is called | |
| match | No | all | |
| rules | Yes | ||
| description | No | ||
| workspaceId | No | The workspace, as listWorkspaces gives it (its id or slug). Leave it out when this connection reaches one workspace. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| segmentId | Yes | ||
| subscribers | Yes |