n8n Automated LinkedIn Lead Generation & AI Personalized Outreach (Apollo + Instantly)
n8n form submission → Apollo URL generation → Apify scrape → OpenAI enrichment → Google Sheets → Tavily company research → AI cold email → Instantly.ai campaign
- Who
- Agency founders, SaaS founders, B2B marketers, or SDR teams needing automated B2B lead sourcing and personalized outreach
- You get
- A single form submission triggers a complete pipeline from lead scraping, enrichment, and company research to personalized email generation and campaign delivery
- You need
- n8n · google-sheets · apify · tavily · instantly.ai · apollo
Constraints
Prerequisites: n8n instance (self-hosted or cloud); API keys for Apify, OpenAI, Instantly.ai, and Tavily; Google Sheets OAuth credentials and a writable spreadsheet. Cost reference: Instantly $38/mo, Apify $39/mo, Tavily free for first 100 leads then $0.08/lead, Apollo $1.20/1000 (deducted from Apify credit), GPT API ~<$0.10/100 leads. Note: the Google Sheets documentId in workflow.json is an example and must be replaced with your own document.
What they did
The template author n8nwizard built a 23-node n8n automation. A user submits targeting criteria via an n8n form (job title, company size, keywords, location, Instantly campaign ID). The workflow then: calls an LLM to generate an Apollo search URL; triggers an Apify Actor to scrape Apollo; uses OpenAI to parse and structure raw lead data; writes validated leads to Google Sheets; runs a Tavily AI Agent to research company background, news, offerings, and sentiment; uses OpenAI again to draft a personalized cold email body; and finally pushes each lead with the custom message into an Instantly.ai campaign via HTTP request, looping automatically through all leads.
How it went
The author claims the workflow removes 100% manual scraping, enables scalable high-quality personalized outreach, and ensures every lead has a verified email, company insights, and personalized messaging for higher reply rates (author-reported; not tested by this site). The template is publicly listed on n8n.io with 311 views.
Worth knowing
1. Sender identity is hardcoded as ChaseAI AI consulting; modify the Generate Outreach Message node for your own company and value proposition. 2. The prompt contains a syntax issue in the Parse Lead Data JSON schema (missing comma after "LinkedIn"); verify Structured Output Parser compatibility in your n8n version. 3. Limit1 defaults to maxItems=10; adjust if you need more leads. Loop Over Items handles batch iteration. 4. Google Sheets nodes use appendOrUpdate with matching columns (Full Name / Email); ensure your sheet headers match the schema. 5. Costs are author estimates and will vary with actual usage and API pricing; Tavily charges after the free tier. 6. This site has not executed the workflow (reproduction=not_tested); validate in isolation with a small dataset before production use.
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
- Replace __UKH_BEARER_4__ with your real secret/token (path /nodes/4/parameters/headerParameters/parameters/1/value; literal auth header).
- Replace __UKH_BEARER_18__ with your real secret/token (path /nodes/18/parameters/headerParameters/parameters/0/value; literal auth header).
Configuration to replace
- Source template is n8n public workflow #11647 (~23 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
Configure form trigger and Apollo URL generation
After importing the template into n8n, verify the 'On form submission' node fields: Job Title (text), Company Size (dropdown: 1-10 to 10001-100000), Keywords, Location, Instantly Campaign ID. Then configure the 'Apollo URL Generator' LLM Chain node, connected to an OpenAI Chat Model (gpt-4.1). This node receives form data and uses the LLM to generate a structured Apollo search URL.
Execution prompt · Source text。Apollo URL Generator node Text input field
=Job Title: {{ $json['Job Title'] }} Company Size: {{ $json['Company Size'] }} Keywords: {{ $json.Keywords }} Location: {{ $json.Location }}Execution prompt · Source text。Apollo URL Generator node Messages system prompt field
=You are an expert Apollo.io search URL generator. Your task is to convert form data into a precise Apollo search URL. **CRITICAL INSTRUCTIONS:** 1. **Handle Multiple Values**: Fields like 'Job Title', 'Keywords', and 'Location' can contain multiple items separated by a comma. When you see a comma-separated list, you **MUST** create a separate URL parameter for **EACH** item in the list. * _Example for Titles:_ `personTitles[]=Founder&personTitles[]=CEO` * _Example for Locations:_ `personLocations[]=United%20States&personLocations[]=Austin` 2. **Supported Fields & URL Parameters**: * **Location**: Maps to `personLocations[]`. Create one for each location in the list. * **Job Title**: Maps to `personTitles[]`. Create one for each title in the list. * **Company Size**: Maps to `organizationNumEmployeesRanges[]`. This is a single value and should use a hyphen (e.g., `1-10`). * **Keywords**: Maps to `qOrganizationKeywordTags[]`. Create one for each keyword in the list. 3. **URL Encoding**: Ensure all values are properly URL-encoded (e.g., spaces become `%20`, and commas within a single location value like "Austin, Texas" become `%2C`). --- **EXAMPLE:** **Input Data:** Job Title: Founder, CEO, President Company Size: 1-10 Keywords: Fintech, SaaS Location: United States, Austin, Texas, Boston **Your Output (must be this exact format):** https://app.apollo.io/#/people?personTitles[]=Founder&personTitles[]=CEO&personTitles[]=President&organizationNumEmployeesRanges[]=1-10&qOrganizationKeywordTags[]=Fintech&qOrganizationKeywordTags[]=SaaS&personLocations[]=United%20States&personLocations[]=Austin%2C%20Texas&personLocations[]=BostonExecute Apify Apollo scrape
Configure the 'Run Apify' HTTP Request node: method POST, URL https://api.apify.com/v2/acts/jljBwyyQakqrL1wae/run-sync-get-dataset-items, Header Authorization with Bearer YOUR_APIFY_TOKEN. JSON Body includes getPersonalEmails=true, getWorkEmails=true, totalRecords=500, and the url generated in the previous step. Execute to retrieve the raw lead dataset.
Parse leads with OpenAI and write to Google Sheets
The 'Parse Lead Data' node (Basic LLM Chain, model gpt-4.1-mini, with Structured Output Parser) receives raw JSON from Apify. Configure the prompt so the LLM extracts fullName, firstName, lastName, email, title, LinkedIn, companyName, companyWebsite, companyLinkedIn, and generates a 2-3 sentence professional summary. Output passes through 'If1' to check for no error, then 'Filter' to ensure email is not null or empty, and finally 'Add to Google Sheet' appends or updates the specified Google Sheets using Full Name as the matching column.
Execution prompt · Source text。Parse Lead Data node Text input field
=Full Name: {{ $json.name }} First Name: {{ $json.first_name }} Last Name: {{ $json.last_name }} Title: {{ $json.title }} Email: {{ $json.email }} LinkedIn: {{ $json.linkedin_url }} Org Name: {{ $json.organization_name }} Org Website: {{ $json.organization_website_url }} Org LinkedIn: {{ $json.organization_linkedin_url }}Execution prompt · Source text。Parse Lead Data node Messages system prompt field
=You are a sophisticated AI data-processing engine. Your task is to receive a raw JSON object for a single business prospect, perform two critical actions, and then provide your response in a specific JSON format. **Your Instructions:** 1. **EXTRACT KEY DATA:** You must parse the raw JSON input to find and extract the following specific data points. If a field is not present, use a value of `null`. * **Full Name:** Look for `name`. * **First Name** Look for 'first_name' * **Last Name** Look for 'last_name' * **Email:** Find the first available email address. Look in fields like `emails` or `personal_emails`. * **LinkedIn** Look for the 'linkedin_url' * **Title:** Look for the `title` field. * **Company Name:** Look for the `organization_name` field. * **Company Website:** Look for the `organization_website` field. * **Company LinkedIn:** Combine `organization_linkedin. 2. **SYNTHESIZE A SUMMARY:** After extracting the data, write a concise, 2-3 sentence professional summary suitable for a sales team. 3. **FORMAT THE OUTPUT:** You MUST structure your entire response as a single, clean JSON object. The object should contain exactly the keys listed below. Do not include any other text, explanations, or greetings in your response—ONLY the final JSON object. **Required Output Format:** { "fullName": "...", "firstName": "...", "lastName": "...", "email": "...", "title": "...", "LinkedIn" "companyName": "...", "companyWebsite": "...", "companyLinkedIn": "...", "summary": "..." }Tavily company research and synthesis
'Loop Over Items' processes leads in batches. Each lead enters the 'Company Research' AI Agent node (model gpt-4.1-mini, connected to Tavily Tool and Structured Output Parser). The node receives Company Name, Company Website, and Company LinkedIn, then calls Tavily to search official website info, recent news, products/services, and third-party sentiment (G2/Reddit), outputting JSON with companyOverview, recentWebsiteNews, keyOfferings, thirdPartySentiment, and comprehensiveSummary.
Execution prompt · Source text。Company Research node Text input field
=company: {{ $json["Company Name"] }} company website: {{ $json["Company Website"] }} company linkedin: {{ $json["Company LinkedIn"] }}Execution prompt · Source text。Company Research node Options → System Message field
=You are a Company Information Synthesizer. Your primary goal is to extract key information about a target company by leveraging the `tavilysearch` tool, prioritizing content likely originating from the company's official website. Your secondary goals are checking third-party sources for customer sentiment and recent news about the comapny. You will be given the company name, company website, and company linkedin. **CORE DIRECTIVES:** 1. **TOOL USAGE:** You MUST ONLY use the `tavilysearch` tool for information gathering. 2. **PRIMARY SOURCE FOCUS (Website):** Prioritize finding and summarizing information directly presented on the company's official website (e.g., About Us, News/Blog/Press sections, Product/Service pages, Contact Us page). Use Tavily to locate these pages or relevant summaries. 3. **SECONDARY SOURCE (Sentiment ONLY):** Use Tavily to search third-party review sites (G2, Capterra, etc.) or forums (Reddit) ONLY for customer sentiment. 4. **RECENCY:** For news and highlights, focus on information from the last 12-18 months. 5. **CONCISENESS:** Keep summaries brief and factual. 6. **ACCURACY:** Do not invent information. **RESEARCH FOCUS (Guide for using Tavily):** * **Core Business:** Search for "[Company Name] About Us", "[Company Name] Mission", or what the company does, aiming for results likely linking to or summarizing their main website content. * **Recent Website News:** Search for "[Company Name] news", "[Company Name] press release", "[Company Name] blog", looking for recent announcements likely hosted on their domain. * **Products/Services:** Search for "[Company Name] products", "[Company Name] services", aiming for results describing their core offerings, likely from their website. * **Third-Party Sentiment:** Search `"[Company Name] review site:g2.com"`, `"[Company Name] reddit discussion"`, etc. **OUTPUT FORMAT:** Your final response MUST be a single JSON object containing the following keys. Provide concise, bulleted string values where appropriate: { "companyOverview": "[1-2 sentence description of what the company does, its mission, or value proposition, based on information likely found on their website.] (Source: Primarily Company Website via Tavily Search Results)", "recentWebsiteNews": "[Bullet point about a specific recent announcement, update, or blog post likely found on the company's website.] (Source: Link to specific page/article if found by Tavily, otherwise 'Company Website News/Blog')\n- [Optional second bullet point.] (Source: Link or 'Company Website News/Blog')", "keyOfferings": "[Bullet point listing a key product or service.] (Source: Company Website via Tavily Search Results)\n- [Optional second bullet point listing another offering.] (Source: Company Website via Tavily Search Results)", "thirdPartySentiment": "[Bullet point summarizing specific praise/criticism from a third-party review site/forum. Quote if concise.] (Source: [Specific URL/Site Name])\n- [Optional second bullet point.] (Source: [Specific URL/Site Name])", "comprehensiveSummary": "[1-2 sentence write up that synthesizes and ties the companyOverview, recentWebsiteNews, keyOfferings, and thirdPartySentiment all together]" } **HANDLING NO RESULTS:** If `tavilysearch` finds no relevant information, the value MUST be a string stating: "No relevant [Category Name, e.g., recent website news] found via Tavily search." Source citation for website content (overview, news, offerings) can be general ('Company Website via Tavily') unless a specific article/page URL is readily available in the search results. Source citation for `thirdPartySentiment` MUST be specific.Generate personalized outreach and push to Instantly.ai
The 'Generate Outreach Message' node (Basic LLM Chain, model gpt-4.1-mini) receives Full Name, Personal Summary, Company Name from Loop Over Items, and comprehensiveSummary from Company Research. It drafts a 100-150 word personalized cold email body (hardcoded sender context: ChaseAI AI consulting). Output then flows to 'Add Company Info to Google Sheet' which appends company info and message body using Email as matching column. Finally, 'Add Lead to Instantly AI' HTTP Request node POSTs to https://api.instantly.ai/api/v2/leads with Header Authorization: Bearer YOUR_INSTANTLY_TOKEN, Body containing campaign ID, email, name fields, and custom_variables.custom_body as the generated message. The workflow loops automatically via Loop Over Items until all leads are processed.
Execution prompt · Source text。Generate Outreach Message node Text input field
=name: {{ $('Loop Over Items').item.json["Full Name"] }} personal background: {{ $('Loop Over Items').item.json["Personal Summary"] }} company name: {{ $('Loop Over Items').item.json["Company Name"] }} company background: {{ $json.output.comprehensiveSummary }}Execution prompt · Source text。Generate Outreach Message node Messages system prompt field
=You are an Expert B2B Cold Outreach Email Drafter. Your objective is to compose a concise, professional, and highly personalized email body (target 100-150 words) to introduce ChaseAI's AI consulting services to a business prospect. **Your Company:** ChaseAI **Your Offering:** AI consulting focused on helping businesses leverage AI for benefits like operational efficiency, enhanced customer engagement, data-driven decision making, and strategic growth. **Input Data Provided:** You will receive the following information about the prospect and their company: * `name`: The prospect's name * `personal background`: A summary of the prospect's background * `company name`: The name of the prospect's company. * `company background`: A summary of the company's background. **Drafting Instructions:** 1. **Identify the Strongest Hook:** * Carefully analyze BOTH the `personal background` and the `company background` inputs. * Look for the *single most compelling and relevant piece of information* to use as a personalized opening. Prioritize items like: * Specific achievements, projects, or unique connectors mentioned. * Recent, significant company news (funding, major launch, partnership) from `company background`. * A key offering or aspect of the `companyOverview` that strongly aligns with potential AI applications. * A specific technical specialization or outreach angle * Choose the hook that allows the most natural and logical transition to the value of AI consulting for *this specific prospect* in *their specific company*. 2. **Structure & Content:** * **Opening (Personalized Hook):** Start by briefly acknowledging the prospect (using their name extracted from the `name` field) and referencing the specific hook you selected (1 sentence). Make it clear you've done some research. * **Introduction:** Briefly introduce ChaseAI and that you offer AI consulting (1 sentence). * **Value Proposition (Connecting the Dots):** Explain *why* AI consulting might be relevant *specifically* to them, given the hook point, their role ({{ $('Limit1').item.json.Title }}), and their `company`. Focus on potential benefits like efficiency, growth, tackling challenges related to their recent news, etc. (1-2 sentences). * **Call to Action (Soft):** Suggest a brief, low-pressure next step (e.g., "Would exploring how AI could apply to [Specific Area Mentioned] be valuable?", "Open to a quick chat sometime next week?"). 3. **Tone:** Professional, concise, respectful, knowledgeable (demonstrated by the hook), and focused on potential value. Avoid jargon where possible. 4. **Constraints:** * Strict word count: Aim for 100-150 words for the email body. * Use only the information provided in the input fields. Do not invent details. * If both `personal background` and `company background` lack strong, specific hooks, create the most relevant message possible focusing on their role and the `company Overview`, connecting AI's general benefits. * Return ONLY the drafted email body as a single string. Do not include a subject line, greeting ("Hi [Name],"), sign-off ("Best,"), or begin the draft by mention their first name (the opener will have already been written with their first name) **Output Format:** Return ONLY the drafted email body as a single string. Do not include a subject line, greeting ("Hi [Name],"), sign-off ("Best,"), or begin the draft by mention their first name (the opener will have already been written with their first name) **Example Output** I noticed Synchro Social’s focus on videography and strategic content creation, which presents great opportunities to harness AI for enhancing content personalization and streamlining production workflows. At ChaseAI, we specialize in helping businesses like yours leverage AI technologies to boost operational efficiency and sharpen customer engagement. Given your leadership role and Synchro Social’s creative service model, integrating AI can support data-driven insights to tailor content strategies and accelerate delivery without compromising quality. Would exploring how AI could enhance your content creation process and audience targeting be valuable? I’d be glad to discuss how tailored AI solutions might fit your goals in a brief chat.
Prompt you can copy
Setup guidance · Editorial suggestion。Hand to setup assistant: confirm inputs and permissions first, then import template and replace credentials
This block is the prompt. Ads are never placed here.
Please set up this n8n template for automated lead generation and outreach. First confirm you have: an n8n instance, API keys for Apify/OpenAI/Instantly.ai/Tavily, Google Sheets OAuth access, and a valid Instantly.ai campaign ID. Then import the workflow JSON, replace credentials and document IDs, test form submission, and verify each node's output.
After importing the template, be sure to replace YOUR_TOKEN_HERE in all HTTP nodes and the example Google Sheets documentId. Test the Apify node with a small totalRecords (e.g., 10) to verify URL generation and data parsing before running at full volume.
Source
Automated LinkedIn lead generation & AI personalized outreach with Apollo & Instantly · n8nwizard · n8n.io · 2025-12-10
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.