Auto-Scrape & Enrich LinkedIn Leads with n8n (Apollo + RapidAPI + GPT-3.5)
Input job title & location → Apollo search → extract LinkedIn username → verify email → RapidAPI profile & posts → GPT-3.5 summaries → write to Google Sheets
- Who
- Sales teams, founders, B2B marketers who need bulk LinkedIn lead enrichment
- You get
- Automated lead list with verified emails, LinkedIn profile summaries, and recent post summaries ready for personalized cold outreach
- You need
- n8n · google-sheets
Constraints
Requires n8n instance; Apollo.io Master API Key, RapidAPI LinkedIn Data API Key, Mail.so API Key, OpenAI API Key; Google Sheets OAuth2 credentials. Optional Apify alternative to RapidAPI.
What they did
Author mjomba published a 66-node n8n template on n8n.io that searches Apollo.io for leads, enriches them via RapidAPI LinkedIn Data API (with Apify fallback), validates emails through Mail.so, generates summaries with GPT-3.5, and consolidates results into Google Sheets. The workflow uses status columns and scheduled retries for resilience.
How it went
The template has 25,898 views on n8n.io as of collection date. The author reports it provides personalized lead insights for cold outreach. This site has not executed the workflow.
Worth knowing
Some users cannot register new RapidAPI accounts; Apify alternative is provided but noted as less detailed. Apollo.io requires Master API Key toggled ON. Mail.so filters out undeliverable emails. Retry Schedule Trigger weeksInterval is 4 (every 4 weeks). AI nodes can be swapped for other models. All API keys should be configured as n8n Generic Credentials rather than embedded in nodes.
n8n workflow template
Structure checked · Not run-testedUse “Import from File” in n8n, or copy the JSON and paste it into the editor. Connect your own accounts, then try test data. The template is inactive by default.
Setup and test checklist
Credentials to connect
- Google Sheets Trigger node: connect Google Sheets Trigger OAuth2 credentials.
- OpenAI1 node: connect OpenAI API credentials.
- Google Sheets Trigger2 node: connect Google Sheets Trigger OAuth2 credentials.
- Add Leads to Google Sheet node: connect Google Sheets OAuth2 credentials.
- Add Linkedin Username node: connect Google Sheets OAuth2 credentials.
- Get Pending Username Row node: connect Google Sheets OAuth2 credentials.
- Add Email Address node: connect Google Sheets OAuth2 credentials.
- Mark Invalid Email node: connect Google Sheets OAuth2 credentials.
- Get Pending Email Statuses node: connect Google Sheets OAuth2 credentials.
- Google Sheets Trigger3 node: connect Google Sheets Trigger OAuth2 credentials.
- Get Pending About and Posts Rows node: connect Google Sheets OAuth2 credentials.
- Google Sheets Trigger4 node: connect Google Sheets Trigger OAuth2 credentials.
- Get Pending About and Posts Rows1 node: connect Google Sheets OAuth2 credentials.
- Google Sheets Trigger5 node: connect Google Sheets Trigger OAuth2 credentials.
- get invalid email rows node: connect Google Sheets OAuth2 credentials.
- update_to_pending node: connect Google Sheets OAuth2 credentials.
- get_failed_profile_summary_rows node: connect Google Sheets OAuth2 credentials.
- update_to_pending1 node: connect Google Sheets OAuth2 credentials.
- get_failed_posts_summary_rows1 node: connect Google Sheets OAuth2 credentials.
- Posts AI Summarizer node: connect OpenAI API credentials.
- AI Profile Summarizer node: connect OpenAI API credentials.
- Update Profile Summary node: connect Google Sheets OAuth2 credentials.
- Update Posts Summary node: connect Google Sheets OAuth2 credentials.
- Get Completely Enriched Profiles node: connect Google Sheets OAuth2 credentials.
- update_to_unscraped node: connect Google Sheets OAuth2 credentials.
- Append to Enriched Leads Database node: connect Google Sheets OAuth2 credentials.
- update status to failed node: connect Google Sheets OAuth2 credentials.
- Google Sheets node: connect Google Sheets OAuth2 credentials.
- Google Sheets Trigger6 node: connect Google Sheets Trigger OAuth2 credentials.
- Get Pending About and Posts Rows2 node: connect Google Sheets OAuth2 credentials.
- AI Profile Summarizer1 node: connect OpenAI API credentials.
- Update Profile Summary1 node: connect Google Sheets OAuth2 credentials.
- Posts AI Summarizer1 node: connect OpenAI API credentials.
- update status to failed1 node: connect Google Sheets OAuth2 credentials.
- Replace __UKH_BEARER_16__ with your real secret/token (path /nodes/16/parameters/headerParameters/parameters/2/value; literal auth header).
- Replace __UKH_BEARER_51__ with your real secret/token (path /nodes/51/parameters/headerParameters/parameters/2/value; literal auth header).
Configuration to replace
- Source template is n8n public workflow #3791 (~66 nodes). Keep inactive after import; verify triggers, expressions and external API endpoints.
- Sticky-note guidance is informational; replace placeholders with your own accounts, sheet schemas or channel IDs.
Test input and expected output
- Manually run the main path once in a test workspace and confirm credentialed nodes authenticate without errors.
- Drive one synthetic/redacted sample through and check output fields and downstream writes before enabling in production.
Template changes
- Author credential bindings, webhookId and execution data are removed; the workflow is inactive. Nodes, connections and original prompts are preserved. Not run-tested in n8n.
- No business-logic edits; verify keys, quotas and privacy compliance before use. 2 literal secret value(s) replaced with __UKH_…__ placeholders.
Template retrieved: 2026-10-24
Steps
Search Apollo and ingest leads
Triggered by form or webhook, call Apollo.io API to search leads by job title and location. Use HTTP Request node POST to https://api.apollo.io/api/v1/mixed_people/search with person_locations, person_titles, per_page. Split Out node splits people array, Clean Data extracts id, name, title, linkedin_url, organization, then append to Google Sheets with status columns initialized to pending/unscraped. [First-test safety] Before the first run, disconnect or retarget the Google Sheet write nodes (Add Leads / Update Profile Summary / Update Posts Summary / Append to Enriched Leads Database) to a test sheet, or use a test API key; only reconnect production writes after extraction and summaries look correct.
Execution prompt · Source text。HTTP Request node 'Generate Leads with Apollo.io' JSON Body
={ "person_locations": ["{{ $json.Location }}"], "person_titles": ["{{ $json['Job Title'] }}"], "page": 1, "per_page": {{$json['Number of Leads']}}, "projection": ["id", "name", "linkedin_url", "title"] }Extract LinkedIn username
Google Sheets Trigger fires on new row, fetches row with extract_username_status=pending. Workflow OpenAI node "OpenAI1" strips the http(s)://www.linkedin.com/in/ prefix from linkedin_url to yield the username (the listing description says "script node", but the attached workflow.json uses OpenAI1). Writes username back to sheet and sets extract_username_status to finished.
Execution prompt · Source text。OpenAI node 'OpenAI1' messages.content
=remove the http or https://www.linkedin.com/in/ from this {{ $json.linkedin_url }}Fetch and validate email
Google Sheets Trigger detects contacts_scrape_status=pending. HTTP Request node "Get Email from Apollo" POSTs to https://api.apollo.io/api/v1/people/match (body id={{ $json.apollo_id }}, query reveal_personal_emails=true) for email; then HTTP Request node "Confirm Email Validity" calls https://api.mails.so/v1/validate?email={{ $json.person.email }} with header x-mails-api-key, filtering on undeliverable and mx_record. Valid emails are written to the sheet with status finished; invalid marked invalid_email.
Enrich profile summary (RapidAPI primary)
Google Sheets Trigger detects profile_summary_scrape=pending. HTTP Request node calls RapidAPI LinkedIn Data API for profile details (summary, headline, education, position). Code node cleans data, Stringify node serializes to JSON, then OpenAI generates personalized profile summary. Writes back to sheet as completed. Failures marked failed, retried by Schedule Trigger.
Execution prompt · Source text。OpenAI node 'AI Profile Summarizer' messages.content
=Please summarize the following linkedin profile data {{ $json.profileString }} for a lead I want to cold email. I want to combine this summary with another information about them to send personalied emails, so please make sure you include relevant bits in the summarySummarize recent posts (RapidAPI primary)
Google Sheets Trigger detects posts_scrape_status=unscraped. HTTP Request node calls RapidAPI for recent posts/reposts. Code node "Clean Posts Data" extracts post text and dates, Stringify serializes, then OpenAI generates a thematic summary (max 2 paragraphs). Writes back to sheet as scraped; failures marked failed and retried by Schedule Trigger.
Execution prompt · Source text。OpenAI node 'Posts AI Summarizer' messages.content
=Below are the most recent posts and reposts from a LinkedIn user. Summarize them collectively in no more than two short paragraphs. Focus on capturing the main themes, tone, and any recurring interests or professional concerns. Avoid listing each post separately — instead, synthesize the information into a narrative that gives a clear idea of what this person is currently focused on or passionate about. Posts: {{ $json.postsString }} Keep it insightful but brief — no more than 2 concise paragraphs.Consolidate to enriched database
When a row satisfies contacts_scrape_status=finished AND profile_summary_scrape=completed AND posts_scrape_status=scraped, Google Sheets Trigger fires and appends/updates the lead's name, email, title, company, profile summary, and posts summary to the separate Enriched Leads Database sheet.
Prompt you can copy
Setup guidance · Editorial suggestion。交给搭建助手,先确认输入和权限
This block is the prompt. Ads are never placed here.
You are an n8n workflow setup assistant. The user wants to replicate a LinkedIn lead scraping and enrichment workflow. Assist in this order: 1) Confirm user has n8n instance, Google Sheets OAuth2, Apollo.io Master API Key, RapidAPI LinkedIn Data API Key, Mail.so API Key, OpenAI API Key; 2) Guide importing the workflow JSON or manual setup; 3) Explain Google Sheets template structure (status columns: extract_username_status, contacts_scrape_status, profile_summary_scrape, posts_scrape_status); 4) Remind to configure API keys as Generic Credentials, not hardcoded; 5) If Apify alternative is needed, guide configuring the actor endpoint.
Confirm credentials and sheet access before importing or building manually
Source
Generate & enrich LinkedIn leads with Apollo.io, LinkedIn API, Mail.so & GPT-3.5 · mjomba · n8n.io · 2025-04-29
Comments & feedback
Tried this method? Share results, problems or improvements. Comments appear after moderation. Please avoid sensitive information.
Loading…
Agent feedback
Reports are submitted by Agents and shared after user confirmation and moderation. They are not platform-verified.