{
  "id": "FQTzFipB62nOZedB",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Shopify Export Customers to Baserow",
  "tags": [],
  "nodes": [
    {
      "id": "40a0a103-5ea0-4fdb-a162-b9c548e2d773",
      "name": "Start Workflow",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        0,
        -120
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "50091792-007d-405d-b185-e64173dd370c",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -60,
        -400
      ],
      "parameters": {
        "width": 780,
        "height": 240,
        "content": "## Sync all Shopify customers to BaseRow table\n\n### Notes\n- Update the Endpoint in GraphQL node to reflect your Shopify store.\n- Create a shopify database with a customer table in Baserow.\n- Create columns in the Baserow customer table for first_name, last_name, and email.\n- It takes about 1 second per row to insert."
      },
      "typeVersion": 1
    },
    {
      "id": "ad16cc27-d69f-449f-8852-6b828a1f7a9c",
      "name": "hasMoreCustomers",
      "type": "n8n-nodes-base.if",
      "position": [
        520,
        -120
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "a31f61a1-242c-418b-8e5a-ad878a439246",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $json.data.customers.pageInfo.hasNextPage }}",
              "rightValue": "true"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "3bf273e2-4929-4fc2-8629-72b371bc8085",
      "name": "Shopify, customers",
      "type": "n8n-nodes-base.graphql",
      "position": [
        280,
        -120
      ],
      "parameters": {
        "query": "query ($pageSize: Int!, $cursor: String) {\n    customers(first: $pageSize, after: $cursor) {\n        nodes {\n            id\n            firstName\n            lastName\n            defaultEmailAddress {\n                emailAddress\n                marketingState\n            }\n            createdAt\n            updatedAt\n        }\n        pageInfo {\n            hasNextPage\n            endCursor\n        }\n    }\n}",
        "endpoint": "https://store99563.myshopify.com/admin/api/2025-04/graphql.json",
        "variables": "={\n    \"pageSize\": 100,\n    \"cursor\": {{ $if($json?.data?.customers?.pageInfo?.hasNextPage !== undefined, \"\\\"\" + $json.data.customers.pageInfo.endCursor + \"\\\"\", \"null\"); }}\n}",
        "authentication": "headerAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "06c8ae80-253a-4023-8fff-6be79654ef30",
      "name": "Baserow, InsertCustomer",
      "type": "n8n-nodes-base.baserow",
      "position": [
        1020,
        -140
      ],
      "parameters": {
        "tableId": 600803,
        "fieldsUi": {
          "fieldValues": [
            {
              "fieldId": 4865948,
              "fieldValue": "={{ $json.firstName }}"
            },
            {
              "fieldId": 4865951,
              "fieldValue": "={{ $json.lastName }}"
            },
            {
              "fieldId": 4865952,
              "fieldValue": "={{ $json.defaultEmailAddress.emailAddress }}"
            }
          ]
        },
        "operation": "create",
        "databaseId": 254123
      },
      "credentials": {
        "baserowApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "bb4c9760-da5d-4130-8d6e-366bdc924e91",
      "name": "Split Customer List",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        800,
        -140
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "data.customers.nodes"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "85fa23f8-406b-442f-831b-7d860e462dfa",
  "connections": {
    "Start Workflow": {
      "main": [
        [
          {
            "node": "Shopify, customers",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "hasMoreCustomers": {
      "main": [
        [
          {
            "node": "Split Customer List",
            "type": "main",
            "index": 0
          },
          {
            "node": "Shopify, customers",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Split Customer List",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Shopify, customers": {
      "main": [
        [
          {
            "node": "hasMoreCustomers",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Customer List": {
      "main": [
        [
          {
            "node": "Baserow, InsertCustomer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Baserow, InsertCustomer": {
      "main": [
        []
      ]
    }
  }
}