{
  "name": "Bulk Retell Cold Caller",
  "nodes": [
    {
      "parameters": {
        "method": "POST",
        "url": "=https://api.retellai.com/v2/create-phone-call",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpCustomAuth",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer INSERT_YOUR_API_KEY"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n\n\"from_number\": \"+INSERT_YOUR_AGENT_PHONE_NUMBER\",\n\n\"to_number\": \"+{{ $json.Phone }}\",\n\n\"retell_llm_dynamic_variables\": {\n\n\"name\": \"{{ $json.Title }}\",\n\n\"custom_info\": \"Rating: {{ $json.Rating }} Reviews: {{ $json.Reviews }}\",\n\n\"email\": \"{{ $json.Email }}\",\n\n\"state\": \"{{ $json.State }}\",\n\n\"industry\": \"{{ $json.Category }}{{ $json.City }}\"\n\n},\n\n\"override_agent_id\": \"INSERT_AGENT_ID\"\n\n}\n",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        560,
        96
      ],
      "id": "6f3ef1af-b62c-4364-a2c5-03b597786cfc",
      "name": "Voice Call",
      "credentials": {
        "httpCustomAuth": {
          "id": "q9H6TMbsJVd54LWn",
          "name": "Custom Auth account 13"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "4e4f404a-59ec-4e42-8791-39e30b1d1c5d",
              "leftValue": "={{ $json.body.call.disconnection_reason }}",
              "rightValue": "agent_hangup",
              "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            },
            {
              "id": "c2c57f66-d8ea-484b-8ce9-366b604716c3",
              "leftValue": "={{ $json.body.call.disconnection_reason }}",
              "rightValue": "user_hangup",
              "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            }
          ],
          "combinator": "or"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        160,
        656
      ],
      "id": "eddc371b-e8d1-49c2-aa73-73a57b556bc8",
      "name": "Call Success?"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "9feac65a-ecff-4e29-9f11-5196b1ca1a72",
              "leftValue": "={{ $json.body.call.call_cost.total_duration_seconds }}",
              "rightValue": 0,
              "operator": {
                "type": "number",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        448,
        752
      ],
      "id": "17cb37a0-ca48-4d37-b0d2-efb02027bdc8",
      "name": "No Answer?"
    },
    {
      "parameters": {
        "operation": "update",
        "documentId": {
          "__rl": true,
          "value": "162izL9iXWeOdKsRLHX2POm2_XiP-e2tL9WC8SGKXqkc",
          "mode": "list",
          "cachedResultName": "DEmo 29.9. - - AI Lead Caller - autonoma.agency",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/162izL9iXWeOdKsRLHX2POm2_XiP-e2tL9WC8SGKXqkc/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "Call_Log",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/162izL9iXWeOdKsRLHX2POm2_XiP-e2tL9WC8SGKXqkc/edit#gid=0"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "Call ID": "={{ $json.body.call.call_id }}",
            "Call Status": "did not answer or declined"
          },
          "matchingColumns": [
            "Call ID"
          ],
          "schema": [
            {
              "id": "Call ID",
              "displayName": "Call ID",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Call Date",
              "displayName": "Call Date",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Name",
              "displayName": "Name",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Phone Number",
              "displayName": "Phone Number",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Email",
              "displayName": "Email",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Reason",
              "displayName": "Reason",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Replies",
              "displayName": "Replies",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Appointment Date",
              "displayName": "Appointment Date",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Call Status",
              "displayName": "Call Status",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Transcript",
              "displayName": "Transcript",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Duration (sec.)",
              "displayName": "Duration (sec.)",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Cost ($)",
              "displayName": "Cost ($)",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "row_number",
              "displayName": "row_number",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "number",
              "canBeUsedToMatch": true,
              "readOnly": true,
              "removed": true
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.6,
      "position": [
        736,
        752
      ],
      "id": "2b6e838e-7498-4fbc-9d1d-29bf1c0fc44f",
      "name": "Did not answer",
      "alwaysOutputData": true,
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "uJs2j7wVby6KZmho",
          "name": "Google Sheets account 9"
        }
      }
    },
    {
      "parameters": {
        "operation": "update",
        "documentId": {
          "__rl": true,
          "value": "1ioNixpsvtZ3x0TiGpagV5tqZEZCt4ieGxFzbZZyiU-U",
          "mode": "list",
          "cachedResultName": "Build - Lead List with Calls",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ioNixpsvtZ3x0TiGpagV5tqZEZCt4ieGxFzbZZyiU-U/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": 517216033,
          "mode": "list",
          "cachedResultName": "lead_list",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ioNixpsvtZ3x0TiGpagV5tqZEZCt4ieGxFzbZZyiU-U/edit#gid=517216033"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "Call ID": "={{ $('Webhook1').item.json.body.call.call_id }}",
            "Appointment Date": "={{ $json.choices[0].message.content }}",
            "Call Status": "={{ $('Webhook1').item.json.body.call.disconnection_reason }}",
            "Transcript": "=https://dashboard.retellai.com/call-history?history={{ $('Webhook1').item.json.body.call.call_id }}",
            "Duration (sec.)": "={{ $('Webhook1').item.json.body.call.call_cost.total_duration_seconds }}",
            "Cost ($)": "={{ (($('Call Success?').item.json.body.call.call_cost.combined_cost / 100) + ($('Call Success?').item.json.body.call.call_cost.total_duration_seconds / 60 * 0.048)).toFixed(3) }}"
          },
          "matchingColumns": [
            "Call ID"
          ],
          "schema": [
            {
              "id": "Date",
              "displayName": "Date",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Category",
              "displayName": "Category",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "State",
              "displayName": "State",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "City",
              "displayName": "City",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Street",
              "displayName": "Street",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Title",
              "displayName": "Title",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Website",
              "displayName": "Website",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Phone",
              "displayName": "Phone",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Rating",
              "displayName": "Rating",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Reviews",
              "displayName": "Reviews",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Email",
              "displayName": "Email",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Facebook",
              "displayName": "Facebook",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "LinkedIn",
              "displayName": "LinkedIn",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Twitter",
              "displayName": "Twitter",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Instagram",
              "displayName": "Instagram",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "TikTok",
              "displayName": "TikTok",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "YouTube",
              "displayName": "YouTube",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Yelp",
              "displayName": "Yelp",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Status",
              "displayName": "Status",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Call ID",
              "displayName": "Call ID",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Call Date",
              "displayName": "Call Date",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Replies",
              "displayName": "Replies",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Appointment Date",
              "displayName": "Appointment Date",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Call Status",
              "displayName": "Call Status",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Transcript",
              "displayName": "Transcript",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Duration (sec.)",
              "displayName": "Duration (sec.)",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Cost ($)",
              "displayName": "Cost ($)",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "displayName": "row_number",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "number",
              "canBeUsedToMatch": true,
              "readOnly": true,
              "removed": true
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.6,
      "position": [
        672,
        560
      ],
      "id": "3d7df7a8-841a-43f6-8f88-e37ae3034706",
      "name": "Call successful",
      "alwaysOutputData": true,
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "uJs2j7wVby6KZmho",
          "name": "Google Sheets account 9"
        }
      }
    },
    {
      "parameters": {
        "operation": "update",
        "documentId": {
          "__rl": true,
          "value": "1ioNixpsvtZ3x0TiGpagV5tqZEZCt4ieGxFzbZZyiU-U",
          "mode": "list",
          "cachedResultName": "Build - Lead List with Calls",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ioNixpsvtZ3x0TiGpagV5tqZEZCt4ieGxFzbZZyiU-U/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": 517216033,
          "mode": "list",
          "cachedResultName": "lead_list",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ioNixpsvtZ3x0TiGpagV5tqZEZCt4ieGxFzbZZyiU-U/edit#gid=517216033"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "Call ID": "={{ $json.call_id }}",
            "Call Date": "={{ $now }}",
            "row_number": "={{ $('Get row(s) in sheet').item.json.row_number }}"
          },
          "matchingColumns": [
            "row_number"
          ],
          "schema": [
            {
              "id": "Date",
              "displayName": "Date",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Category",
              "displayName": "Category",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "State",
              "displayName": "State",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "City",
              "displayName": "City",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Street",
              "displayName": "Street",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Title",
              "displayName": "Title",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Website",
              "displayName": "Website",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Phone",
              "displayName": "Phone",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Rating",
              "displayName": "Rating",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Reviews",
              "displayName": "Reviews",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Email",
              "displayName": "Email",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Facebook",
              "displayName": "Facebook",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "LinkedIn",
              "displayName": "LinkedIn",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Twitter",
              "displayName": "Twitter",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Instagram",
              "displayName": "Instagram",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "TikTok",
              "displayName": "TikTok",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "YouTube",
              "displayName": "YouTube",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Yelp",
              "displayName": "Yelp",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Status",
              "displayName": "Status",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Call ID",
              "displayName": "Call ID",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Call Date",
              "displayName": "Call Date",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Replies",
              "displayName": "Replies",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Appointment Date",
              "displayName": "Appointment Date",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Call Status",
              "displayName": "Call Status",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Transcript",
              "displayName": "Transcript",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Duration (sec.)",
              "displayName": "Duration (sec.)",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Cost ($)",
              "displayName": "Cost ($)",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "row_number",
              "displayName": "row_number",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "number",
              "canBeUsedToMatch": true,
              "readOnly": true,
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.6,
      "position": [
        704,
        96
      ],
      "id": "c9674ff0-394d-4dd4-ab2f-9e8d36c3884e",
      "name": "Save Call Details",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "uJs2j7wVby6KZmho",
          "name": "Google Sheets account 9"
        }
      }
    },
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "be68022d-1497-4742-968d-6ad16668f147",
        "responseMode": "responseNode",
        "options": {}
      },
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2.1,
      "position": [
        192,
        336
      ],
      "id": "d809f9db-b1de-4262-bd92-8471931cd785",
      "name": "Webhook",
      "webhookId": "be68022d-1497-4742-968d-6ad16668f147"
    },
    {
      "parameters": {
        "operation": "appendOrUpdate",
        "documentId": {
          "__rl": true,
          "value": "1ioNixpsvtZ3x0TiGpagV5tqZEZCt4ieGxFzbZZyiU-U",
          "mode": "list",
          "cachedResultName": "Build - Lead List with Calls",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ioNixpsvtZ3x0TiGpagV5tqZEZCt4ieGxFzbZZyiU-U/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": 517216033,
          "mode": "list",
          "cachedResultName": "lead_list",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ioNixpsvtZ3x0TiGpagV5tqZEZCt4ieGxFzbZZyiU-U/edit#gid=517216033"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "Call ID": "={{ $json.body.call_id }}",
            "Replies": "=Current Lead Generation: {{ $json.body.current_lead_generation }}\n\nBiggest Challenge: {{ $json.body.biggest_challenge }}\n\nTeam size and tools: {{ $json.body.team_size_and_tools }}\n\nGrowth goals: {{ $json.body.growth_goal }}"
          },
          "matchingColumns": [
            "Call ID"
          ],
          "schema": [
            {
              "id": "Date",
              "displayName": "Date",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Category",
              "displayName": "Category",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "State",
              "displayName": "State",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "City",
              "displayName": "City",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Street",
              "displayName": "Street",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Title",
              "displayName": "Title",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Website",
              "displayName": "Website",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Phone",
              "displayName": "Phone",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Rating",
              "displayName": "Rating",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Reviews",
              "displayName": "Reviews",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Email",
              "displayName": "Email",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Facebook",
              "displayName": "Facebook",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "LinkedIn",
              "displayName": "LinkedIn",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Twitter",
              "displayName": "Twitter",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Instagram",
              "displayName": "Instagram",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "TikTok",
              "displayName": "TikTok",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "YouTube",
              "displayName": "YouTube",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Yelp",
              "displayName": "Yelp",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Status",
              "displayName": "Status",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Call ID",
              "displayName": "Call ID",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Call Date",
              "displayName": "Call Date",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Replies",
              "displayName": "Replies",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Appointment Date",
              "displayName": "Appointment Date",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Call Status",
              "displayName": "Call Status",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Transcript",
              "displayName": "Transcript",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Duration (sec.)",
              "displayName": "Duration (sec.)",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Cost ($)",
              "displayName": "Cost ($)",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.6,
      "position": [
        416,
        336
      ],
      "id": "121143d5-74e1-4fa9-aaf9-ca6dab6d2a93",
      "name": "Store Replies",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "uJs2j7wVby6KZmho",
          "name": "Google Sheets account 9"
        }
      }
    },
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "5a555090-7d88-4a08-96fd-d03cbc6e1438",
        "options": {}
      },
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2.1,
      "position": [
        -64,
        656
      ],
      "id": "05e0ba71-2737-4dc3-9ade-8c352739822e",
      "name": "Webhook1",
      "webhookId": "5a555090-7d88-4a08-96fd-d03cbc6e1438"
    },
    {
      "parameters": {
        "modelId": {
          "__rl": true,
          "value": "gpt-4.1",
          "mode": "list",
          "cachedResultName": "GPT-4.1"
        },
        "messages": {
          "values": [
            {
              "content": "=Analyse the transcript find the appointment date and time. \n\nYour response output:\n\n[appointment_date always in ISO date format with same timezone offset you see in the current time, ignor the location in the transcript]\n\n#Rule: only return the raw date and time with no text\ncurrent date and time is: {{ $now }}\n\nTranscript\n\n {{ $json.body.call.transcript }}\n\n"
            }
          ]
        },
        "simplify": false,
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1.8,
      "position": [
        384,
        560
      ],
      "id": "5b06b120-03d3-4317-a44f-b07d887224cb",
      "name": "Message a model",
      "credentials": {
        "openAiApi": {
          "id": "80b8DOj8REc2MMqi",
          "name": "OpenAi account 9"
        }
      }
    },
    {
      "parameters": {
        "respondWith": "allIncomingItems",
        "options": {}
      },
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.4,
      "position": [
        640,
        336
      ],
      "id": "0989439b-d5cd-4815-8f70-1b5bb401f59f",
      "name": "Respond to Webhook"
    },
    {
      "parameters": {
        "content": "## Initiate Call",
        "height": 224,
        "width": 784
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        96,
        32
      ],
      "id": "2bd3775a-9728-43ad-8704-2c1f3e7cc7ac",
      "name": "Sticky Note"
    },
    {
      "parameters": {
        "content": "## Store Answers",
        "height": 208,
        "width": 672,
        "color": 5
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        144,
        288
      ],
      "id": "0a08c40e-72a8-442d-8115-fe57c8fdfc94",
      "name": "Sticky Note1"
    },
    {
      "parameters": {
        "content": "## Save Call Status + Send Email",
        "height": 352,
        "width": 1168,
        "color": 6
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -112,
        544
      ],
      "id": "3d695159-fa32-472a-b32f-a2dd392127d9",
      "name": "Sticky Note2"
    },
    {
      "parameters": {
        "documentId": {
          "__rl": true,
          "value": "1ioNixpsvtZ3x0TiGpagV5tqZEZCt4ieGxFzbZZyiU-U",
          "mode": "list",
          "cachedResultName": "Build - Lead List with Calls",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ioNixpsvtZ3x0TiGpagV5tqZEZCt4ieGxFzbZZyiU-U/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": 517216033,
          "mode": "list",
          "cachedResultName": "lead_list",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ioNixpsvtZ3x0TiGpagV5tqZEZCt4ieGxFzbZZyiU-U/edit#gid=517216033"
        },
        "filtersUI": {
          "values": [
            {
              "lookupColumn": "Call ID"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        288,
        96
      ],
      "id": "358c9d6b-be3d-4dcf-bcaa-b36834fd2ba6",
      "name": "Get row(s) in sheet",
      "alwaysOutputData": true,
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "uJs2j7wVby6KZmho",
          "name": "Google Sheets account 9"
        }
      },
      "onError": "continueRegularOutput"
    },
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 10,
              "triggerAtMinute": 6
            }
          ]
        }
      },
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        144,
        96
      ],
      "id": "adfcb638-4cda-4092-907b-fad728d3a79f",
      "name": "Schedule Trigger"
    },
    {
      "parameters": {
        "jsCode": "// Get only the FIRST unprocessed row\nconst allRows = $input.all();\n\n// Check if there are any rows\nif (allRows.length === 0) {\n  throw new Error(\"No uncalled leads\");\n}\n\n// Check if the first row has any actual data (fields)\nconst firstRow = allRows[0];\nif (!firstRow.json || Object.keys(firstRow.json).length === 0) {\n  throw new Error(\"No uncalled leads\");\n}\n\n// Return ONLY the first row\nreturn [firstRow];"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        416,
        96
      ],
      "id": "e56860cb-037a-4bd8-81b0-09af4c74cd6c",
      "name": "Next Lead",
      "alwaysOutputData": true,
      "onError": "continueRegularOutput"
    },
    {
      "parameters": {
        "sendTo": "={{ $('Webhook1').item.json.body.call.retell_llm_dynamic_variables.email }}",
        "subject": "RE: Your discount voucher",
        "emailType": "text",
        "message": "=Hi,\n\nas thank you for our call today, here's a discount voucher you can use on your next order with us:\n\nDISCOUNT CODE\n\nLooking forward to talk to you on: \n{{ $json['Appointment Date'] }}\n\nHave a great day!\n\nan",
        "options": {}
      },
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        832,
        560
      ],
      "id": "83142d28-0d3f-4c98-b12f-58b60990d16f",
      "name": "Send a message",
      "webhookId": "adae55e5-8fc4-47f3-9ca6-39045b53b352",
      "credentials": {
        "gmailOAuth2": {
          "id": "6FbWEcqJuVdvNQWb",
          "name": "receipts"
        }
      }
    }
  ],
  "connections": {
    "Voice Call": {
      "main": [
        [
          {
            "node": "Save Call Details",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Call Success?": {
      "main": [
        [
          {
            "node": "Message a model",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No Answer?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "No Answer?": {
      "main": [
        [
          {
            "node": "Did not answer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook": {
      "main": [
        [
          {
            "node": "Store Replies",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Store Replies": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook1": {
      "main": [
        [
          {
            "node": "Call Success?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Message a model": {
      "main": [
        [
          {
            "node": "Call successful",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Get row(s) in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get row(s) in sheet": {
      "main": [
        [
          {
            "node": "Next Lead",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Next Lead": {
      "main": [
        [
          {
            "node": "Voice Call",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Call successful": {
      "main": [
        [
          {
            "node": "Send a message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "a76c8f26-4a3c-42ca-9f6a-4055cf68f73e",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "7ff6625f0127f3e9a7865e3493009de1c48f57dc5ed87def3ae3316be7f6b238"
  },
  "id": "Lv2wG8t9iPWTVLAy",
  "tags": []
}