Beginner Lead Finder Using SerpAPI Search
This n8n workflow finds experts on any topic, scrapes their websites, and pulls out contact emails automatically.
Core services used: SerpAPI (google search) Β· Apify (website crawler) Β· OpenAI (GPT-4o email extraction).
π οΈ Step-by-Step Setup & Execution
1οΈβ£ Run Workflow (Manual Trigger) | Node | Type | Purpose | |------|------|---------| | Run Workflow | Manual Trigger | Start the workflow on demand while you test. |
2οΈβ£ Set Your Topic | Node | Type | How to configure | |------|------|------------------| | Set Topic | Set | Add a string field Topic β e.g. "n8n". This keyword drives every subsequent step. |
3οΈβ£ Search Google (Results 1-10) | Node | Type | API Credential | |------|------|----------------| | Search Google (top 10) | SerpAPI | Create SerpAPI credential1. Sign up β copy API key β n8n β Credentials β New β SerpAPI β paste.2. Select the credential in this node. | | Key Params | | | | q | | ={{ $json.Topic }} Expert | | location | | Region code (ex 585069efee19ad271e9c9b36) | | additionalFields.start | | "10" (Google position 1-10)|
4οΈβ£ Search Google (Results 11-20) | Node | Type | Notes | |------|------|-------| | Search Google (11-20) | SerpAPI (same credential) | Remove start or set to 20+ to fetch next page. |
5οΈβ£ Extract URL Lists | Node | Type | Script Purpose | |------|------|----------------| | Extract Url & Extract Url 2 | Code | Loop data.organic_results β output { title, link, displayed_link } for each result. |
6οΈβ£ Combine Both Result Sets | Node | Type | Details | |------|------|---------| | Append Results | Merge (combineAll) | Merges arrays from steps 3 & 4 into a single list for processing. |
7οΈβ£ Loop Over Every URL | Node | Type | Configuration | |------|------|---------------| | Loop Over Items1 | Split In Batches | Default batch = 1 (process one page at a time).onError = continueRegularOutput keeps loop alive on failures. |
8οΈβ£ Scrape Webpage Content (Apify) | Node | Type | API Credential | |------|------|----------------| | Scrape URL with apify | HTTP Request | Create Apify credential1. Sign up at https://console.apify.com2. Account β API tokens β copy.3. n8n β Credentials β New β HTTP Query Auth β set query param token=YOUR_TOKEN. | | Request Details | | | | Method | POST | | URL | https://api.apify.com/v2/acts/6sigmag~fast-website-content-crawler/run-sync-get-dataset-items | | JSON Body | 9οΈβ£ Extract Email with OpenAI | Node | Type | API Credential | |------|------|----------------| | Extract Email from webpage | LangChain Agent | Create OpenAI credential1. Generate key at https://platform.openai.com/account/api-keys2. n8n β Credentials β New β OpenAI API β paste key. | | Prompt (system) | | Output Parser | Structured Output Parser2 expects β { "email": "address OR null" } |
π Loop Continues & Final Data
The extracted result returns to Loop Over Items1 until every URL is processed.
Typical final item JSON**:
{
"title": "How to Build n8n Workflows",
"link": "https://example.com",
"email": "info@example.com"
}
π‘ Optional Enhancements Idea How Save Leads Add a Google Sheets or Airtable node after the loop. Validate Emails Chain a ZeroBounce / Hunter.io verification API before saving. Parallel Crawling Increase SplitInBatches size (watch Apify rate limits).
πββοΈ Need More Help? Robert Breen β Automation Consultant & n8n Expert π§ robert.j.breen@gmail.com π https://www.linkedin.com/in/robert-breen-29429625/ π https://ynteractive.com
Related Templates
Extract Named Entities from Web Pages with Google Natural Language API
Who is this for? Content strategists analyzing web page semantic content SEO professionals conducting entity-based anal...
Add product ideas to Notion via a Slack command
Use Case In most companies, employees have a lot of great ideas. That was the same for us at n8n. We wanted to make it a...
Automate Daily Keyword Research with Google Sheets, Suggest API & Custom Search
Who's it for This workflow is perfect for SEO specialists, marketers, bloggers, and content creators who want to automa...
π Please log in to import templates to n8n and favorite templates
Workflow Visualization
Loading...
Preparing workflow renderer
Comments (0)
Login to post comments