{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "7da8c35d-17c2-4aff-9d1c-b1d6efaf78e8",
      "name": "Setup Instructions",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        624,
        272
      ],
      "parameters": {
        "width": 712,
        "height": 508,
        "content": "\ud83d\udccb **SETUP REQUIRED:**\n\n1. **Create Google Sheet:**\n   - Make new sheet with these column headers:\n   - A1: Name | B1: Email | C1: Phone\n   - D1: Message | E1: Source | F1: Date\n\n2. **Get Sheet ID:**\n   - Copy from URL: docs.google.com/spreadsheets/d/[SHEET_ID]/edit\n   - Replace YOUR_GOOGLE_SHEET_ID in Google Sheets node\n\n3. **Connect Instagram Form:**\n   - Use webhook URL from this node\n   - Form fields: name, email, phone, message"
      },
      "typeVersion": 1
    },
    {
      "id": "10f48b95-3f43-4bda-be11-115dabc5d4ca",
      "name": "Instagram Lead Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        672,
        624
      ],
      "parameters": {
        "path": "instagram-leads",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 1
    },
    {
      "id": "a9544025-af6c-427a-985b-c16b286c4be2",
      "name": "Normalize Lead Data",
      "type": "n8n-nodes-base.code",
      "position": [
        880,
        624
      ],
      "parameters": {
        "jsCode": "// Normalize Instagram lead data\nconst body = $input.first().json.body || $input.first().json;\n\n// Common Instagram lead fields - adapt based on your form structure\nconst normalizedData = {\n  name: body.name || body.full_name || body.firstName + ' ' + body.lastName || 'Unknown',\n  email: body.email || body.email_address || '',\n  phone: body.phone || body.phone_number || '',\n  message: body.message || body.comments || '',\n  source: 'Instagram',\n  timestamp: new Date().toISOString(),\n  raw_data: JSON.stringify(body)\n};\n\nconsole.log('Normalized Instagram Lead Data:', normalizedData);\n\nreturn {\n  json: normalizedData\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "bf561879-cf2f-43d7-b118-6906c8030e35",
      "name": "Save to Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1072,
        624
      ],
      "parameters": {
        "options": {
          "useAppend": true
        },
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "YOUR_GOOGLE_SHEET_ID"
        }
      },
      "typeVersion": 4
    }
  ],
  "connections": {
    "Normalize Lead Data": {
      "main": [
        [
          {
            "node": "Save to Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Instagram Lead Webhook": {
      "main": [
        [
          {
            "node": "Normalize Lead Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}