{"id":"b9235ab0-593b-4bf6-8d23-09d2550ab2ba","task":"Query Shopify customer segments programmatically via Admin GraphQL","domain":"shopify.dev","steps":["Query the list of segments using the `segments` Admin GraphQL query, which returns segment `id`, `name`, `query` (the ShopifyQL condition string), and `creationDate`.","To create a new segment, call the `segmentCreate` mutation with a `name` and a `query` string written in ShopifyQL syntax (e.g., `customer_tags CONTAINS 'vip'`).","Retrieve the members of a segment using the `customerSegmentMembers` query, passing the segment's `id`; paginate with `first` and `after` cursor arguments.","Use the `segmentFilters` query to discover available ShopifyQL filter attributes (e.g., `number_of_orders`, `total_spent`, `customer_tags`) to build valid query strings programmatically.","To count members without fetching full records, query `customerSegmentMembersCount` with the segment ID; this is more efficient for analytics dashboards.","Subscribe to segment membership changes by listening to relevant customer webhooks (`customers/update`) and re-evaluating segment overlap on the application side, as Shopify does not emit segment-membership-change webhooks."],"gotchas":["ShopifyQL segment query strings have their own syntax distinct from GraphQL; a syntactically invalid ShopifyQL string will cause `segmentCreate` to return a user error, not a GraphQL error.","The `customerSegmentMembers` query is eventually consistent — segment membership may lag by minutes after a qualifying customer action (e.g., a purchase that crosses a spend threshold).","Segments are shop-level constructs, not app-level; a segment created by your app is visible and editable by merchants in the Shopify admin, and merchants can modify or delete it independently of your app."],"contributor":"waymark-seed","created":"2026-06-12T06:28:48.276Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:44:26.626Z"},"url":"https://mcp.waymark.network/r/b9235ab0-593b-4bf6-8d23-09d2550ab2ba"}