{
  "name": "Website lead capture → Google Sheets + instant email alert",
  "nodes": [
    {
      "parameters": {
        "content": "## Website lead capture\nPOST your form to the Webhook URL (fields: name, email, company, message).\n1. Connect Google Sheets and Gmail credentials\n2. Set your sheet URL and alert email\n\nBuilt by SixSol Technologies · sixsol.co.uk",
        "height": 300,
        "width": 420
      },
      "id": "59baa925-1c1d-5158-bda1-590e386e78cc",
      "name": "Read me",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -80,
        -260
      ]
    },
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "website-lead",
        "responseMode": "responseNode",
        "options": {}
      },
      "id": "e93c7cdf-6f20-5f5d-91ce-b64788d84984",
      "name": "Form webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        0,
        80
      ],
      "webhookId": "ebeb8d5b-ed41-50bc-b880-a814b1696d31"
    },
    {
      "parameters": {
        "mode": "manual",
        "assignments": {
          "assignments": [
            {
              "id": "a1",
              "name": "name",
              "value": "={{ ($json.body.name || '').trim() }}",
              "type": "string"
            },
            {
              "id": "a2",
              "name": "email",
              "value": "={{ ($json.body.email || '').trim().toLowerCase() }}",
              "type": "string"
            },
            {
              "id": "a3",
              "name": "company",
              "value": "={{ $json.body.company || '' }}",
              "type": "string"
            },
            {
              "id": "a4",
              "name": "message",
              "value": "={{ $json.body.message || '' }}",
              "type": "string"
            },
            {
              "id": "a5",
              "name": "received_at",
              "value": "={{ $now.toISO() }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "88a75274-4ab9-574a-92f1-cfb65772649d",
      "name": "Clean fields",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        220,
        80
      ]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose"
          },
          "conditions": [
            {
              "id": "c1",
              "leftValue": "={{ $json.email }}",
              "rightValue": "^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$",
              "operator": {
                "type": "string",
                "operation": "regex"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "6d4cf1ae-b947-5734-99c3-5800e237d199",
      "name": "Valid email?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        440,
        80
      ]
    },
    {
      "parameters": {
        "operation": "appendOrUpdate",
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": "https://docs.google.com/spreadsheets/d/YOUR_SHEET_ID/edit"
        },
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "Leads"
        },
        "columns": {
          "mappingMode": "autoMapInputData",
          "value": {},
          "matchingColumns": [
            "email"
          ]
        },
        "options": {}
      },
      "id": "6e35eaa4-3530-5102-bbac-364967436774",
      "name": "Save lead",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [
        680,
        -20
      ]
    },
    {
      "parameters": {
        "sendTo": "you@yourcompany.com",
        "subject": "=New lead: {{ $json.name }} ({{ $json.company }})",
        "emailType": "text",
        "message": "=Name: {{ $json.name }}\nEmail: {{ $json.email }}\nCompany: {{ $json.company }}\n\n{{ $json.message }}",
        "options": {}
      },
      "id": "7f8067c9-0b1e-5c32-bcc5-504f37f9d592",
      "name": "Email alert",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        900,
        -20
      ]
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={\"ok\": true}",
        "options": {}
      },
      "id": "0d9f9397-442c-5339-8eaa-ecdbd9fc859d",
      "name": "Reply OK",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [
        1120,
        -20
      ]
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={\"ok\": false, \"error\": \"invalid email\"}",
        "options": {
          "responseCode": 422
        }
      },
      "id": "826587f3-ed7b-546c-9b5e-e4531b17094e",
      "name": "Reply invalid",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [
        680,
        200
      ]
    }
  ],
  "connections": {
    "Form webhook": {
      "main": [
        [
          {
            "node": "Clean fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Clean fields": {
      "main": [
        [
          {
            "node": "Valid email?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Valid email?": {
      "main": [
        [
          {
            "node": "Save lead",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Reply invalid",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save lead": {
      "main": [
        [
          {
            "node": "Email alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Email alert": {
      "main": [
        [
          {
            "node": "Reply OK",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "pinData": {},
  "meta": {
    "templateCredsSetupCompleted": false,
    "templateBy": "SixSol Technologies · https://www.sixsol.co.uk/n8n-templates/"
  },
  "tags": []
}