[N8N + ChatGPT] How To generate 1000’S of LEADS FREE

Prompt For ChatGPT

Format the data below into a Markdown table with these columns: "Full name", "Company name", "Website URL", "Email", "Phone number".
Each row in the table should represent a distinct person or company found.
If a piece of information is not found for a specific entry, use "N/A" or leave the cell blank.
Prioritize extracting information explicitly mentioned in the text. The "Website URL" should be the source link if it seems relevant, or a company website mentioned in the snippet.

Here is the data from Google search results:
---

ADD GOOGLE SEARCH RESULTS HERE

---
Please provide only the Markdown table in your response. Do not include any other explanatory text before or after the table.

N8N Workflow

Copy and paste following JSON code in N8N Workflow

{
  "name": "Generate Leads",
  "nodes": [
    {
      "parameters": {},
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        -120,
        -280
      ],
      "id": "6742cd4a-24e6-46cf-b6ef-3651778b8dd1",
      "name": "When clicking ‘Test workflow’"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "e36b4263-9a52-4613-830f-6be77f92794e",
              "name": "siteUrl",
              "value": "instagram.com",
              "type": "string"
            },
            {
              "id": "ff4f3ee3-4a36-4dd4-8823-6197da5bc91b",
              "name": "profession",
              "value": "plumber",
              "type": "string"
            },
            {
              "id": "6fb6732d-cebe-49e7-bf35-a3c37ba7dc32",
              "name": "emailProviders",
              "value": "\"@gmail.com\" OR \"@yahoo.com\" OR \"@hotmail.com\" OR \"@outlook.com\" OR \"@aol.com\" OR \"@icloud.com\"",
              "type": "string"
            },
            {
              "id": "e1469453-6bc1-4eec-91f9-81263db9d823",
              "name": "pagesToFetch",
              "value": "5",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        100,
        -280
      ],
      "id": "deeeb942-4cf2-434c-8c9b-7be619afc8c2",
      "name": "Edit Fields"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "fc7d8526-c266-48ca-bb3d-0785459b3560",
              "name": "fullSearchQuery",
              "value": "=site:{{ $json.siteUrl }} \"{{ $json.profession }}\" ({{ $json.emailProviders }})",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        320,
        -280
      ],
      "id": "476d0852-7fc0-43e3-ba0a-a98932145825",
      "name": "Setting Search Query"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=Format the data below into a Markdown table with these columns: \"Full name\", \"Company name\", \"Website URL\", \"Email\", \"Phone number\".\nEach row in the table should represent a distinct person or company found.\nIf a piece of information is not found for a specific entry, use \"N/A\" or leave the cell blank.\nPrioritize extracting information explicitly mentioned in the text. The \"Website URL\" should be the source link if it seems relevant, or a company website mentioned in the snippet.\n\nHere is the data from Google search results:\n---\n{{ $json.title }}\n{{ $json.htmlTitle }}\n{{ $json.snippet }}\n\n---\nPlease provide only the Markdown table in your response. Do not include any other explanatory text before or after the table.",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.9,
      "position": [
        380,
        140
      ],
      "id": "1c0190a4-020e-4019-bfe5-85c204b28057",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "modelName": "models/gemini-2.0-flash-lite",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "typeVersion": 1,
      "position": [
        300,
        300
      ],
      "id": "62fdf527-acee-4ca2-a079-232a9c6f2915",
      "name": "Google Gemini Chat Model",
      "credentials": {
        "googlePalmApi": {
          "id": "6Ym7ncLLSycPldzg",
          "name": "Google Gemini(PaLM) Api account"
        }
      }
    },
    {
      "parameters": {
        "fieldToSplitOut": "items",
        "options": {}
      },
      "type": "n8n-nodes-base.splitOut",
      "typeVersion": 1,
      "position": [
        160,
        120
      ],
      "id": "ba7b1e6f-3907-4fb0-85b9-9aab81153991",
      "name": "Split Out"
    },
    {
      "parameters": {
        "operation": "appendOrUpdate",
        "documentId": {
          "__rl": true,
          "value": "1f6k7eCWdADGAsGPwjj9rtvCj7ysffgwZihbpWv6PfWo",
          "mode": "list",
          "cachedResultName": "Generate Leads",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1f6k7eCWdADGAsGPwjj9rtvCj7ysffgwZihbpWv6PfWo/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "Sheet1",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1f6k7eCWdADGAsGPwjj9rtvCj7ysffgwZihbpWv6PfWo/edit#gid=0"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "Name": "={{ $json['Full name'] }}",
            "Phone": "={{ $json['Phone number'] }}",
            "Company": "={{ $json['Company name'] }}",
            "Email": "={{ $json.Email }}",
            "Website": "={{ $json['Website URL'] }}"
          },
          "matchingColumns": [
            "Email"
          ],
          "schema": [
            {
              "id": "Name",
              "displayName": "Name",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Email",
              "displayName": "Email",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Phone",
              "displayName": "Phone",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Company",
              "displayName": "Company",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Website",
              "displayName": "Website",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [
        960,
        -60
      ],
      "id": "3d4df686-3dee-49c3-b149-2b78eef71eee",
      "name": "Google Sheets",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "P8GbujCvl57Gl2lU",
          "name": "Google Sheets account"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "\n const allRowsForSheet = [];\n const items = $input.all();\n\n for (const item of items) {\n   const markdownTable = item.json.output; \n\n   if (!markdownTable || typeof markdownTable !== 'string') {\n     console.warn(\"Skipping item, markdownTable is not a string:\", item.json);\n     continue;\n   }\n\n   const lines = markdownTable.trim().split('\\n');\n\n   if (lines.length < 3) { \n     console.warn(\"Skipping malformed table (not enough lines):\", markdownTable);\n     continue;\n   }\n\n   \n   const headerCells = lines[0].split('|').map(h => h.trim()).filter(h => h !== \"\");\n\n   if (headerCells.length === 0) {\n       console.warn(\"Skipping table with no discernible headers:\", markdownTable);\n       continue;\n   }\n\n   \n   for (let i = 2; i < lines.length; i++) {\n     const dataLine = lines[i];\n     if (!dataLine.trim() || dataLine.trim().startsWith('|---')) { // \n         continue;\n     }\n\n\n     const dataCellsRaw = dataLine.split('|').map(c => c.trim());\n\n     const rowValues = dataCellsRaw.slice(1, headerCells.length + 1);\n\n     const rowObject = {};\n     for (let j = 0; j < headerCells.length; j++) {\n       rowObject[headerCells[j]] = rowValues[j] !== undefined ? rowValues[j] : \"N/A\";\n     }\n     allRowsForSheet.push({ json: rowObject }); // N8N expects {json: ...} \n   }\n }\n\n\n return allRowsForSheet;\n"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        740,
        200
      ],
      "id": "7b1da183-46f6-4dbd-8d6d-7a324ca4cd48",
      "name": "Code"
    },
    {
      "parameters": {
        "url": "https://customsearch.googleapis.com/customsearch/v1",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "key"
            },
            {
              "name": "cx"
            },
            {
              "name": "q",
              "value": "={{ $('Setting Search Query').item.json.fullSearchQuery }}"
            },
            {
              "name": "num",
              "value": "10"
            },
            {
              "name": "start",
              "value": "={{ $json.startValue }}"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        -20,
        120
      ],
      "id": "48022719-f53d-4620-8d3c-2b8a48fc60fc",
      "name": "HTTP Request"
    },
    {
      "parameters": {
        "jsCode": "// Get the number of pages from the previous node\nconst pagesToFetch = parseInt($('Edit Fields').item.json.pagesToFetch);\nconst baseSearchQuery = $('Setting Search Query').item.json.fullSearchQuery;\n\nconst requests = [];\n\nfor (let page = 0; page < pagesToFetch; page++) {\n  const startValue = (page * 10) + 1; // 1, 11, 21, 31, 41...\n  \n  requests.push({\n    json: {\n      searchQuery: baseSearchQuery,\n      startValue: startValue,\n      pageNumber: page + 1\n    }\n  });\n}\n\nreturn requests;"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        520,
        -240
      ],
      "id": "714553fa-2bc7-426e-8772-10001775ac0a",
      "name": "Code1"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 3,
      "position": [
        -200,
        40
      ],
      "id": "f19f5980-e890-4a91-812d-62938ed18f7c",
      "name": "Loop Over Items"
    },
    {
      "parameters": {
        "amount": 1
      },
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        640,
        -40
      ],
      "id": "778f4e09-6fcc-45e3-b02f-dcbb47729ed7",
      "name": "Wait",
      "webhookId": "7fce31c4-8e2e-4607-93d7-26a4deaed0a1"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "e5194fa6-df21-4845-8447-1a8b3e10a184",
              "leftValue": "={{ $json.Email }}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              }
            },
            {
              "id": "faafc9c4-b4c9-4215-b370-1ed8cc16f457",
              "leftValue": "={{ $json.Email }}",
              "rightValue": "N/A",
              "operator": {
                "type": "string",
                "operation": "notEquals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.filter",
      "typeVersion": 2.2,
      "position": [
        980,
        300
      ],
      "id": "93a2bf49-2aac-4457-b4d1-c1ad812ebe2f",
      "name": "Filter"
    }
  ],
  "pinData": {},
  "connections": {
    "When clicking ‘Test workflow’": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Setting Search Query",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Setting Search Query": {
      "main": [
        [
          {
            "node": "Code1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code": {
      "main": [
        [
          {
            "node": "Filter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "Split Out",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code1": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets": {
      "main": [
        []
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "ae81d902-c542-4866-9c3c-7101ddb5d849",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "7d6a5bcda733904ebcb54fc0e889f6735550f40f670703e17874c0872e05a9cb"
  },
  "id": "zwtvqxFIsC6sBFEM",
  "tags": []
}
5/5 - (5 votes)

About

Leave a Comment

Your email address will not be published. Required fields are marked *