{
  "nodes": [
    {
      "id": "b99be5b1-f4a6-4d0f-af0d-4d2464be11c1",
      "name": "New Lead Captured",
      "type": "n8n-nodes-base.googleSheetsTrigger",
      "position": [
        -320,
        -580
      ],
      "parameters": {
        "event": "rowAdded",
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1562885128
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "$env.GOOGLE_SHEET_ID"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "e6efc842-fbb5-4d0d-949f-0b08a2612255",
      "name": "Initiate Voice Call (VAPI)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        120,
        -580
      ],
      "parameters": {
        "url": "https://api.vapi.ai/call",
        "method": "POST",
        "jsonBody": "={\n  \"assistantId\": \"add_id_here\",\n  \"phoneNumberId\": \"add_phone_number_id_here\",\n  \"customers\": [\n    {\n      \"number\": \"add_vapi_agent_phonenumber_here\"\n    }\n  ]\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "$env.VAPI_API_KEY"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "d8e5a345-a452-41ca-a7d1-e0d05a1fe565",
      "name": "Save Qualified Lead to CRM Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -100,
        -320
      ],
      "parameters": {
        "columns": {
          "value": {
            "Name": "={{$json.body.message.toolCallList[0].function.arguments.name}}",
            "Company": "={{$json.body.message.toolCallList[0].function.arguments.company_name}}",
            "Challenges": "={{$json.body.message.toolCallList[0].function.arguments.challenges}}"
          },
          "schema": [
            {
              "id": "Name",
              "type": "string",
              "display": true,
              "required": false
            },
            {
              "id": "Company",
              "type": "string",
              "display": true,
              "required": false
            },
            {
              "id": "Challenges",
              "type": "string",
              "display": true,
              "required": false
            }
          ],
          "mappingMode": "defineBelow",
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "$env.GOOGLE_SHEET_ID"
        },
        "authentication": "serviceAccount"
      },
      "typeVersion": 4.5
    },
    {
      "id": "0e5b636d-c8c4-4102-9c09-6a7373887e58",
      "name": "Send Call Data Acknowledgement",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        320,
        -320
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "3fc02fbd-935c-4c24-aeb8-aac8b3f14efa",
      "name": "Receive Lead Details from VAPI",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -460,
        -320
      ],
      "parameters": {
        "path": "60d5fdeb-b5d8-4e71-90d0-182acc695404",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "typeVersion": 2
    }
  ],
  "connections": {
    "New Lead Captured": {
      "main": [
        [
          {
            "node": "Initiate Voice Call (VAPI)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Receive Lead Details from VAPI": {
      "main": [
        [
          {
            "node": "Save Qualified Lead to CRM Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save Qualified Lead to CRM Sheet": {
      "main": [
        [
          {
            "node": "Send Call Data Acknowledgement",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}