Bulk operation on graphql query

Hi all,

i am having trouble in performing bulkoperation in graphql can anybody tell me how to perform bulk operation on following query

{“query”: “{customerSegmentMembers(first: 1000, query: "customer_added_date >= -12m") {edges {node{id,firstName,lastName,defaultAddress {country,countryCode,phone} }}}}”}

Hey there is a guide here on how to do this Perform bulk operations with the GraphQL Admin API

Your graphql would need to look something like this, you cannot use parameters of first or query.

mutation {
    bulkOperationRunQuery(
     query: """
      {
        customerSegmentMembers {
            edges {
                node {
                    id
                    firstName
                    lastName
                    defaultAddress {
                        country
                        countryCodeV2
                        phone
                    }
                }
            }
        }
      }
      """
    ) {
      bulkOperation {
        id
        status
      }
      userErrors {
        field
        message
      }
    }
  }

You will also need to ensure you have permissions to access protected data Work with protected customer data

Lastly if you wanted to get only customers in the first 12 months you would need to process this in code from the bulk query results. Or alternatively you could use a flow to tag/untag customers and do a different query inside Shopify depending on what you are using it for.