{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "a4c1e9f4-bd7b-49f7-b9a0-c55d13c415c7",
      "name": "save_linkedin",
      "type": "n8n-nodes-base.supabase",
      "position": [
        80,
        -48
      ],
      "parameters": {
        "tableId": "linkedin",
        "fieldsUi": {
          "fieldValues": [
            {
              "fieldId": "publicidentifier",
              "fieldValue": "={{ $json.publicIdentifier }}"
            },
            {
              "fieldId": "linkedinurl",
              "fieldValue": "={{ $json.linkedinUrl }}"
            },
            {
              "fieldId": "name",
              "fieldValue": "={{ $json.name }}"
            },
            {
              "fieldId": "headline",
              "fieldValue": "={{ $json.headline }}"
            },
            {
              "fieldId": "about",
              "fieldValue": "={{ $json.about }}"
            },
            {
              "fieldId": "premium",
              "fieldValue": "={{ $json.premium }}"
            },
            {
              "fieldId": "verified",
              "fieldValue": "={{ $json.verified }}"
            },
            {
              "fieldId": "openprofile",
              "fieldValue": "={{ $json.openProfile }}"
            },
            {
              "fieldId": "topskills",
              "fieldValue": "={{ $json.topSkills }}"
            },
            {
              "fieldId": "connectionscount",
              "fieldValue": "={{ $json.connectionsCount }}"
            },
            {
              "fieldId": "followercount",
              "fieldValue": "={{ $json.followerCount }}"
            },
            {
              "fieldId": "latest_experience",
              "fieldValue": "={{ $json.latest_experience }}"
            },
            {
              "fieldId": "education",
              "fieldValue": "={{ $json.education }}"
            }
          ]
        }
      },
      "credentials": {
        "supabaseApi": {
          "name": "<your credential>"
        }
      },
      "executeOnce": false,
      "retryOnFail": false,
      "typeVersion": 1
    },
    {
      "id": "23282df3-60fd-4ebd-9965-5a9b6475a0db",
      "name": "save_googlemaps",
      "type": "n8n-nodes-base.supabase",
      "position": [
        80,
        -240
      ],
      "parameters": {
        "tableId": "googlemaps",
        "fieldsUi": {
          "fieldValues": [
            {
              "fieldId": "title",
              "fieldValue": "={{ $json.title }}"
            },
            {
              "fieldId": "category_name",
              "fieldValue": "={{ $json.categoryName }}"
            },
            {
              "fieldId": "address",
              "fieldValue": "={{ $json.address }}"
            },
            {
              "fieldId": "neighborhood",
              "fieldValue": "={{ $json.neighborhood }}"
            },
            {
              "fieldId": "street",
              "fieldValue": "={{ $json.street }}"
            },
            {
              "fieldId": "city",
              "fieldValue": "={{ $json.city }}"
            },
            {
              "fieldId": "postal_code",
              "fieldValue": "={{ $json.postalCode }}"
            },
            {
              "fieldId": "state",
              "fieldValue": "={{ $json.state }}"
            },
            {
              "fieldId": "country_code",
              "fieldValue": "={{ $json.countryCode }}"
            },
            {
              "fieldId": "website",
              "fieldValue": "={{ $json.website }}"
            },
            {
              "fieldId": "phone",
              "fieldValue": "={{ $json.phone }}"
            },
            {
              "fieldId": "phone_unformatted",
              "fieldValue": "={{ $json.phoneUnformatted }}"
            },
            {
              "fieldId": "location",
              "fieldValue": "={{ $json.location }}"
            },
            {
              "fieldId": "total_score",
              "fieldValue": "={{ $json.totalScore }}"
            }
          ]
        }
      },
      "credentials": {
        "supabaseApi": {
          "name": "<your credential>"
        }
      },
      "executeOnce": false,
      "retryOnFail": false,
      "typeVersion": 1
    },
    {
      "id": "6d0fa79a-4121-473f-8441-125a0356fcb9",
      "name": "get_linkedin",
      "type": "n8n-nodes-base.set",
      "position": [
        -144,
        -48
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "324600d2-fd7a-4236-a00b-d1510e13bf1a",
              "name": "publicIdentifier",
              "type": "string",
              "value": "={{ $json.publicIdentifier }}"
            },
            {
              "id": "544ef597-b06a-4b42-b4aa-c07e1e16a928",
              "name": "linkedinUrl",
              "type": "string",
              "value": "={{ $json.linkedinUrl }}"
            },
            {
              "id": "2ceec80c-11a2-41a2-848c-c7103395024f",
              "name": "name",
              "type": "string",
              "value": "={{ $json.firstName }} {{ $json.lastName }}"
            },
            {
              "id": "36f610a3-4146-413d-8101-e3699e1083f1",
              "name": "headline",
              "type": "string",
              "value": "={{ $json.headline }}"
            },
            {
              "id": "d43208d3-fc30-4596-845e-72f8f95cc0c2",
              "name": "about",
              "type": "string",
              "value": "={{ $json.about }}"
            },
            {
              "id": "ea19b2d9-4d60-4e32-92a0-9fb5a9fb087f",
              "name": "premium",
              "type": "boolean",
              "value": "={{ $json.premium }}"
            },
            {
              "id": "51a8c2d6-de2c-47cf-82ab-616121b48239",
              "name": "verified",
              "type": "boolean",
              "value": "={{ $json.verified }}"
            },
            {
              "id": "3e0e0887-2ef4-4e16-9618-27bb8e965d93",
              "name": "topSkills",
              "type": "string",
              "value": "={{ $json.topSkills }}"
            },
            {
              "id": "5a64154e-93e0-4b5e-a03a-961b84c17654",
              "name": "connectionsCount",
              "type": "number",
              "value": "={{ $json.connectionsCount }}"
            },
            {
              "id": "1b15c679-9cd0-4cf6-9295-771caddbd5ad",
              "name": "followerCount",
              "type": "number",
              "value": "={{ $json.followerCount }}"
            },
            {
              "id": "6cc42ac9-b1fc-4834-850f-95994fc555fa",
              "name": "latest_experience",
              "type": "string",
              "value": "={{ $json.experience.last().companyLinkedinUrl }}\n{{ $json.experience.last().companyName }}\n{{ $json.experience.last().duration }}"
            },
            {
              "id": "5b062d0c-3d2d-4fe9-93a2-7f8a263da885",
              "name": "education",
              "type": "string",
              "value": "={{ $json.education.last().schoolName }}"
            },
            {
              "id": "1005d779-fc36-412a-abc4-f02287a93f0f",
              "name": "openProfile",
              "type": "boolean",
              "value": "={{ $json.openProfile }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "9b145117-9ada-43bd-a3e8-e276a0fa33c3",
      "name": "set_google_maps_column",
      "type": "n8n-nodes-base.set",
      "position": [
        -144,
        -240
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "ad340224-6836-4ff6-a457-77f476bb9f2a",
              "name": "title",
              "type": "string",
              "value": "={{ $json.title }}"
            },
            {
              "id": "27b479f4-f990-45a1-8575-b82eb9506c00",
              "name": "categoryName",
              "type": "string",
              "value": "={{ $json.categoryName }}"
            },
            {
              "id": "d7fe3a00-ffbb-4dae-9ef8-df92ac9f9881",
              "name": "address",
              "type": "string",
              "value": "={{ $json.address }}"
            },
            {
              "id": "2c055b54-79d9-4143-b89c-9dde69816f2a",
              "name": "neighborhood",
              "type": "string",
              "value": "={{ $json.neighborhood }}"
            },
            {
              "id": "9310a5a7-ab34-49bc-8373-c05b3dc10d24",
              "name": "street",
              "type": "string",
              "value": "={{ $json.street }}"
            },
            {
              "id": "abd0544f-f111-47c5-9f8b-4de6ef0a26e1",
              "name": "city",
              "type": "string",
              "value": "={{ $json.city }}"
            },
            {
              "id": "7c112e7e-4292-49f7-b198-5f4245960bc9",
              "name": "postalCode",
              "type": "string",
              "value": "={{ $json.postalCode }}"
            },
            {
              "id": "507ca314-936a-46d8-91b8-d9b0ed8d04c5",
              "name": "state",
              "type": "string",
              "value": "={{ $json.state }}"
            },
            {
              "id": "f6286dc0-5206-4ba7-a676-b2813665337d",
              "name": "countryCode",
              "type": "string",
              "value": "={{ $json.countryCode }}"
            },
            {
              "id": "056fdf31-e37c-477c-874a-c624be91511b",
              "name": "website",
              "type": "string",
              "value": "={{ $json.website }}"
            },
            {
              "id": "b5cb185b-1a1a-44e2-bc82-6919e1c78640",
              "name": "phone",
              "type": "string",
              "value": "={{ $json.phone }}"
            },
            {
              "id": "dcfbdf36-7421-4d3f-a10a-a1e1e7750545",
              "name": "phoneUnformatted",
              "type": "string",
              "value": "={{ $json.phoneUnformatted }}"
            },
            {
              "id": "154c4a8b-dd15-46eb-89e0-41c0727893a1",
              "name": "location",
              "type": "string",
              "value": "=\"lat\":{{ $json.location.lat }}, \"lng\":{{ $json.location.lng }}"
            },
            {
              "id": "ad9ae4ce-4c07-4d1e-82be-91c7a6ac75fc",
              "name": "totalScore",
              "type": "number",
              "value": "={{ $json.totalScore }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "36dae761-f7ad-4c2b-98c3-5ffc9201a293",
      "name": "linkedin_dataset",
      "type": "@apify/n8n-nodes-apify.apify",
      "position": [
        -368,
        -48
      ],
      "parameters": {
        "memory": 2048,
        "actorId": {
          "__rl": true,
          "mode": "list",
          "value": "M2FMdjRVeF1HPGFcc",
          "cachedResultUrl": "https://console.apify.com/actors/M2FMdjRVeF1HPGFcc/input",
          "cachedResultName": "LinkedIn Profile Search Scraper No Cookies \u2705 Find all people \ud83d\udce7 (harvestapi/linkedin-profile-search)"
        },
        "timeout": {},
        "operation": "Run actor and get dataset",
        "customBody": "={\n    \"locations\": [\n        \"{{ $json.Location }}\"\n    ],\n    \"maxItems\": {{ $json['Number of results'] }},\n    \"profileScraperMode\": \"Full\",\n    \"searchQuery\": \"{{ $json['Title/Industry'] }}\"\n} ",
        "authentication": "apifyOAuth2Api"
      },
      "credentials": {
        "apifyOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "4c194976-3d85-4f8f-97e8-6cfe677b9d43",
      "name": "googlemaps_dataset",
      "type": "@apify/n8n-nodes-apify.apify",
      "position": [
        -368,
        -240
      ],
      "parameters": {
        "actorId": {
          "__rl": true,
          "mode": "list",
          "value": "nwua9Gu5YrADL7ZDj",
          "cachedResultUrl": "https://console.apify.com/actors/nwua9Gu5YrADL7ZDj/input",
          "cachedResultName": "Google Maps Scraper (compass/crawler-google-places)"
        },
        "timeout": {},
        "operation": "Run actor and get dataset",
        "customBody": "={\n    \"includeWebResults\": false,\n    \"language\": \"en\",\n    \"locationQuery\": \"{{ $json.Location }}\",\n    \"maxCrawledPlacesPerSearch\":{{ $json['Number of results'] }} ,\n    \"maxImages\": 0,\n    \"maximumLeadsEnrichmentRecords\": 0,\n    \"scrapeContacts\": false,\n    \"scrapeDirectories\": false,\n    \"scrapeImageAuthors\": false,\n    \"scrapePlaceDetailPage\": false,\n    \"scrapeReviewsPersonalData\": true,\n    \"scrapeTableReservationProvider\": false,\n    \"searchStringsArray\": [\n        \"{{ $json['Title/Industry'] }}\"\n    ],\n    \"skipClosedPlaces\": false\n}",
        "authentication": "apifyOAuth2Api"
      },
      "credentials": {
        "apifyOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "c1f87a4e-f3b8-4f00-8c28-9d6262c11452",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -864,
        -560
      ],
      "parameters": {
        "width": 368,
        "height": 368,
        "content": "## Main Workflow Overview\nThis workflow automatically scrapes targeted leads from Google Maps and LinkedIn based on your search criteria.\n\nSimply fill out the form with your target industry/title and location, choose your data source, and the workflow will collect and store all lead information in your Supabase database.\n\n**How it works**:\n- Submit form with search criteria\n- Switch routes to appropriate scraper(s)\n- Data gets cleaned and formatted\n- Results saved to database tables\n\n**Perfect for**: Sales teams, recruiters, marketers building prospect lists"
      },
      "typeVersion": 1
    },
    {
      "id": "e2cd5ed7-f208-4835-9ae9-ec99953275b4",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        288,
        -304
      ],
      "parameters": {
        "color": 4,
        "width": 304,
        "height": 400,
        "content": "##  Data Processing & Storage\nAfter scraping, the workflow cleans and structures the data:\n\n**Google Maps Path**:\n- Formats business information (name, address, phone, website)\n- Extracts location coordinates\n- Saves to googlemaps table\n\n**LinkedIn Path**:\n- Combines first/last names\n- Processes experience and education data\n- Extracts connection counts and skills\n- Saves to linkedin table"
      },
      "typeVersion": 1
    },
    {
      "id": "43ac230a-ad0c-4b49-8892-cc2919aa5aeb",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -864,
        16
      ],
      "parameters": {
        "color": 6,
        "width": 304,
        "height": 320,
        "content": "## Form Input\nThe form collects 4 key pieces of information:\n\n- Title/Industry: What type of leads you want (e.g., \"CEOs\", \"Marketing Directors\", \"Restaurants\")\n- Location: Geographic area to target (e.g., \"New York\", \"London\", \"California\")\n- Source: Choose Google Maps, LinkedIn, or Both\n- Number of results: How many leads you want to collect (optional)\n"
      },
      "typeVersion": 1
    },
    {
      "id": "918bb23b-2926-4834-aeb0-d32f2659dc3f",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        400,
        144
      ],
      "parameters": {
        "color": 6,
        "width": 150,
        "height": 80,
        "content": "## [LinkedIn](https://www.linkedin.com/in/tumusime-david/)"
      },
      "typeVersion": 1
    },
    {
      "id": "f6e07253-8d82-4638-aafe-9cf071f3f2bb",
      "name": "Route source",
      "type": "n8n-nodes-base.switch",
      "position": [
        -592,
        -160
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "GoogleMaps",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "4c5b4ac5-a380-4197-9a44-5f8723f44dfd",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.Source }}",
                    "rightValue": "Google Maps"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "LinkedIn",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "a015bb9d-5688-4ba8-813c-637c473d29ae",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.Source }}",
                    "rightValue": "LinkedIn"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Both",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "a0e10c8a-6d54-4b75-970d-9ba81430d26c",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.Source }}",
                    "rightValue": "Both"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "1db7a83b-9721-408c-8ead-5ec2aea3a7b9",
      "name": "Input desired lead",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -816,
        -144
      ],
      "parameters": {
        "options": {},
        "formTitle": "Targeted leads",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Title/Industry",
              "placeholder": "CEOs or Finance",
              "requiredField": true
            },
            {
              "fieldLabel": "Location",
              "placeholder": "Enter targeted location",
              "requiredField": true
            },
            {
              "fieldType": "dropdown",
              "fieldLabel": "Source",
              "fieldOptions": {
                "values": [
                  {
                    "option": "Google Maps"
                  },
                  {
                    "option": "LinkedIn"
                  },
                  {
                    "option": "Both"
                  }
                ]
              },
              "requiredField": true
            },
            {
              "fieldType": "number",
              "fieldLabel": "Number of results",
              "placeholder": "Enter number desired results"
            }
          ]
        },
        "formDescription": "This form is intended to get leads from Google Maps and LinkedIn using the Apify actor."
      },
      "typeVersion": 2.3
    }
  ],
  "connections": {
    "Route source": {
      "main": [
        [
          {
            "node": "googlemaps_dataset",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "linkedin_dataset",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "linkedin_dataset",
            "type": "main",
            "index": 0
          },
          {
            "node": "googlemaps_dataset",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "get_linkedin": {
      "main": [
        [
          {
            "node": "save_linkedin",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "linkedin_dataset": {
      "main": [
        [
          {
            "node": "get_linkedin",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Input desired lead": {
      "main": [
        [
          {
            "node": "Route source",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "googlemaps_dataset": {
      "main": [
        [
          {
            "node": "set_google_maps_column",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "set_google_maps_column": {
      "main": [
        [
          {
            "node": "save_googlemaps",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}