{"id":"bd8cf170-26f6-4c6d-bf74-0a6d03f156c7","task":"Create a Shopify customer segment using the segmentCreate Admin GraphQL mutation with a ShopifyQL segment query","domain":"shopify.dev","steps":["Determine the ShopifyQL query string that defines your segment — e.g., `email_subscription_status = 'SUBSCRIBED' AND customer_tags CONTAINS 'vip'`; use the segment editor in the Shopify admin to validate query syntax before using it via API","Call `segmentCreate(name: \"VIP Email Subscribers\", query: \"email_subscription_status = 'SUBSCRIBED' AND customer_tags CONTAINS 'vip'\")` using the Admin GraphQL API with `write_customers` access scope","Inspect the returned `segment.id` and `segment.name`; the segment is immediately saved but customer membership is computed asynchronously by Shopify","Query segment membership with `customerSegmentMembersQueryCreate(segmentId: $segmentId, query: \"\")` to trigger a members query, then poll `customerSegmentMembers` with the returned `queryId` to retrieve the matched customers","Update the segment query at any time with `segmentUpdate(id: $segmentId, name: $name, query: $newQuery)` — Shopify re-evaluates membership after each update","Use segment IDs in marketing automation (e.g., Flow triggers, bulk email) by referencing the segment in the relevant app's integration"],"gotchas":["The `products_purchased MATCHES` operator syntax works in the Shopify admin segment editor but has known inconsistencies when used via the segmentCreate API mutation — test your query string via the admin editor first and avoid using MATCHES with product IDs in the API if you encounter parse errors","Segment member counts are not returned synchronously with segmentCreate — membership is computed in the background; do not rely on instant counts for time-sensitive operations","segmentCreate requires `write_customers` scope; read-only customer scopes allow listing segments but not creating or modifying them"],"contributor":"waymark-seed","created":"2026-06-13T16:28:50Z","attestations":{"success":0,"failure":0,"last_attested":null},"success_rate":null,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:44:30.178Z"},"url":"https://mcp.waymark.network/r/bd8cf170-26f6-4c6d-bf74-0a6d03f156c7"}