n8n AI Agents Sales
9 min read Automation

I Built an AI Agent That Finds Leads + Writes Emails Automatically

Manual prospecting is the silent killer of sales productivity. This n8n workflow eliminates hours of LinkedIn scraping and email drafting by automatically finding qualified leads and writing personalized outreach - while you focus on closing deals.

The Prospecting Problem Every Sales Team Faces

Sales teams waste an average of 6.5 hours per rep each week on manual prospecting activities according to HubSpot research. The process of finding qualified leads on LinkedIn, verifying their contact information, and crafting personalized emails is tedious yet critical work that directly impacts revenue.

Traditional approaches force salespeople to choose between quantity and quality - either sending generic bulk emails that get ignored or spending hours crafting perfect messages to just a handful of prospects. This workflow eliminates that compromise by automating the entire process at scale.

68% of salespeople say prospecting is their least favorite activity yet it accounts for 40% of their work week. Automating this process doesn't just save time - it improves morale and reduces burnout among your sales team.

How the AI Lead Generation Agent Works

The system combines three powerful technologies into one seamless workflow: LinkedIn scraping via Apify to identify prospects, OpenAI to generate personalized emails, and Google Sheets to organize the output. Together they handle the entire prospecting process from discovery to ready-to-send outreach.

Here's the step-by-step flow when you execute the automation:

  1. You specify target criteria (job titles, industries, locations)
  2. Apify scrapes LinkedIn for matching profiles
  3. The system extracts contact info and company details
  4. OpenAI generates personalized emails for each lead
  5. All data saves to Google Sheets with ready-to-send emails

The average execution time for 100 leads is under 10 minutes compared to 3-4 hours when done manually. That's a 95% reduction in prospecting time while producing higher quality outreach.

Step 1: Setting Up Your n8n Instance

The foundation of this automation is n8n, an open-source workflow automation tool. You have three hosting options:

  1. Local installation: Free but requires technical knowledge to set up and maintain
  2. Webspace Kit hosting: $5/month with zero setup required (recommended)
  3. n8n.cloud: $24/month with some feature limitations

For most businesses, Webspace Kit provides the best balance of affordability and simplicity. After purchasing your plan (starting at $5/month), you'll receive your instance URL where you can access the n8n editor.

Step 2: Importing the Lead Generation Workflow

Rather than building from scratch, you'll import a pre-made template that includes all the necessary nodes configured for lead generation. After downloading the template file (available in the video description), you'll:

  1. Navigate to the Workflows tab in your n8n instance
  2. Click "Import from file" and select the downloaded template
  3. Name your workflow (e.g., "Lead Generation Agent")
  4. Save the imported workflow

Initially, some nodes will show warning signs indicating they need configuration. These include the OpenAI, Apify, and Google Sheets nodes which we'll set up in the next steps.

Step 3: Configuring OpenAI for Email Generation

The OpenAI node powers the email personalization component of the workflow. To set it up:

  1. Create credentials in n8n for the OpenAI node
  2. Name your credentials (e.g., "LeadGen AI")
  3. Paste your OpenAI API key (available in your OpenAI account)
  4. Save and close the credentials

With OpenAI connected, the system can now generate human-like emails tailored to each prospect's role and company. You can customize the email templates by modifying the prompt in the OpenAI node to match your brand voice and value proposition.

Pro Tip: Provide 3-5 sample emails in your preferred style when first setting up the workflow. The AI will analyze these examples to better match your communication style.

Step 4: Setting Up Apify for LinkedIn Scraping

Apify provides the LinkedIn scraping capability that finds your ideal prospects. Configuration involves:

  1. Signing up for an Apify account
  2. Choosing a plan (Starter plan works for most businesses)
  3. Connecting your payment method
  4. Generating an API key in the Apify settings
  5. Adding the API key to the Apify node in your n8n workflow

Apify's LinkedIn scraper can extract profiles based on job title, industry, location, and other filters you specify. The data includes names, positions, companies, and when available, email addresses and phone numbers.

Step 5: Connecting Google Sheets for Lead Storage

The final core component is Google Sheets, which serves as your lead database. To connect:

  1. Create a new Google Cloud project
  2. Enable the Google Sheets API
  3. Configure OAuth consent screen
  4. Generate credentials (OAuth client ID)
  5. Add these credentials to the Google Sheets node in n8n

The workflow will automatically create a new sheet with columns for all prospect details including the AI-generated email. You can easily export this data to your CRM or use it directly for outreach campaigns.

Testing and Executing Your First Lead Run

With all components configured, you're ready to test the workflow:

  1. Click "Execute Workflow" in n8n
  2. Complete the form with your target criteria (job titles, industries, locations)
  3. Submit and monitor the execution progress
  4. Review the scraped leads and generated emails in Google Sheets

