8
n8n 中文网amn8n.com

邮件外联 + LinkedIn 连接

高级

这是一个Miscellaneous, Multimodal AI领域的自动化工作流,包含 19 个节点。主要使用 If, Set, Gmail, Limit, Hubspot 等节点。 使用Apollo、LinkedIn和Gmail通过GPT-4自动化外联营销

前置要求
  • Google 账号和 Gmail API 凭证
  • HubSpot API Key
  • 可能需要目标 API 的认证凭证
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "dvVVzRVWInFFogN0",
  "meta": {
    "instanceId": "df9b257da736310d3b15d5b6f0889a902c96828abded37a94764355ae178af44",
    "templateCredsSetupCompleted": true
  },
  "name": "邮件外联 + LinkedIn 连接",
  "tags": [],
  "nodes": [
    {
      "id": "087f30b6-a19a-4655-8d1a-d133c9df6a2b",
      "name": "表单提交时",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -1968,
        688
      ],
      "webhookId": "3ee6cc3d-bb09-44a4-8388-dd67a70b2c0d",
      "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 聊天模型",
      "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": {
          "id": "FTvInt0PfXa5gnME",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "7232e63e-036d-4753-bc52-45bd4fb6e76e",
      "name": "Apollo URL 生成器",
      "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": "限制",
      "type": "n8n-nodes-base.limit",
      "position": [
        -1280,
        720
      ],
      "parameters": {
        "maxItems": 10
      },
      "typeVersion": 1
    },
    {
      "id": "fab5d3f1-5d58-47b9-a7f2-c8eb20a4d497",
      "name": "抓取资料",
      "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 聊天模型4",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -432,
        960
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "FTvInt0PfXa5gnME",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "1b5dc34b-ba29-4a7d-ab56-f05f9fd26783",
      "name": "多表:您可以连接多个表以实现有组织的数据结构",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        16,
        960
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"connection_request\": [\n    \"text here (≤300 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": "发送 LinkedIn 邀请",
      "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": "未连接?",
      "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": "发送消息",
      "type": "n8n-nodes-base.gmail",
      "position": [
        976,
        416
      ],
      "webhookId": "59a037b8-bc60-4b57-9e03-0829f7913756",
      "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": {
          "id": "MdKTzZXZkFeVjeb5",
          "name": "rysysth.development"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "39285049-43b3-44b3-b6e9-b3d066ac07d4",
      "name": "邮箱验证器",
      "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": "外联消息",
      "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": "如果",
      "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": "邮箱存在",
      "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": "创建或更新联系人",
      "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": {
          "id": "PsbLQy9u1VGAkfVJ",
          "name": "HubSpot account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "21ee11c1-109e-4639-9be8-fb123dd32445",
      "name": "公司资料",
      "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": "运行 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_key>"
            },
            {
              "name": "Accept",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "629b2c53-1920-4cfb-943b-5754bdaab2d4",
      "name": "公共标识符",
      "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": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2320,
        128
      ],
      "parameters": {
        "width": 976,
        "height": 1296,
        "content": "# 邮件外联 + LinkedIn 连接"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "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
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

高级 - 杂项, 多模态 AI

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
高级
节点数量19
分类2
节点类型12
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

作者
Rysysth

Rysysth

@rysysth

AI systems that bring automation, intelligence, and adaptability to businesses ready to lead - not lag.

外部链接
在 n8n.io 查看

分享此工作流