AutomationFlowsAI & RAG › Automate Cold Outreach with Apollo, Linkedin & Gmail Using Gpt-4

Automate Cold Outreach with Apollo, Linkedin & Gmail Using Gpt-4

ByRysysth @rysysth on n8n.io

This n8n workflow automates the complete cold outreach process by combining Apollo.io lead generation, LinkedIn networking, and personalized email outreach into one streamlined system.

Event trigger★★★★☆ complexityAI-powered19 nodesForm TriggerOpenAI ChatChain LlmHTTP RequestOutput Parser StructuredGmailAgentHubSpot
AI & RAG Trigger: Event Nodes: 19 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow corresponds to n8n.io template #8449 — we link there as the canonical source.

This workflow follows the Agent → Chainllm recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "id": "dvVVzRVWInFFogN0",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Email Outreach + LinkedIn Connect",
  "tags": [],
  "nodes": [
    {
      "id": "087f30b6-a19a-4655-8d1a-d133c9df6a2b",
      "name": "On form submission",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -1968,
        688
      ],
      "parameters": {
        "options": {},
        "formTitle": "Apollo + Apify Lead Generation",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Job Title",
              "placeholder": "Founder, Engineer, Owner, CEO , Developer"
            },
            {
              "fieldType": "dropdown",
              "fieldLabel": "Company Size",
              "fieldOptions": {
                "values": [
                  {
                    "option": "1-10"
                  },
                  {
                    "option": "11-50"
                  },
                  {
                    "option": "51-200"
                  },
                  {
                    "option": "201-1000"
                  },
                  {
                    "option": "10001-5000"
                  },
                  {
                    "option": "5001-10000"
                  },
                  {
                    "option": "10001-100000"
                  }
                ]
              }
            },
            {
              "fieldLabel": "Keywords",
              "placeholder": "Keywords relevant to the contact or company"
            },
            {
              "fieldLabel": "Location",
              "placeholder": "United States, California, London"
            }
          ]
        },
        "formDescription": "Describe the types of leads you are trying to find."
      },
      "typeVersion": 2.2
    },
    {
      "id": "a4fa7a8f-4102-4b62-b6d9-875e8f647c6c",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -1776,
        880
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1",
          "cachedResultName": "gpt-4.1"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "7232e63e-036d-4753-bc52-45bd4fb6e76e",
      "name": "Apollo URL Generator",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        -1744,
        720
      ],
      "parameters": {
        "text": "=Job Title: {{ $json['Job Title'] }}\n\nCompany Size: {{ $json['Company Size'] }}\n\nKeywords: {{ $json.Keywords }}\n\nLocation: {{ $json.Location }}\n\n\n",
        "batching": {},
        "messages": {
          "messageValues": [
            {
              "message": "=You are an expert Apollo.io search URL generator. Your task is to convert form data into a precise Apollo search URL.\n\n**CRITICAL INSTRUCTIONS:**\n\n1.  **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.\n    * _Example for Titles:_ `personTitles[]=Founder&personTitles[]=CEO`\n    * _Example for Locations:_ `personLocations[]=United%20States&personLocations[]=Austin`\n\n2.  **Supported Fields & URL Parameters**:\n    * **Location**: Maps to `personLocations[]`. Create one for each location in the list.\n    * **Job Title**: Maps to `personTitles[]`. Create one for each title in the list.\n    * **Company Size**: Maps to `organizationNumEmployeesRanges[]`. This is a single value and should use a hyphen (e.g., `1-10`).\n    * **Keywords**: Maps to `qOrganizationKeywordTags[]`. Create one for each keyword in the list.\n\n3.  **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`).\n\n---\n\n**EXAMPLE:**\n\n**Input Data:**\nJob Title: Founder, CEO, President\nCompany Size: 1-10\nKeywords: Fintech, SaaS\nLocation: United States, Austin, Texas, Boston\n\n**Your Output (must be this exact format):**\nhttps://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[]=Boston"
            }
          ]
        },
        "promptType": "define"
      },
      "typeVersion": 1.7
    },
    {
      "id": "93ec5479-f4bb-4a20-890c-70c0ecbeb8da",
      "name": "Limit",
      "type": "n8n-nodes-base.limit",
      "position": [
        -1280,
        720
      ],
      "parameters": {
        "maxItems": 10
      },
      "typeVersion": 1
    },
    {
      "id": "fab5d3f1-5d58-47b9-a7f2-c8eb20a4d497",
      "name": "scrape_profile",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -960,
        720
      ],
      "parameters": {
        "url": "=https://<subdomain>.unipile.com:<port>/api/v1/users/{{ $json.user }}",
        "options": {},
        "sendQuery": true,
        "jsonHeaders": "{\n    \"accept\": \"application/json\",\n    \"X-API-KEY\": \"UNIPILE API KEY\"\n}\n",
        "sendHeaders": true,
        "specifyHeaders": "json",
        "queryParameters": {
          "parameters": [
            {
              "name": "account_id",
              "value": "UNIPILE ACCOUNT ID"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "98b15250-bce0-4571-81bd-34ff68b22f5b",
      "name": "OpenAI Chat Model4",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -432,
        960
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "1b5dc34b-ba29-4a7d-ab56-f05f9fd26783",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        16,
        960
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"connection_request\": [\n    \"text here (\u2264300 chars, personalized)\"\n  ],\n  \"email\": {\n    \"subject\": [\n      \"subject\"\n    ],\n    \"body\": [\n      \"body\"\n      \n    ]\n  }\n}\n"
      },
      "typeVersion": 1.3
    },
    {
      "id": "0e45a7bf-febe-44bf-bb59-b3728715ee36",
      "name": "send_linkedIn_invitation",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueRegularOutput",
      "position": [
        496,
        800
      ],
      "parameters": {
        "url": "https://<subdomain>.unipile.com:<port>/api/v1/users/invite",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "jsonHeaders": "{\n    \"accept\": \"application/json\",\n    \"content-type\": \"application/json\",\n    \"X-API-KEY\": \"UNIPILE API KEY\"\n}",
        "sendHeaders": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "provider_id",
              "value": "={{ $('scrape_profile').item.json.provider_id }}"
            },
            {
              "name": "account_id",
              "value": "\"UNIPILE ACCOUNT ID\""
            },
            {
              "name": "message",
              "value": "={{ $('outreach_message').item.json.output.connection_request }}"
            }
          ]
        },
        "specifyHeaders": "json"
      },
      "typeVersion": 4.2
    },
    {
      "id": "e2090f65-5dfe-4f3d-beb3-1de41f3b7ac8",
      "name": "not_connected?",
      "type": "n8n-nodes-base.if",
      "position": [
        224,
        816
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "fac2264e-8241-4d0d-aa18-a7317b85ea83",
              "operator": {
                "type": "boolean",
                "operation": "false",
                "singleValue": true
              },
              "leftValue": "={{ $('scrape_profile').item.json.is_relationship }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "42dda622-b761-4253-86bc-8a01b4fd8397",
      "name": "Send a message",
      "type": "n8n-nodes-base.gmail",
      "position": [
        976,
        416
      ],
      "parameters": {
        "sendTo": "={{ $('run apify').item.json.email }}",
        "message": "={{ $('outreach_message').item.json.output.email.body }}",
        "options": {},
        "subject": "={{ $('outreach_message').item.json.output.email.subject }}"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "39285049-43b3-44b3-b6e9-b3d066ac07d4",
      "name": "email_verifier",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueErrorOutput",
      "position": [
        464,
        448
      ],
      "parameters": {
        "url": "https://api.zerobounce.net/v2/validate",
        "options": {},
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "api_key",
              "value": "ZEROBOUNCE API KEY"
            },
            {
              "name": "email",
              "value": "={{ $('run apify').item.json.email }}"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "caad612f-6fab-405d-9d27-c58c53f567c7",
      "name": "outreach_message",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -336,
        704
      ],
      "parameters": {
        "text": "=first_name : {{ $('scrape_profile').item.json.first_name }}\ncompany_name : {{ $('run apify').item.json.organization_name }}\ncompany_website: {{ $('run apify').item.json.organization_website_url }}\nIndustry: {{ $('run apify').item.json.organization.industry }}\ncompany_description: {{ $('company_profile').item.json.description }}",
        "options": {
          "systemMessage": "=You are a professional B2B sales copywriter.\nInput: JSON object with lead details (first_name, last_name, company, title, industry, pain_points, company_description etc.)\nOutput: Strict JSON with the following keys:\n{\n  \"connection_request\": \"short, under 300 chars, friendly, personalized\",\n  \"email\": {\n    \"subject\": \"5-7 words, curiosity or value driven\",\n    \"body\": \"3-5 sentences, personalized, offering value or case study, with a clear but soft CTA\"\n  }\n}\nNo explanations, only valid JSON."
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2.1
    },
    {
      "id": "84c7b143-135b-4e16-b0be-6151e865a080",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        720,
        432
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "or",
          "conditions": [
            {
              "id": "367ceef7-0647-4e4f-bdd6-9e264b504518",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.status }}",
              "rightValue": "valid"
            },
            {
              "id": "1dc88001-5d60-4df6-a2db-ed81c84949c1",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.status }}",
              "rightValue": "catch-all"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "5b605c76-b105-4af3-86d7-492d3465b544",
      "name": "email_exists",
      "type": "n8n-nodes-base.if",
      "position": [
        224,
        464
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "81b1cb4d-80a3-4009-821e-cbffa1c32335",
              "operator": {
                "type": "boolean",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $('Append or update row in sheet').item.json.email }}",
              "rightValue": ""
            }
          ]
        },
        "looseTypeValidation": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "b010cc9e-1cc7-4b9e-843f-a686a7aea3b1",
      "name": "Create or update a contact",
      "type": "n8n-nodes-base.hubspot",
      "onError": "continueErrorOutput",
      "position": [
        -592,
        720
      ],
      "parameters": {
        "email": "={{ $('run apify').item.json.email }}",
        "options": {},
        "authentication": "appToken",
        "additionalFields": {
          "city": "={{ $('run apify').item.json.city }}",
          "country": "={{ $('run apify').item.json.country }}",
          "industry": "={{ $('run apify').item.json.organization.industry }}",
          "lastName": "={{ $('run apify').item.json.last_name }}",
          "firstName": "={{ $('run apify').item.json.first_name }}",
          "postalCode": "={{ $('run apify').item.json.organization.postal_code }}",
          "websiteUrl": "={{ $('run apify').item.json.organization_website_url }}",
          "companyName": "={{ $('run apify').item.json.organization_name }}",
          "companySize": "={{ $json.employee_count }}",
          "phoneNumber": "={{ $json.phone }}"
        }
      },
      "credentials": {
        "hubspotAppToken": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "21ee11c1-109e-4639-9be8-fb123dd32445",
      "name": "company_profile",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -768,
        720
      ],
      "parameters": {
        "url": "=https://<subdomain>.unipile.com:<port>/api/v1/linkedin/company/{{ $('public_identifiers').item.json.company_url }}",
        "options": {},
        "sendQuery": true,
        "jsonHeaders": " {\n    \"accept\": \"application/json\",\n    \"X-API-KEY\": \"UNIPILE API KEY\"\n}",
        "sendHeaders": true,
        "specifyHeaders": "json",
        "queryParameters": {
          "parameters": [
            {
              "name": "account_id",
              "value": "UNIPILE ACCOUNT ID"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "12e342e1-3a19-47a9-bceb-386afc1e5e57",
      "name": "run apify",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1424,
        720
      ],
      "parameters": {
        "url": "https://api.apify.com/v2/acts/code_crafter~apollo-io-scraper/run-sync-get-dataset-items",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n    \"cleanOutput\": false,\n    \"url\": \"{{ $json.text }}\"\n} ",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer <apify_api_YOUR_TOKEN_HERE_TOKEN_HERE>"
            },
            {
              "name": "Accept",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "629b2c53-1920-4cfb-943b-5754bdaab2d4",
      "name": "public_identifiers",
      "type": "n8n-nodes-base.set",
      "position": [
        -1120,
        720
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "aa22feea-cadb-4208-8200-93b3684c5d01",
              "name": "user",
              "type": "string",
              "value": "={{ $json.linkedin_url.split(\"/\").filter(Boolean).pop() }}"
            },
            {
              "id": "4f1fcee0-9dd7-4565-873c-e2040efe16d7",
              "name": "company_url",
              "type": "string",
              "value": "={{ $json.organization.linkedin_url.split(\"/\").filter(Boolean).pop() }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "849052e1-80c1-40e1-8ec4-6a7f672664db",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2320,
        128
      ],
      "parameters": {
        "width": 976,
        "height": 1296,
        "content": "#  Email Outreach + LinkedIn Connect\n\n\n##  How It Works (Step Flow)\n\n1. **User submits Form**  \n   - Inputs: Job Title, Company Size, Keywords, Location  \n\n2. **OpenAI builds Apollo search URL**  \n\n3. **Apify API scrapes leads from Apollo**  \n   - Limit: 10 leads per run (set in workflow)  \n\n4. **Unipile fetches LinkedIn profile + company info**  \n\n5. **Lead pushed into HubSpot CRM**  \n\n6. **OpenAI generates personalized LinkedIn request & email**  \n\n7. **If not connected \u2192** Unipile sends LinkedIn invite  \n\n8. **If email exists \u2192** ZeroBounce verifies email  \n\n9. **If email valid \u2192** Gmail sends outreach email  \n\n\n##  APIs Needed\n\n### Apify API  \n- Actor: Apollo.io Scraper  \n- Purpose: Scrape leads (emails, LinkedIn, org info)  \n- Cost: $1.20 / 1000 leads  \n- Free: $5 \u2192 ~4,000 leads  \n\n### Unipile API  \n- Purpose: LinkedIn profile + company scrape, send invites  \n- Cost: Free 7 days \u2192 then paid  \n\n### ZeroBounce API  \n- Purpose: Email validation (valid / catch-all / invalid)  \n- Free: 100/month  \n- Cost: $16 / 2,000 emails (~$0.008/email)  \n\n### OpenAI API  \n- Purpose: Generate Apollo URL + outreach copy  \n- Models: gpt-4.1, gpt-4.1-mini  \n- Cost: ~$10\u2013$30 / 1M tokens (~$0.05\u2013$0.20 / 1000 leads)  \n\n### HubSpot API  \n- Purpose: Store/update contacts in CRM  \n- Cost: Free with HubSpot account  \n\n### Gmail API  \n- Purpose: Send outreach emails  \n- Cost: Free (limits: 500/day personal, 2000/day workspace)  "
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "bc57e54f-eca7-40f2-9731-26dbd442f3b6",
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Send a message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Limit": {
      "main": [
        [
          {
            "node": "public_identifiers",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "run apify": {
      "main": [
        [
          {
            "node": "Limit",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "email_exists": {
      "main": [
        [
          {
            "node": "email_verifier",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "email_verifier": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "not_connected?": {
      "main": [
        [
          {
            "node": "send_linkedIn_invitation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "scrape_profile": {
      "main": [
        [
          {
            "node": "company_profile",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "company_profile": {
      "main": [
        [
          {
            "node": "Create or update a contact",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "outreach_message": {
      "main": [
        [
          {
            "node": "not_connected?",
            "type": "main",
            "index": 0
          },
          {
            "node": "email_exists",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Apollo URL Generator",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "Apollo URL Generator",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model4": {
      "ai_languageModel": [
        [
          {
            "node": "outreach_message",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "public_identifiers": {
      "main": [
        [
          {
            "node": "scrape_profile",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Apollo URL Generator": {
      "main": [
        [
          {
            "node": "run apify",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "outreach_message",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "send_linkedIn_invitation": {
      "main": [
        []
      ]
    },
    "Create or update a contact": {
      "main": [
        [
          {
            "node": "outreach_message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

This n8n workflow automates the complete cold outreach process by combining Apollo.io lead generation, LinkedIn networking, and personalized email outreach into one streamlined system.

Source: https://n8n.io/workflows/8449/ — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

Typeform IA - YT. Uses typeformTrigger, agent, lmChatOpenAi, toolWorkflow. Event-driven trigger; 75 nodes.

Typeform Trigger, Agent, OpenAI Chat +7
AI & RAG

PixelSensei(ZH). Uses agent, outputParserStructured, formTrigger, lmChatOpenAi. Event-driven trigger; 55 nodes.

Agent, Output Parser Structured, Form Trigger +4
AI & RAG

This workflow is perfect for: Agile development teams and project managers who need to quickly set up Jira projects Product managers who want to convert feature ideas into structured user stories and

Form Trigger, OpenAI Chat, Output Parser Structured +5
AI & RAG

This workflow automates end-to-end contract and invoice management using AI intelligence. It processes proposals through intelligent contract generation, approval workflows, and automated invoicing. O

Form Trigger, Data Table, Agent +4
AI & RAG

Automates SaaS operations by consolidating user management, AI-driven support triage, analytics, and billing into one unified system. User signups flow through registration, support requests route via

Form Trigger, Data Table, Agent +7