You can spin up a fully autonomous cold-outreach pipeline in under two hours by connecting n8n (a visual workflow engine) to the Perplexity API (a fast, knowledge-aware LLM). The resulting agents continuously scrape target lists, craft hyper-personalised messages, and fire them off without human touch, giving you a reproducible lead-generation engine that runs on its own schedule.
cold outreach automation is the systematic use of software to discover, contact, and follow up with prospects who have never interacted with you before.
Below you'll learn exactly how to build cold outreach AI agents that source leads, write emails, and track results - all without writing a single line of server code.
What you need
| Tool | Plan / Price | Role |
|---|---|---|
| n8n Cloud (or self-hosted Docker) | Free tier: 2 000 workflow executions / month · Paid: $20 / month for 20 000 executions (see <https://n8n.io/pricing>) | Orchestrates the whole pipeline - scheduling, branching, API calls, and logging |
| Perplexity API | Free tier: 5 000 tokens / month · Pay-as-you-go: $0.002 / token (check the latest pricing at <https://docs.perplexity.ai>) | Generates prospect lists and writes personalized outreach copy |
| Gmail / SMTP account | Free (Gmail) or any paid SMTP provider | Sends the outbound emails |
| Google Sheets (optional) | Free Google account | Stores lead status and reply metrics |
| Docker (if self-hosting n8n) | Free (download from Docker Hub) | Runs n8n on your own server |

Estimated build time: 90 minutes for a cloud-only setup, 120 minutes if you provision a self-hosted Docker instance (includes pulling the image and opening ports).
Step-by-step build
1. Spin up n8n
Cloud route (recommended for speed): - Sign up at <https://n8n.io> and select the Free plan. - Create a new workspace called Cold Outreach AI.
Self-hosted route:
Tip: The environment variables above enable basic auth; replace
CHANGE_MEwith a strong password. After the container starts, openhttp://localhost:5678and log in.
2. Grab a Perplexity API key
- Register at <https://docs.perplexity.ai> and create an API key.
- Store the key in n8n's Credentials store: Perplexity API → API Key. This keeps the secret out of your workflow JSON.
3. Create a scheduled trigger
- In the n8n editor, click + → Trigger → Cron.
- Set it to run daily at 09:00 UTC (adjust for your time zone).
- Name the node Daily Lead Generator.
4. Query Perplexity for a prospect list
We'll ask Perplexity to return 10-15 companies that match a niche. Add an HTTP Request node:
- Method:
POST - URL:
https://api.perplexity.ai/v1/chat/completions - Authentication: Choose the Perplexity API credential you saved.
- Headers:
Content-Type: application/json - Body (JSON):
What this does: Calls the Perplexity LLM and asks it to produce a machine-readable list of target companies.
When the node runs, you should see a response like:
5. Parse the JSON into n8n items
Add a Set node named Parse Leads:
- Turn the string
{{$json["choices"][0]["message"]["content"]}}into an object using the built-inJSON.parse()expression:
- This node will output one item per prospect, each with
name,domain,founder, andlatest_funding_amount.
6. Enrich each lead (optional)
If you need more data (e.g., LinkedIn URL), attach another HTTP Request node that hits a public enrichment API such as Clearbit (free tier 100 requests/day). Map the domain field into the query string.
7. Generate a personalised email
Add another HTTP Request node (Write Email) that re-uses Perplexity for copy:
- Body (JSON):
- Output: The
contentfield will contain the email body.
8. Send the email
Use the Gmail node (or SMTP if you prefer a corporate relay):
- From:
sales@yourcompany.com - To:
{{ $json.founder }} <{{ $json.domain }}>(you may need to look up the founder's email via a separate enrichment step). - Subject:
Congrats on your ${{ $json.latest_funding_amount }} raise, {{ $json.founder }}! - Body:
{{ $json["choices"][0].message.content }}(the email text from the previous node).
Enable 'Throw On Error' so any failed send is caught by the error branch later.
9. Log the outreach
Add a Google Sheets node (Log to Sheet) to append a row with:
| Timestamp | Company | Founder | Domain | Funding | Email Sent |
|---|
Map the fields directly from the current item. This gives you a single source of truth for reporting.
10. Add error handling and retry logic
- Connect the Error output of the Gmail node to a Function node that marks the row in the sheet as "Failed - retry later".
- Use an IF node to check
{{ $json["choices"][0].message.content }}length; if it's "null" or shorter than 30 characters, route the item back to Write Email with a higher temperature (0.8) to encourage more creative output.
11. Activate the workflow
Hit Activate in the top right. The Cron trigger will now fire each day, pulling fresh leads, generating copy, sending emails, and logging everything automatically.
!Step-by-step build — how to build cold outreach ai agents ## Where this breaks
Most failures stem from external-API limits, not n8n itself.
| Failure mode | Symptom | Fix |
|---|---|---|
| Perplexity rate-limit (free tier) | "429 Too Many Requests" error after ~5 calls/second | Add a Delay node of 2 seconds before each HTTP Request; upgrade to a paid plan if you need higher throughput |
| Token exhaustion | Response is cut off, email body is incomplete | Increase max_tokens to 800 (still under the 1 024 token max for the 70B model) or batch leads fewer at a time |
| Missing founder email | Gmail node throws "Invalid recipient address" | Insert an enrichment step (Clearbit or Hunter) and fallback to a generic sales@{{domain}} address |
| Gmail quota (5000/day for free accounts) | Emails stop after a few hundred sends | Switch to a dedicated SMTP relay (e.g., SendGrid) or request a higher quota from Google Workspace |
| n8n execution cap (free tier) | "Execution limit reached" in the UI | Upgrade to the $20 / month plan (20 000 executions/month) or self-host the Docker container, which has no built-in cap |
| JSON parsing errors | "Unexpected token" in the Parse Leads node | Ensure Perplexity returns a valid JSON string; wrap the prompt with "Return ONLY a JSON array." and double-check quoting |
Proactive monitoring: Add a Telegram node that notifies you on any error branch, so you can intervene before the pipeline stalls.
For a deeper technical reference, see n8n's documentation.
FAQ
How many leads can I safely process per day on the free tiers?
Perplexity's free tier allows around 5 000 tokens per month, which equates to roughly 10-12 full-prompt executions daily (each execution consumes ~400-500 tokens). n8n's free tier gives you 2 000 workflow executions per month, so a daily batch of 12 leads stays well within both limits.
Can I replace Perplexity with another LLM (e.g., OpenAI) without changing the workflow?
Yes. Swap the HTTP Request node's URL to https://api.openai.com/v1/chat/completions, update the Authentication credential to an OpenAI API key, and change the payload's model field (e.g., "gpt-4o"). The JSON structure is identical, so downstream nodes remain unchanged.
What if a prospect unsubscribes or replies "stop emailing me"?
Add an IMAP Email node that watches your inbox for the phrase "unsubscribe". When it fires, use a Set node to mark the domain as "Do Not Contact" in your Google Sheet, and filter it out with an IF node at the start of the workflow.
Do I need to host my own n8n instance to meet GDPR requirements?
Self-hosting gives you full control over data residency. Deploy the Docker image behind your own firewall, configure a PostgreSQL database for persistent storage, and set N8N_ENCRYPTION_KEY environment variable to encrypt credentials at rest.
How much will this cost at scale (e.g., 5 000 emails per month)?
Assuming 5 000 emails, you'll need roughly 5 000 Perplexity tokens for lead generation + 5 000 for copy, totaling 10 000 tokens ≈ $20 / month on a pay-as-you-go plan. n8n's paid tier at $20 / month gives you 20 000 executions, sufficient for the extra HTTP calls and logging. Add any SMTP provider fees (SendGrid starts free up to 100 emails/day). Expect < $50 / month total for a medium-scale deployment.
By following this guide you now have a production-ready, autonomous cold-outreach AI agent built on n8n and the Perplexity API. The same pattern can be extended to LinkedIn outreach, SMS follow-ups, or even multi-step nurture sequences - just replace the Gmail node with the channel you need.
If you're hunting for more ready-made automations you can sell, check out the AI automations you can sell. And for a deeper dive into scaling lead-gen pipelines, grab the free guide.
Happy building.