younifyd
Menu

customerSegmentMembers

A paginated list of customers that belong to an individual Segment. Segments group customers based on criteria defined through ShopifyQL queries.

Use it in a workflow

  1. Add a step and choose the Shopify connector.
  2. Pick the customerSegmentMembers action (under Customer).
  3. Fill in the fields below, then reference the result from later steps as {{customersegmentmembers.response.data}}.

Query

This is the query the action sends by default. Edit it in the step's Query field to change which fields come back.

graphql
query CustomerSegmentMembers($segmentId: ID, $query: String, $queryId: ID, $timezone: String, $reverse: Boolean, $sortKey: String, $first: Int, $after: String, $last: Int, $before: String) {
  customerSegmentMembers(
    segmentId: $segmentId
    query: $query
    queryId: $queryId
    timezone: $timezone
    reverse: $reverse
    sortKey: $sortKey
    first: $first
    after: $after
    last: $last
    before: $before
  ) {
    edges {
      cursor
      node {
        amountSpent
        defaultAddress
        defaultEmailAddress
        defaultPhoneNumber
        displayName
        firstName
        id
        lastName
        lastOrderId
        mergeable
        note
        numberOfOrders
      }
    }
    pageInfo {
      endCursor
      hasNextPage
      hasPreviousPage
      startCursor
    }
    statistics
    totalCount
  }
}

Variables

Pass these as a JSON object in the step's Variables field.

segmentIdstring

The ID of the segment.

querystring

The query that's used to filter the members. The query is composed of a combination of conditions on facts about customers such as `email_subscription_status = 'SUBSCRIBED'` with [this syntax](https://shopify.dev/api/shopifyql/segment-query-language-reference).

queryIdstring

The ID of the segment members query.

timezonestring

The timezone that's used to interpret relative date arguments. The timezone defaults to UTC if the timezone isn't provided.

reverseboolean

Reverse the order of the list. The sorting behaviour defaults to ascending order.

sortKeystring

Sort the list by a given key. Valid values: • `created_at` - Sort by customer creation date • `first_order_date` - Sort by the date of the customer's first order • `last_abandoned_order_date` - Sort by the date of the customer's last abandoned checkout • `last_order_date` - Sort by the date of the customer's most recent order • `number_of_orders` - Sort by the total number of orders placed by the customer • `amount_spent` - Sort by the total amount the customer has spent across all orders Use with the `reverse` parameter to control sort direction (ascending by default, descending when reverse=true).

firstnumber

The first `n` elements from the [paginated list](https://shopify.dev/api/usage/pagination-graphql).

afterstring

The elements that come after the specified [cursor](https://shopify.dev/api/usage/pagination-graphql).

lastnumber

The last `n` elements from the [paginated list](https://shopify.dev/api/usage/pagination-graphql).

beforestring

The elements that come before the specified [cursor](https://shopify.dev/api/usage/pagination-graphql).

json
{
  "segmentId": "string",
  "query": "string",
  "queryId": "string",
  "timezone": "string",
  "reverse": false,
  "sortKey": "string",
  "first": 0,
  "after": "string",
  "last": 0,
  "before": "string"
}

Response

Read the result with {{customersegmentmembers.response.data.data.customerSegmentMembers}}. If the API returns errors, the step fails and they are at {{customersegmentmembers.response.data.errors}}.

edgesarray<object>
cursorobject
nodeobject
pageInfoobject
endCursorstring
hasNextPageboolean
hasPreviousPageboolean
startCursorstring
statisticsobject
totalCountnumber

Need more? See the Shopify guide for connection setup and behaviour shared by every action.