{
  "name": "Trentzy: lead to Google Sheet",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "trentzy-lead",
        "options": {}
      },
      "id": "a1b2c3d4-0001-4000-8000-000000000001",
      "name": "Trentzy webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [0, 0],
      "webhookId": "trentzy-lead"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "c1",
              "leftValue": "={{ $json.body.type }}",
              "rightValue": "lead.created",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "a1b2c3d4-0002-4000-8000-000000000002",
      "name": "Only lead.created",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [240, 0]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "f1",
              "name": "Captured at",
              "value": "={{ $json.body.data.lead.completed_at || $json.body.data.lead.created_at }}",
              "type": "string"
            },
            {
              "id": "f2",
              "name": "Instagram",
              "value": "={{ $json.body.data.lead.customer.instagram_username }}",
              "type": "string"
            },
            {
              "id": "f3",
              "name": "Name",
              "value": "={{ $json.body.data.lead.customer.name }}",
              "type": "string"
            },
            {
              "id": "f4",
              "name": "Email",
              "value": "={{ $json.body.data.lead.customer.email }}",
              "type": "string"
            },
            {
              "id": "f5",
              "name": "Phone",
              "value": "={{ $json.body.data.lead.customer.phone }}",
              "type": "string"
            },
            {
              "id": "f6",
              "name": "Source",
              "value": "={{ $json.body.data.lead.source }}",
              "type": "string"
            },
            {
              "id": "f7",
              "name": "Automation",
              "value": "={{ $json.body.data.lead.automation_name }}",
              "type": "string"
            },
            {
              "id": "f8",
              "name": "Conversation",
              "value": "={{ $json.body.data.lead.links.conversation }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "a1b2c3d4-0003-4000-8000-000000000003",
      "name": "Pick columns",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [480, -80]
    },
    {
      "parameters": {
        "operation": "append",
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "columns": {
          "mappingMode": "autoMapInputData",
          "value": {},
          "matchingColumns": [],
          "schema": []
        },
        "options": {}
      },
      "id": "a1b2c3d4-0004-4000-8000-000000000004",
      "name": "Append to Google Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [720, -80]
    }
  ],
  "connections": {
    "Trentzy webhook": {
      "main": [
        [
          {
            "node": "Only lead.created",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Only lead.created": {
      "main": [
        [
          {
            "node": "Pick columns",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "Pick columns": {
      "main": [
        [
          {
            "node": "Append to Google Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "meta": {
    "templateCredsSetupCompleted": false,
    "description": "Paste the Webhook node's Production URL into Trentzy \u2192 Integrations \u2192 Webhooks as a new endpoint with the lead.created event, pick your spreadsheet and sheet in the last node, then activate."
  }
}
