{
  "name": "Instagram lead scrapper",
  "nodes": [
    {
      "parameters": {
        "operation": "Run actor and get dataset",
        "actorSource": "store",
        "actorId": {
          "__rl": true,
          "value": "nFJndFXA5zjCTuudP",
          "mode": "list",
          "cachedResultName": "Google Search Results Scraper (apify/google-search-scraper)",
          "cachedResultUrl": "https://console.apify.com/actors/nFJndFXA5zjCTuudP/input"
        },
        "customBody": "={   \"afterDate\": \"{{ $('On form submission').item.json['After Date'] }}\",\n    \"beforeDate\": \"{{ $('On form submission').item.json.BeforeDate }}\",\n    \"chatGptSearch\": {\n        \"enableChatGpt\": false\n    },\n    \"copilotSearch\": {\n        \"enableCopilot\": false\n    },\n    \"focusOnPaidAds\": false,\n    \"forceExactMatch\": false,\n    \"geminiSearch\": {\n        \"enableGemini\": false\n    },\n    \"includeIcons\": false,\n    \"includeUnfilteredResults\": false,\n    \"maxPagesPerQuery\": {{ $('On form submission').item.json['Max pages Query'] }},\n    \"maximumLeadsEnrichmentRecords\": 0,\n    \"mobileResults\": false,\n    \"perplexitySearch\": {\n        \"enablePerplexity\": false,\n        \"returnImages\": false,\n        \"returnRelatedQuestions\": false\n    },\n    \"queries\": \"{{ $json.query }}\",\n    \"saveHtml\": false,\n    \"saveHtmlToKeyValueStore\": true,\n    \"verifyLeadsEnrichmentEmails\": false\n}"
      },
      "type": "@apify/n8n-nodes-apify.apify",
      "typeVersion": 1,
      "position": [
        -96,
        16
      ],
      "id": "600b7ac5-d69a-41de-9ed8-77bea7c1ca6d",
      "name": "Run an Actor and get dataset",
      "credentials": {
        "apifyApi": {
          "id": "RSt90nTwr4xpvNAn",
          "name": "Apify account"
        }
      },
      "onError": "continueErrorOutput"
    },
    {
      "parameters": {
        "jsCode": "const output = [];\n\nfor (const item of $input.all()) {\n\n  const organicResults = item.json.organicResults || [];\n\n  for (const creator of organicResults) {\n\n    const websiteTitle = creator.websiteTitle || \"\";\n\n    const name =\n      websiteTitle.includes(\"·\")\n        ? websiteTitle.split(\"·\")[1].trim()\n        : websiteTitle;\n\n    const handle =\n      creator.url\n        ?.replace(\"https://www.linkedin.com/\", \"\")\n        ?.replace(/\\/$/, \"\")\n        ?.split(\"/\")[0] || \"\";\n\n    output.push({\n      json: {\n        Name: name,\n        LinkedinHandle: handle,\n        WebsiteTitle: websiteTitle,\n        ProfileURL: creator.url || \"\",\n        Description: creator.description || \"\",\n        LikesOrFollowers: creator.displayedUrl || \"\",\n        Position: creator.position || null,\n        Type: creator.type || \"\"\n      }\n    });\n  }\n}\n\nreturn output;"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        448,
        16
      ],
      "id": "7740ab18-ddf7-4db1-9107-e640e248e861",
      "name": "Code in JavaScript"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 3,
      "position": [
        208,
        0
      ],
      "id": "14030913-b299-48ab-9575-14d4da7b5744",
      "name": "Loop Over Items"
    },
    {
      "parameters": {
        "formTitle": "Linkedin Leads",
        "formDescription": "It fetches Linkedin leads",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Search",
              "placeholder": "Skincare",
              "requiredField": true
            },
            {
              "fieldLabel": "Location",
              "placeholder": "united states",
              "requiredField": true
            },
            {
              "fieldLabel": "After Date",
              "fieldType": "date",
              "requiredField": true
            },
            {
              "fieldLabel": "BeforeDate",
              "fieldType": "date",
              "requiredField": true
            },
            {
              "fieldLabel": "Max pages Query",
              "fieldType": "number",
              "requiredField": true
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.formTrigger",
      "typeVersion": 2.3,
      "position": [
        -672,
        16
      ],
      "id": "1bdfbefd-6bd9-41f4-83ca-a7946423815d",
      "name": "On form submission",
      "webhookId": "8b5470b3-33f2-4f42-b6d3-a5c4ab73e58f"
    },
    {
      "parameters": {
        "tableId": "Linkedin Leads",
        "fieldsUi": {
          "fieldValues": [
            {
              "fieldId": "name",
              "fieldValue": "={{ $json.Name }}"
            },
            {
              "fieldId": "linkedin-handle",
              "fieldValue": "={{ $json.LinkedinHandle }}"
            },
            {
              "fieldId": "url",
              "fieldValue": "={{ $json.ProfileURL }}"
            },
            {
              "fieldId": "description",
              "fieldValue": "={{ $json.Description }}"
            },
            {
              "fieldId": "liked-followers",
              "fieldValue": "={{ $json.LikesOrFollowers }}"
            },
            {
              "fieldId": "position",
              "fieldValue": "={{ $json.Position }}"
            },
            {
              "fieldId": "type",
              "fieldValue": "={{ $json.Type }}"
            }
          ]
        }
      },
      "type": "n8n-nodes-base.supabase",
      "typeVersion": 1,
      "position": [
        656,
        16
      ],
      "id": "5e89e587-5d0d-4064-bec2-ec1c100cb4c0",
      "name": "Create a row",
      "credentials": {
        "supabaseApi": {
          "id": "trorlDj6uAjC02qs",
          "name": "Supabase account"
        }
      }
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "75942f79-3db6-4210-8c65-c4e69e6e3a72",
              "name": "query",
              "value": "=site:linkedin.com + {{ $json.Search }} {{ $json.Location }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        -416,
        16
      ],
      "id": "58ecd4d5-c771-40b3-b0fe-b42f7d39c936",
      "name": "Edit Fields"
    }
  ],
  "pinData": {
    "On form submission": [
      {
        "json": {
          "Search": "Dentist & Founder",
          "Location": "united states",
          "After Date": "2026-09-01",
          "BeforeDate": "2026-09-06",
          "Max pages Query": 1,
          "submittedAt": "2026-09-06T07:08:45.076-04:00",
          "formMode": "test"
        }
      }
    ]
  },
  "connections": {
    "Run an Actor and get dataset": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code in JavaScript": {
      "main": [
        [
          {
            "node": "Create a row",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "Code in JavaScript",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create a row": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Run an Actor and get dataset",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "85d00d90-9e83-48bf-bd92-849c3d6b7375",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "c62875307c54e9fc51e3b84d0d5ae08e850cadc663fee5b9c828cc4be00b181f"
  },
  "id": "joq30Yj4rikgvpOy",
  "tags": []
}