{
  "name": "Auto Lead Response — Email + Google Sheets",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "lead-form",
        "responseMode": "responseNode"
      },
      "id": "a1b2c3d4-0001-4000-8000-000000000001",
      "name": "Webhook — Terima Data Form",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        250,
        300
      ],
      "webhookId": "lead-form-webhook"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "set1",
              "name": "nama",
              "value": "={{ $json.body.nama }}",
              "type": "string"
            },
            {
              "id": "set2",
              "name": "email",
              "value": "={{ $json.body.email }}",
              "type": "string"
            },
            {
              "id": "set3",
              "name": "phone",
              "value": "={{ $json.body.phone }}",
              "type": "string"
            },
            {
              "id": "set4",
              "name": "service",
              "value": "={{ $json.body.service }}",
              "type": "string"
            },
            {
              "id": "set5",
              "name": "timestamp",
              "value": "={{ $now.format(\"yyyy-MM-dd HH:mm:ss\") }}",
              "type": "string"
            }
          ]
        }
      },
      "id": "a1b2c3d4-0002-4000-8000-000000000002",
      "name": "Set — Format Data Lead",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        480,
        300
      ]
    },
    {
      "parameters": {
        "operation": "append",
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "=GANTI_DENGAN_SPREADSHEET_ID"
        },
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "Leads"
        },
        "columns": {
          "mappingMode": "autoMapInputData",
          "value": {}
        }
      },
      "id": "a1b2c3d4-0003-4000-8000-000000000003",
      "name": "Google Sheets — Simpan Lead",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [
        720,
        200
      ]
    },
    {
      "parameters": {
        "sendTo": "={{ $json.email }}",
        "subject": "Terima kasih {{ $json.nama }}! Kami sudah terima pesan Anda",
        "message": "Halo {{ $json.nama }},\n\nTerima kasih sudah menghubungi kami! Tim kami akan segera meninjau kebutuhan Anda terkait {{ $json.service }}.\n\nKami akan menghubungi Anda dalam 1x24 jam.\n\nSalam,\nTim Anda"
      },
      "id": "a1b2c3d4-0004-4000-8000-000000000004",
      "name": "Email — Auto Reply ke Lead",
      "type": "n8n-nodes-base.emailSend",
      "typeVersion": 2.1,
      "position": [
        720,
        400
      ]
    },
    {
      "parameters": {
        "respondWith": "text",
        "responseBody": "{\"status\":\"ok\",\"message\":\"Lead diterima\"}"
      },
      "id": "a1b2c3d4-0005-4000-8000-000000000005",
      "name": "Respond — Konfirmasi",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [
        960,
        300
      ]
    }
  ],
  "connections": {
    "Webhook — Terima Data Form": {
      "main": [
        [
          {
            "node": "Set — Format Data Lead",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set — Format Data Lead": {
      "main": [
        [
          {
            "node": "Google Sheets — Simpan Lead",
            "type": "main",
            "index": 0
          },
          {
            "node": "Email — Auto Reply ke Lead",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets — Simpan Lead": {
      "main": [
        [
          {
            "node": "Respond — Konfirmasi",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "meta": {
    "templateId": "mcsyauqi-lead-response-01"
  }
}