{
  "name": "Cornersight \u2192 Google Sheets lead log",
  "nodes": [
    {
      "parameters": {
        "content": "## Cornersight \u2192 Google Sheets lead log\n1. Open **Cornersight webhook**, copy the Production URL.\n2. Paste it in Cornersight: source \u2192 webhook settings.\n3. Make a Google Sheet with a tab called **Leads** and a header row: leadId, detectedAt, name, jobTitle, company, companyDomain, companyIndustry, companyStaffRange, country, linkedinUrl, email, isIcp, engagementType, commentText, postUrl, source.\n4. In **Add or update row**: connect Google, pick your Sheet.\n5. Activate.\n\nRows update on leadId, so retries never create duplicates. `email` is only filled if you connect your own email finder in Cornersight.",
        "height": 340,
        "width": 520
      },
      "id": "dd7f0fab-bb25-4827-ad8d-c96b86b596bd",
      "name": "Read me",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -40,
        -380
      ]
    },
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "cornersight-lead-log",
        "options": {}
      },
      "id": "977eeb84-1448-4e5b-b3a1-9cf45630d82a",
      "name": "Cornersight webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        0,
        0
      ],
      "webhookId": "334eb682-9e4a-43b9-b494-a44e2aa5a8bb"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "c9e8e86e-6423-4e2f-8e4a-2f10f0de7338",
              "name": "leadId",
              "value": "={{ $json.body.data.leadId }}",
              "type": "string"
            },
            {
              "id": "d8303e0b-b265-416a-b167-5f12ce132562",
              "name": "detectedAt",
              "value": "={{ $json.body.timestamp }}",
              "type": "string"
            },
            {
              "id": "24b4cd05-9bd9-44c6-ba73-ce12d84b24cc",
              "name": "name",
              "value": "={{ $json.body.data.name }}",
              "type": "string"
            },
            {
              "id": "afec6226-d7b8-45ba-9562-6d8b6be3bdf1",
              "name": "jobTitle",
              "value": "={{ $json.body.data.jobTitle }}",
              "type": "string"
            },
            {
              "id": "9bd5f634-da0e-40b9-be1f-334041021a45",
              "name": "company",
              "value": "={{ $json.body.data.companyName }}",
              "type": "string"
            },
            {
              "id": "0f3ad118-938d-4a52-8d25-672e144cf79a",
              "name": "companyDomain",
              "value": "={{ $json.body.data.companyDomain }}",
              "type": "string"
            },
            {
              "id": "79e2fae2-4e3f-422c-9a53-faced8eff39f",
              "name": "companyIndustry",
              "value": "={{ $json.body.data.companyIndustry }}",
              "type": "string"
            },
            {
              "id": "bb9d1b53-3d92-42f5-b6a0-0deeaf0ca850",
              "name": "companyStaffRange",
              "value": "={{ $json.body.data.companyStaffRange }}",
              "type": "string"
            },
            {
              "id": "e32e1327-b028-4493-b85d-b04335e2aa10",
              "name": "country",
              "value": "={{ $json.body.data.country }}",
              "type": "string"
            },
            {
              "id": "f8a7118b-abad-4801-b358-28e6d6e6e885",
              "name": "linkedinUrl",
              "value": "={{ $json.body.data.linkedinUrl }}",
              "type": "string"
            },
            {
              "id": "9e232ffc-05b6-4382-977b-c985842e9974",
              "name": "email",
              "value": "={{ $json.body.data.email ?? '' }}",
              "type": "string"
            },
            {
              "id": "9ed8743c-ba08-4442-be0e-09d010a07865",
              "name": "isIcp",
              "value": "={{ $json.body.data.isIcp }}",
              "type": "boolean"
            },
            {
              "id": "f38da489-82f5-4ed9-b75a-d0a0315af539",
              "name": "engagementType",
              "value": "={{ $json.body.data.engagementType }}",
              "type": "string"
            },
            {
              "id": "24cc885f-fcdd-4f0b-a849-76594b1f1fa3",
              "name": "commentText",
              "value": "={{ $json.body.data.commentText ?? '' }}",
              "type": "string"
            },
            {
              "id": "eaa8a72c-64c2-45eb-93df-2911ce7cbd0c",
              "name": "postUrl",
              "value": "={{ $json.body.data.postUrl }}",
              "type": "string"
            },
            {
              "id": "f5717423-c35b-4339-ae28-fffea62dead3",
              "name": "source",
              "value": "={{ $json.body.data.trackedProfile }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "2baadef3-9ae5-4580-b619-a5e044f23426",
      "name": "Flatten lead",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        240,
        0
      ]
    },
    {
      "parameters": {
        "operation": "appendOrUpdate",
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "Leads"
        },
        "columns": {
          "mappingMode": "autoMapInputData",
          "value": {},
          "matchingColumns": [
            "leadId"
          ],
          "schema": []
        },
        "options": {}
      },
      "id": "e0554a25-fce5-43bd-bb83-531f2ed94b3d",
      "name": "Add or update row",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [
        480,
        0
      ]
    }
  ],
  "connections": {
    "Cornersight webhook": {
      "main": [
        [
          {
            "node": "Flatten lead",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Flatten lead": {
      "main": [
        [
          {
            "node": "Add or update row",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "pinData": {}
}