{
  "name": "Process Shopify lead emails from Gmail to HubSpot contacts and deals",
  "nodes": [
    {
      "id": null,
      "name": "Gmail Trigger",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        -480,
        -64
      ]
    },
    {
      "id": null,
      "name": "Get a message",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -208,
        -16
      ]
    },
    {
      "id": null,
      "name": "Extract From Email",
      "type": "n8n-nodes-base.function",
      "position": [
        -544,
        224
      ]
    },
    {
      "id": null,
      "name": "If Sender is Shopify",
      "type": "n8n-nodes-base.if",
      "position": [
        -320,
        224
      ]
    },
    {
      "id": null,
      "name": "Code",
      "type": "n8n-nodes-base.code",
      "position": [
        -480,
        448
      ]
    },
    {
      "id": null,
      "name": "Edit Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        -208,
        448
      ]
    },
    {
      "id": null,
      "name": "Create or update a contact",
      "type": "n8n-nodes-base.hubspot",
      "position": [
        -96,
        208
      ]
    },
    {
      "id": null,
      "name": "Create a deal",
      "type": "n8n-nodes-base.hubspot",
      "position": [
        -16,
        448
      ]
    },
    {
      "id": null,
      "name": "Sticky: Gmail Trigger",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -700,
        -120
      ],
      "parameters": {
        "width": 360,
        "height": 160,
        "content": "## Gmail Trigger\nPolls Gmail every minute and emits new emails into the flow."
      }
    },
    {
      "id": null,
      "name": "Sticky: Get Message",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -60,
        -120
      ],
      "parameters": {
        "width": 360,
        "height": 160,
        "content": "## Get Message\nFetches full email (body + metadata) for parsing."
      }
    },
    {
      "id": null,
      "name": "Sticky: Extract From Email",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -760,
        170
      ],
      "parameters": {
        "width": 380,
        "height": 160,
        "content": "## Extract From Email\nPulls sender address used for filtering/routing."
      }
    },
    {
      "id": null,
      "name": "Sticky: Shopify Filter",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -140,
        170
      ],
      "parameters": {
        "width": 360,
        "height": 160,
        "content": "## If Sender is Shopify\nProcesses only emails from Shopify (change to your source if needed)."
      }
    },
    {
      "id": null,
      "name": "Sticky: Parser",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -700,
        520
      ],
      "parameters": {
        "width": 420,
        "height": 200,
        "content": "## Code (Regex Parser)\nExtracts: name, email, city, phone, message, product_url, product_title.\nAdjust regex if your email format differs."
      }
    },
    {
      "id": null,
      "name": "Sticky: Normalize",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -20,
        520
      ],
      "parameters": {
        "width": 380,
        "height": 180,
        "content": "## Edit Fields\nNormalizes extracted values into clean JSON for HubSpot."
      }
    },
    {
      "id": null,
      "name": "Sticky: HubSpot Contact",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -300,
        80
      ],
      "parameters": {
        "width": 420,
        "height": 180,
        "content": "## HubSpot Contact\nCreates/updates a Contact (email, name, phone, city)."
      }
    },
    {
      "id": null,
      "name": "Sticky: HubSpot Deal",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        160,
        520
      ],
      "parameters": {
        "width": 440,
        "height": 200,
        "content": "## HubSpot Deal\nCreates a Deal linked to the Contact.\nSet your pipeline stage (replace `YOUR_STAGE_ID`)."
      }
    }
  ],
  "connections": {
    "Code": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Create or update a contact",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get a message": {
      "main": [
        [
          {
            "node": "Extract From Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gmail Trigger": {
      "main": [
        [
          {
            "node": "Get a message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract From Email": {
      "main": [
        [
          {
            "node": "If Sender is Shopify",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If Sender is Shopify": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create or update a contact": {
      "main": [
        [
          {
            "node": "Create a deal",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}