Automated LinkedIn lead enrichment pipeline using Apollo.io & Google Sheets
LinkedIn to Apollo.io Lead Enrichment System with Google Sheets
Automatically capture company and store details from LinkedIn posts, enrich them with domain names and key decision-maker (KDM) data from Apollo.io, and store everything neatly in Google Sheets.
This workflow turns LinkedIn post data into a complete, structured lead database β fully automated from detection to enrichment.
π§Ύ Summary
This workflow reads LinkedIn post data (in JSON format) received via a webhook, extracts company and location information using an AI agent, and progressively enriches the data in three stages:
- Find Company Domain using Apollo.io
- Fetch Key Decision Makers (KDMs) using the company domain
- Find Corporate Emails for those KDMs
All results are automatically updated in Google Sheets, ensuring your lead list remains fresh, structured, and actionable.
βοΈ Prerequisites
Before running the workflow, make sure you have:
- An Apollo.io API Key with company and people search access
- A connected Google Sheets account (OAuth2)
- A Webhook URL or LinkedIn scraper that feeds JSON-formatted post data
- (Optional) An OpenAI / AI Agent node to extract company names and store locations from post text
π§© Example Input (Webhook JSON)
Each LinkedIn post is received as a JSON object containing key clues:
{
"index": 1,
"text": "Excited to announce the opening of our new KFC store at Sky City Mall, Borivali East ππ\n\nLooking forward to welcoming you all to experience the Finger Lickinβ Good taste at our newest location!\n\n#KFCIndia #NewStoreOpening #Borivali #SkyCityMall #Sapphirefoods",
"CompanyName": "MockCompany",
"NewStoreLocation": "optional",
"PersonPosted": "https://linkedin.com/in/mockperson",
"PostImage": null,
"PostLink": "https://www.linkedin.com/search/results/all/?keywords=%23kfcindia&origin=HASH_TAG_FROM_FEED",
"extracted_at": "2025-09-08T12:05:40.044101"
}
π§ Workflow Overview
This workflow runs in three main stages, moving from LinkedIn data β company domain β people β emails.
Stage 1: Company Name to Company Domain π
Goal: Convert each company name into its website domain using Apollo.io.
Nodes & Flow
- Schedule Trigger β Runs automatically (e.g., once a week) to check your Google Sheet for companies missing a domain.
- IF Node (Check for Missing Domain) β Filters only companies without a website.
- Loop Over Items β Iterates through each company record.
- HTTP Request β Find Domain β Calls the Apollo.io Company API to find the companyβs domain (e.g.,
kfc.com). - Update Row in Google Sheets β Writes the found domain back into the corresponding company row.
- Wait Node β Delay Between API Calls β Adds a small pause to avoid hitting rate limits.
Stage 2: Domain to Top 10 KDMs π₯
Goal: Fetch key decision-makers (KDMs) from each company using Apollo.io.
Nodes & Flow
- Schedule Trigger β Runs on a weekly cadence to check for companies with a domain but no KDMs.
- Get Rows from Google Sheets β Pulls company records ready for enrichment.
- IF Node (Check for Missing KDMs) β Ensures only companies without people data are processed.
- Loop Over Items β Processes one company at a time.
- HTTP Request β Find KDMs β Searches Apollo.io People API for top roles such as Founder, CEO, Head of Retail, etc.
- Update Row in Google Sheets β Saves the top 10 names and their LinkedIn profiles into your sheet.
- Wait Node β Adds a delay to manage rate limits safely.
Stage 3: KDM Profile to Email Enricher π§
Goal: Find and store verified corporate email addresses for each KDM.
Nodes & Flow
- Schedule Trigger β Weekly automation trigger.
- Get Rows from Google Sheets β Pulls KDMs that have LinkedIn profiles but no email yet.
- IF Node (Check for Missing Emails) β Ensures only valid records are processed.
- Code Node β Prepare Data β Organizes LinkedIn profile and domain information.
- HTTP Request β Find Email β Queries Apollo.ioβs email enrichment endpoint using the LinkedIn URL and domain.
- Code Node β Format Response β Cleans and formats the email result.
- Wait Node β Adds delay to avoid request bursts.
- Update Row in Google Sheets β Writes the verified email address back to the corresponding KDM entry and marks it as βUpdated β email search.β π
π§° Setup Instructions
1. Connect APIs & Credentials
- Add your Apollo.io API Key under HTTP Request credentials.
- Connect your Google Sheets account (OAuth2).
2. Customize Sheet Structure
Add columns for:
CompanyName, Domain, KDMs, LinkedInProfile, Email, Status
3. Set Schedule Frequency
Each Schedule Trigger can be configured separately (e.g., Stage 1 every Monday, Stage 2 every Wednesday).
4. Optional: AI Extraction Node
Use an AI model (like OpenAI or Gemini) to extract company name and location from LinkedIn post text before enrichment.
π§° Custom Node Names (Recommended for Clarity)
| Node Type | Recommended Name | Description | |------------|------------------|-------------| | HTTP Request (Company) | Find Company Domain (Apollo.io) | Searches for the companyβs official domain | | HTTP Request (People) | Find Key Decision Makers (Apollo.io) | Retrieves top company contacts | | HTTP Request (Emails) | Find Corporate Emails (Apollo.io) | Gets verified email addresses for each contact | | Wait Node | API Delay (Rate Limit Buffer) | Adds delay to avoid hitting API rate limits | | Code Node | Prepare KDM Data | Organizes input data for API calls |
βοΈ Customization Tips
- Multiple Campaigns: Duplicate the workflow for different industries or store categories, updating parameters as needed.
- Batch Size: Adjust API request limits (e.g., 100 per batch) based on your Apollo.io plan.
- Filtering: Add IF conditions to skip records already marked as βCompleted.β
- Dashboards: Build visual analytics directly in Google Sheets or connect to Looker Studio.
- Enrichment: Combine with CRM systems (like HubSpot or Close) using company domain or lead email as the linking key.
π Security and Publishing Notes
- π Never hardcode API keys in workflow exports. Use n8n credentials or environment variables instead.
- π« Replace sensitive values (like API keys or Sheet IDs) with placeholders before sharing.
- π Keep your Google Sheet private unless intentionally shared.
π§© Troubleshooting
- No Data in Sheets: Check API response for
data[]and verify Split Out configuration. - Duplicate Rows: Ensure the βMatching Columnβ in Google Sheets is correctly set (e.g.,
CompanyNameorLinkedInProfile). - Rate Limits: Add Wait Nodes or reduce batch size.
- Mapping Errors: Confirm Google Sheet headers exactly match node field mappings.
- Timezone Adjustments: Apollo.io timestamps are in UTC β convert to local time if needed.
π― Example Use Case
Every week, this workflow scans new LinkedIn store-opening posts.
It extracts company names (like KFC India), finds their domains and top executives through Apollo.io, retrieves their emails, and logs everything in a Google Sheet β ready for your sales team to reach out.
Tags:
LinkedIn Apollo Automation LeadGeneration GoogleSheets MarketingOps DataEnrichment
Automated LinkedIn Lead Enrichment Pipeline using Apollo.io & Google Sheets
This n8n workflow automates the process of enriching leads from a Google Sheet using Apollo.io, then updates the sheet with the enriched data. It's designed to streamline lead generation and sales outreach by providing comprehensive company and contact information.
What it does
This workflow performs the following key steps:
- Triggers on Demand: Initiated manually via a Webhook, allowing flexible execution.
- Reads Leads from Google Sheets: Fetches a list of leads (likely company names or domains) from a specified Google Sheet.
- Processes Leads in Batches: Iterates through the leads, processing them in manageable batches to optimize API calls and performance.
- Enriches Lead Data with Apollo.io: For each lead, it makes an API call to Apollo.io to retrieve detailed company and contact information.
- Parses Apollo.io Response: Extracts relevant data from the Apollo.io API response using a Structured Output Parser.
- Utilizes AI Agent for Data Extraction: Employs an AI Agent with a Google Gemini Chat Model to intelligently extract specific data points, such as company name, website, industry, employee count, and contact details (first name, last name, title, email, LinkedIn URL).
- Checks for Valid Data: Verifies if the AI Agent successfully extracted a company name and website.
- Updates Google Sheet: If valid data is found, it updates the original Google Sheet with the enriched information for each lead.
- Handles Rate Limiting: Includes a "Wait" step to prevent overwhelming the Apollo.io API with too many requests, ensuring smooth operation.
Prerequisites/Requirements
To use this workflow, you will need:
- n8n Instance: A running n8n instance (cloud or self-hosted).
- Google Sheets Account: Access to a Google Sheet containing your initial lead data.
- Apollo.io API Key: An API key for Apollo.io to enrich lead data.
- Google Gemini API Key: An API key for the Google Gemini Chat Model, used by the AI Agent.
Setup/Usage
- Import the Workflow: Download the provided JSON and import it into your n8n instance.
- Configure Credentials:
- Google Sheets: Set up your Google Sheets credentials to allow n8n to read from and write to your spreadsheet.
- Apollo.io: Configure an HTTP Request node with your Apollo.io API key. This is likely done via a header or query parameter as per Apollo.io's API documentation.
- Google Gemini: Configure the "Google Gemini Chat Model" node with your Google Gemini API key.
- Update Google Sheet Node:
- Specify the Spreadsheet ID and Sheet Name where your leads are located and where the enriched data should be written.
- Ensure your Google Sheet has appropriate columns for the data you wish to enrich and update (e.g., "Company Name", "Website", "Industry", "Employee Count", "First Name", "Last Name", "Title", "Email", "LinkedIn URL").
- Customize AI Agent Prompt: Review the prompt in the "AI Agent" node to ensure it accurately extracts the desired fields from the Apollo.io response. Adjust if necessary based on the structure of Apollo.io's output and your specific needs.
- Activate the Workflow: Once configured, activate the workflow.
- Trigger Manually: Execute the "Webhook" node to start the lead enrichment process. The workflow will then read from your Google Sheet, enrich the data, and update the sheet.
Related Templates
Track competitor SEO keywords with Decodo + GPT-4.1-mini + Google Sheets
This workflow automates competitor keyword research using OpenAI LLM and Decodo for intelligent web scraping. Who this is for SEO specialists, content strategists, and growth marketers who want to automate keyword research and competitive intelligence. Marketing analysts managing multiple clients or websites who need consistent SEO tracking without manual data pulls. Agencies or automation engineers using Google Sheets as an SEO data dashboard for keyword monitoring and reporting. What problem this workflow solves Tracking competitor keywords manually is slow and inconsistent. Most SEO tools provide limited API access or lack contextual keyword analysis. This workflow solves that by: Automatically scraping any competitorβs webpage with Decodo. Using OpenAI GPT-4.1-mini to interpret keyword intent, density, and semantic focus. Storing structured keyword insights directly in Google Sheets for ongoing tracking and trend analysis. What this workflow does Trigger β Manually start the workflow or schedule it to run periodically. Input Setup β Define the website URL and target country (e.g., https://dev.to, france). Data Scraping (Decodo) β Fetch competitor web content and metadata. Keyword Analysis (OpenAI GPT-4.1-mini) Extract primary and secondary keywords. Identify focus topics and semantic entities. Generate a keyword density summary and SEO strength score. Recommend optimization and internal linking opportunities. Data Structuring β Clean and convert GPT output into JSON format. Data Storage (Google Sheets) β Append structured keyword data to a Google Sheet for long-term tracking. Setup Prerequisites If you are new to Decode, please signup on this link visit.decodo.com n8n account with workflow editor access Decodo API credentials OpenAI API key Google Sheets account connected via OAuth2 Make sure to install the Decodo Community node. Create a Google Sheet Add columns for: primarykeywords, seostrengthscore, keyworddensity_summary, etc. Share with your n8n Google account. Connect Credentials Add credentials for: Decodo API credentials - You need to register, login and obtain the Basic Authentication Token via Decodo Dashboard OpenAI API (for GPT-4o-mini) Google Sheets OAuth2 Configure Input Fields Edit the βSet Input Fieldsβ node to set your target site and region. Run the Workflow Click Execute Workflow in n8n. View structured results in your connected Google Sheet. How to customize this workflow Track Multiple Competitors β Use a Google Sheet or CSV list of URLs; loop through them using the Split In Batches node. Add Language Detection β Add a Gemini or GPT node before keyword analysis to detect content language and adjust prompts. Enhance the SEO Report β Expand the GPT prompt to include backlink insights, metadata optimization, or readability checks. Integrate Visualization β Connect your Google Sheet to Looker Studio for SEO performance dashboards. Schedule Auto-Runs β Use the Cron Node to run weekly or monthly for competitor keyword refreshes. Summary This workflow automates competitor keyword research using: Decodo for intelligent web scraping OpenAI GPT-4.1-mini for keyword and SEO analysis Google Sheets for live tracking and reporting Itβs a complete AI-powered SEO intelligence pipeline ideal for teams that want actionable insights on keyword gaps, optimization opportunities, and content focus trends, without relying on expensive SEO SaaS tools.
Generate song lyrics and music from text prompts using OpenAI and Fal.ai Minimax
Spark your creativity instantly in any chatβturn a simple prompt like "heartbreak ballad" into original, full-length lyrics and a professional AI-generated music track, all without leaving your conversation. π What This Template Does This chat-triggered workflow harnesses AI to generate detailed, genre-matched song lyrics (at least 600 characters) from user messages, then queues them for music synthesis via Fal.ai's minimax-music model. It polls asynchronously until the track is ready, delivering lyrics and audio URL back in chat. Crafts original, structured lyrics with verses, choruses, and bridges using OpenAI Submits to Fal.ai for melody, instrumentation, and vocals aligned to the style Handles long-running generations with smart looping and status checks Returns complete song package (lyrics + audio link) for seamless sharing π§ Prerequisites n8n account (self-hosted or cloud with chat integration enabled) OpenAI account with API access for GPT models Fal.ai account for AI music generation π Required Credentials OpenAI API Setup Go to platform.openai.com β API keys (sidebar) Click "Create new secret key" β Name it (e.g., "n8n Songwriter") Copy the key and add to n8n as "OpenAI API" credential type Test by sending a simple chat completion request Fal.ai HTTP Header Auth Setup Sign up at fal.ai β Dashboard β API Keys Generate a new API key β Copy it In n8n, create "HTTP Header Auth" credential: Name="Fal.ai", Header Name="Authorization", Header Value="Key [Your API Key]" Test with a simple GET to their queue endpoint (e.g., /status) βοΈ Configuration Steps Import the workflow JSON into your n8n instance Assign OpenAI API credentials to the "OpenAI Chat Model" node Assign Fal.ai HTTP Header Auth to the "Generate Music Track", "Check Generation Status", and "Fetch Final Result" nodes Activate the workflowβchat trigger will appear in your n8n chat interface Test by messaging: "Create an upbeat pop song about road trips" π― Use Cases Content Creators: YouTubers generating custom jingles for videos on the fly, streamlining production from idea to audio export Educators: Music teachers using chat prompts to create era-specific folk tunes for classroom discussions, fostering interactive learning Gift Personalization: Friends crafting anniversary R&B tracks from shared memories via quick chats, delivering emotional audio surprises Artist Brainstorming: Songwriters prototyping hip-hop beats in real-time during sessions, accelerating collaboration and iteration β οΈ Troubleshooting Invalid JSON from AI Agent: Ensure the system prompt stresses valid JSON; test the agent standalone with a sample query Music Generation Fails (401/403): Verify Fal.ai API key has minimax-music access; check usage quotas in dashboard Status Polling Loops Indefinitely: Bump wait time to 45-60s for complex tracks; inspect fal.ai queue logs for bottlenecks Lyrics Under 600 Characters: Tweak agent prompt to enforce fuller structures like [V1][C][V2][B][C]; verify output length in executions
Automate invoice processing with OCR, GPT-4 & Salesforce opportunity creation
PDF Invoice Extractor (AI) End-to-end pipeline: Watch Drive β Download PDF β OCR text β AI normalize to JSON β Upsert Buyer (Account) β Create Opportunity β Map Products β Create OLI via Composite API β Archive to OneDrive. --- Node by node (what it does & key setup) 1) Google Drive Trigger Purpose: Fire when a new file appears in a specific Google Drive folder. Key settings: Event: fileCreated Folder ID: google drive folder id Polling: everyMinute Creds: googleDriveOAuth2Api Output: Metadata { id, name, ... } for the new file. --- 2) Download File From Google Purpose: Get the file binary for processing and archiving. Key settings: Operation: download File ID: ={{ $json.id }} Creds: googleDriveOAuth2Api Output: Binary (default key: data) and original metadata. --- 3) Extract from File Purpose: Extract text from PDF (OCR as needed) for AI parsing. Key settings: Operation: pdf OCR: enable for scanned PDFs (in options) Output: JSON with OCR text at {{ $json.text }}. --- 4) Message a model (AI JSON Extractor) Purpose: Convert OCR text into strict normalized JSON array (invoice schema). Key settings: Node: @n8n/n8n-nodes-langchain.openAi Model: gpt-4.1 (or gpt-4.1-mini) Message role: system (the strict prompt; references {{ $json.text }}) jsonOutput: true Creds: openAiApi Output (per item): $.message.content β the parsed JSON (ensure itβs an array). --- 5) Create or update an account (Salesforce) Purpose: Upsert Buyer as Account using an external ID. Key settings: Resource: account Operation: upsert External Id Field: taxid_c External Id Value: ={{ $json.message.content.buyer.tax_id }} Name: ={{ $json.message.content.buyer.name }} Creds: salesforceOAuth2Api Output: Account record (captures Id) for downstream Opportunity. --- 6) Create an opportunity (Salesforce) Purpose: Create Opportunity linked to the Buyer (Account). Key settings: Resource: opportunity Name: ={{ $('Message a model').item.json.message.content.invoice.code }} Close Date: ={{ $('Message a model').item.json.message.content.invoice.issue_date }} Stage: Closed Won Amount: ={{ $('Message a model').item.json.message.content.summary.grand_total }} AccountId: ={{ $json.id }} (from Upsert Account output) Creds: salesforceOAuth2Api Output: Opportunity Id for OLI creation. --- 7) Build SOQL (Code / JS) Purpose: Collect unique product codes from AI JSON and build a SOQL query for PricebookEntry by Pricebook2Id. Key settings: pricebook2Id (hardcoded in script): e.g., 01sxxxxxxxxxxxxxxx Source lines: $('Message a model').first().json.message.content.products Output: { soql, codes } --- 8) Query PricebookEntries (Salesforce) Purpose: Fetch PricebookEntry.Id for each Product2.ProductCode. Key settings: Resource: search Query: ={{ $json.soql }} Creds: salesforceOAuth2Api Output: Items with Id, Product2.ProductCode (used for mapping). --- 9) Code in JavaScript (Build OLI payloads) Purpose: Join lines with PBE results and Opportunity Id β build OpportunityLineItem payloads. Inputs: OpportunityId: ={{ $('Create an opportunity').first().json.id }} Lines: ={{ $('Message a model').first().json.message.content.products }} PBE rows: from previous node items Output: { body: { allOrNone:false, records:[{ OpportunityLineItem... }] } } Notes: Converts discount_total β per-unit if needed (currently commented for standard pricing). Throws on missing PBE mapping or empty lines. --- 10) Create Opportunity Line Items (HTTP Request) Purpose: Bulk create OLIs via Salesforce Composite API. Key settings: Method: POST URL: https://<your-instance>.my.salesforce.com/services/data/v65.0/composite/sobjects Auth: salesforceOAuth2Api (predefined credential) Body (JSON): ={{ $json.body }} Output: Composite API results (per-record statuses). --- 11) Update File to One Drive Purpose: Archive the original PDF in OneDrive. Key settings: Operation: upload File Name: ={{ $json.name }} Parent Folder ID: onedrive folder id Binary Data: true (from the Download node) Creds: microsoftOneDriveOAuth2Api Output: Uploaded file metadata. --- Data flow (wiring) Google Drive Trigger β Download File From Google Download File From Google β Extract from File β Update File to One Drive Extract from File β Message a model Message a model β Create or update an account Create or update an account β Create an opportunity Create an opportunity β Build SOQL Build SOQL β Query PricebookEntries Query PricebookEntries β Code in JavaScript Code in JavaScript β Create Opportunity Line Items --- Quick setup checklist π Credentials: Connect Google Drive, OneDrive, Salesforce, OpenAI. π IDs: Drive Folder ID (watch) OneDrive Parent Folder ID (archive) Salesforce Pricebook2Id (in the JS SOQL builder) π§ AI Prompt: Use the strict system prompt; jsonOutput = true. π§Ύ Field mappings: Buyer tax id/name β Account upsert fields Invoice code/date/amount β Opportunity fields Product name must equal your Product2.ProductCode in SF. β Test: Drop a sample PDF β verify: AI returns array JSON only Account/Opportunity created OLI records created PDF archived to OneDrive --- Notes & best practices If PDFs are scans, enable OCR in Extract from File. If AI returns non-JSON, keep βReturn only a JSON arrayβ as the last line of the prompt and keep jsonOutput enabled. Consider adding validation on parsing.warnings to gate Salesforce writes. For discounts/taxes in OLI: Standard OLI fields donβt support per-line discount amounts directly; model them in UnitPrice or custom fields. Replace the Composite API URL with your orgβs domain or use the Salesforce nodeβs Bulk Upsert for simplicity.