The first run helps verify all connections are working properly. You may need to adjust your search criteria or email templates based on the initial results. Once perfected, you can schedule this workflow to run automatically at regular intervals.

Typical results: The system finds valid contact information for 85-90% of scraped profiles and generates emails that outperform generic templates by 3-5x in response rates.

Watch the Full Tutorial

See the complete setup process in action with timestamped guidance for each configuration step. The video includes pro tips for optimizing your lead criteria and email templates that aren't covered in this article.

Video tutorial showing complete AI lead generation agent setup

Key Takeaways

This AI-powered lead generation system transforms one of the most time-consuming sales activities into an automated process that runs in the background. By combining n8n with specialized tools for scraping, AI writing, and data storage, you can build a prospecting machine that works while you sleep.

In summary: The workflow finds 100 qualified leads in 10 minutes (vs. 4 hours manually), writes personalized emails for each, and organizes everything in a ready-to-use spreadsheet - giving your sales team back 30+ hours per month to focus on closing deals.

Frequently Asked Questions

Common questions about this topic

This automated system scrapes LinkedIn for leads matching your criteria (job title, industry, location), extracts their contact information including email addresses, and generates personalized outreach emails tailored to each prospect.

It handles the entire prospecting process from finding leads to creating ready-to-send emails without manual effort. The workflow runs on a schedule you set, continuously feeding your pipeline with qualified prospects.

  • Automatically finds leads based on your ideal customer profile
  • Extracts verified contact information including emails
  • Generates personalized emails in your brand voice

Manual prospecting typically takes 3-4 hours per 100 leads when searching LinkedIn, verifying emails, and writing personalized messages. This automation completes the same work in under 10 minutes.

The time savings compound significantly over weeks and months. A sales team of 5 reps saves 150+ hours monthly by automating this process - equivalent to nearly a full-time employee's capacity.

  • 95% reduction in prospecting time
  • Consistent output regardless of workload or fatigue
  • Scalable to any volume of leads needed

The system combines n8n with three specialized services to create a complete prospecting solution: Apify for LinkedIn scraping, OpenAI for email generation, and Google Sheets for lead storage and organization.

These integrations work together seamlessly through n8n's workflow automation capabilities. The system handles all data transfers between platforms automatically, requiring no manual intervention once configured.

  • Apify: Professional LinkedIn scraping with high accuracy
  • OpenAI: Natural language email generation in your brand voice
  • Google Sheets: Centralized lead database with CRM export options

Yes, the email generation component is fully customizable. You can provide sample emails in your brand voice, specify key talking points to include, and adjust the tone from formal to conversational.

The system learns from your examples to create on-brand messaging. You can even create multiple template variations for different prospect segments (e.g., technical vs. executive contacts).

  • Upload your existing email templates as examples
  • Specify mandatory inclusions (value props, CTA)
  • Set tone parameters (formal, friendly, technical)

The system achieves approximately 85-90% accuracy for email addresses when scraping LinkedIn profiles combined with additional data verification steps. Each lead record includes multiple contact points to maximize reachability.

In addition to email addresses, the workflow captures LinkedIn profile URLs, company websites, and when available, direct phone numbers. This multi-point contact approach ensures you can reach prospects even if one channel fails.

  • 85-90% email accuracy rate
  • Multiple contact methods per lead
  • Continuous verification improvements

The base cost is approximately $35/month ($5 for n8n hosting, $20 for Apify scraping credits, and $10 for OpenAI API usage). This supports generating 200-300 qualified leads per month.

Compared to the cost of a sales rep's time (typically $50+/hour), the automation pays for itself after just one hour of saved prospecting time. At scale, the ROI becomes even more significant.

  • $5/month n8n hosting
  • $20/month Apify scraping credits
  • $10/month OpenAI usage

The workflow includes customizable filters for job title, industry, company size, location, and years of experience. You can adjust these parameters before each run to target exactly the right prospects.

Advanced users can add additional filters like education, skills, or group memberships. The system supports Boolean search operators for precise targeting (e.g., "Marketing AND (Director OR VP)").

  • Core filters: Title, Industry, Location, Company Size
  • Advanced filters: Experience, Education, Skills
  • Boolean search capability for precision

GrowwStacks can customize this lead generation system for your specific industry and sales process. We'll configure the scraping criteria to match your ideal customer profile, train the AI on your email templates, and integrate with your CRM.

Our team handles the technical implementation so you can focus on closing deals from qualified leads. We offer ongoing optimization to improve targeting accuracy and email performance over time.

  • Custom workflow tailored to your ideal customer
  • CRM integration (HubSpot, Salesforce, etc.)
  • Performance tracking and optimization

Ready to Transform Your Prospecting Process?

Manual lead generation steals valuable time from revenue-generating activities. Let GrowwStacks build your custom AI prospecting system that delivers 100+ qualified leads weekly with personalized emails - all on autopilot.