{
  "name": "Segment retail customers by purchase behavior with CRM and Google Sheets",
  "nodes": [
    {
      "id": "44391a41-186b-4128-b2e4-2a02e08e9818",
      "name": "Normalize Customer Purchase Data",
      "type": "n8n-nodes-base.set",
      "position": [
        -96,
        -16
      ]
    },
    {
      "id": "a3ea830c-4b56-4726-9e0c-e118c28d6b3f",
      "name": "Sync Customer Segment to CRM",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1376,
        -32
      ]
    },
    {
      "id": "71b3a234-7a27-453b-943f-d29e70e49800",
      "name": "Append or update row in sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1632,
        -32
      ]
    },
    {
      "id": "d7d4da49-28fa-458e-922a-69f3bee77ff5",
      "name": "Assign New Customer Segment",
      "type": "n8n-nodes-base.set",
      "position": [
        720,
        -144
      ]
    },
    {
      "id": "269be1fa-39db-42cc-91b6-c28dc7990947",
      "name": "Assign Repeat Customer Segment",
      "type": "n8n-nodes-base.set",
      "position": [
        720,
        112
      ]
    },
    {
      "id": "bee2914d-5d44-44a3-9145-3957ad1dd1dd",
      "name": "Normalize Customer Segment Output",
      "type": "n8n-nodes-base.set",
      "position": [
        1152,
        -32
      ]
    },
    {
      "id": "1c544388-652a-4498-aef2-f159c8981fa3",
      "name": "Validate Customer Event",
      "type": "n8n-nodes-base.if",
      "position": [
        112,
        -16
      ]
    },
    {
      "id": "35c6ce52-2db8-44fe-ac25-e34d74e68398",
      "name": "Determine Customer Segment",
      "type": "n8n-nodes-base.switch",
      "position": [
        368,
        -64
      ]
    },
    {
      "id": "2f0f267b-8590-4c30-809e-d2f3189d3b5d",
      "name": "Assign VIP Customer Segment",
      "type": "n8n-nodes-base.set",
      "position": [
        720,
        -336
      ]
    },
    {
      "id": "13b72072-cfd3-4cb8-8709-8848318a7a8a",
      "name": "Assign Inactive Customer Segment",
      "type": "n8n-nodes-base.set",
      "position": [
        720,
        256
      ]
    },
    {
      "id": "7fe02f08-f487-4bb3-ae86-5145a884052d",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1136,
        -288
      ],
      "parameters": {
        "width": 672,
        "height": 528,
        "content": "## (Retail) Auto-Segment Customers by Purchase Behavior (Overview)\n\n### How it works\nThis workflow listens for customer or order events from platforms like WooCommerce, Shopify, or a CRM using a webho"
      }
    },
    {
      "id": "5612b1c3-30aa-42e2-8032-af8a6699ed13",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -400,
        -272
      ],
      "parameters": {
        "width": 672,
        "height": 512,
        "content": "## Event Intake & Data Normalization\n\nThis section receives customer or order events via webhook and converts raw payloads into a consistent structure. Key attributes like customer ID, email, order co"
      }
    },
    {
      "id": "cb027141-e08a-4b3f-a40e-0bbeac941991",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        336,
        -576
      ],
      "parameters": {
        "width": 736,
        "height": 1024,
        "content": "## Customer Segmentation Rules\n\nThis section determines which segment a customer belongs to using rule-based logic. Customers are classified as VIP, new, repeat, or inactive based on purchase frequenc"
      }
    },
    {
      "id": "d490b0f6-1391-4b97-9be0-5ce04469c1d5",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1104,
        -288
      ],
      "parameters": {
        "width": 736,
        "height": 544,
        "content": "## Sync Segment & Log Activity\n\nAfter a segment is assigned, the workflow prepares a clean output payload. Customer segment tags are synced to a CRM or email platform and each segmentation event is lo"
      }
    },
    {
      "id": "f9e7f43e-8e29-4f1d-8734-6755906a83a1",
      "name": "Receive Customer Order or Update Event",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -336,
        -16
      ]
    }
  ],
  "connections": {
    "Validate Customer Event": {
      "main": [
        [
          {
            "node": "Determine Customer Segment",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "Determine Customer Segment": {
      "main": [
        [
          {
            "node": "Assign VIP Customer Segment",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Assign New Customer Segment",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Assign Repeat Customer Segment",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Assign Inactive Customer Segment",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Assign New Customer Segment": {
      "main": [
        [
          {
            "node": "Normalize Customer Segment Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Assign VIP Customer Segment": {
      "main": [
        [
          {
            "node": "Normalize Customer Segment Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sync Customer Segment to CRM": {
      "main": [
        [
          {
            "node": "Append or update row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Assign Repeat Customer Segment": {
      "main": [
        [
          {
            "node": "Normalize Customer Segment Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Assign Inactive Customer Segment": {
      "main": [
        [
          {
            "node": "Normalize Customer Segment Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize Customer Purchase Data": {
      "main": [
        [
          {
            "node": "Validate Customer Event",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize Customer Segment Output": {
      "main": [
        [
          {
            "node": "Sync Customer Segment to CRM",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Receive Customer Order or Update Event": {
      "main": [
        [
          {
            "node": "Normalize Customer Purchase Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}