8
n8n 中文网amn8n.com

基于客户邮件的个性化外展

高级

这是一个CRM, AI Summarization领域的自动化工作流,包含 17 个节点。主要使用 Set, Gmail, Hubspot, ManualTrigger, SplitInBatches 等节点。 基于客户邮件的个性化外展

前置要求
  • Google 账号和 Gmail API 凭证
  • HubSpot API Key
  • Google Gemini API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "09423a3357ff64bdcc082268b9d577001317edbe377a3ccfb0b131ffb9554b30"
  },
  "nodes": [
    {
      "id": "d8dab6ac-acfe-452f-921d-55d27060ed6a",
      "name": "当点击\"测试工作流\"时",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        192,
        464
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "018a8972-546c-43cc-986a-b72fa9d0d4d9",
      "name": "变量",
      "type": "n8n-nodes-base.set",
      "position": [
        1248,
        480
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "a6c47778-33f4-46a3-a86a-fd1e75930d93",
              "name": "firstname",
              "type": "string",
              "value": "={{ $json.properties.firstname }}"
            },
            {
              "id": "0e50b2bc-4bea-4fd0-95c0-46a87da69c19",
              "name": "lastname",
              "type": "string",
              "value": "={{ $json.properties.lastname }}"
            },
            {
              "id": "ee15f298-77f6-4c4a-b03b-c2cf9a53bdc2",
              "name": "email",
              "type": "string",
              "value": "={{ $json.properties.email }}"
            },
            {
              "id": "98a718f5-4372-4282-8a9a-46f2af39677a",
              "name": "product_to_sell",
              "type": "string",
              "value": "=AI partnerships: a consulting package of AI development and services. We help customers find a strong foothold on AI initiatives bringing them to life cost effectively and always with results."
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "b6cb19c3-db32-4c56-8a61-8eac39c7cae0",
      "name": "Google Gemini聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        1888,
        640
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemini-2.0-flash"
      },
      "credentials": {
        "googlePalmApi": {
          "id": "KYY7pVULIl0PdDp3",
          "name": "Google Gemini(PaLM) Api account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "5b325d06-e4e9-4a50-a260-ce733d57f007",
      "name": "Google Gemini聊天模型1",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        2496,
        640
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemini-2.0-flash"
      },
      "typeVersion": 1
    },
    {
      "id": "22c3f6bb-9344-4319-9eeb-4b2d3232aee3",
      "name": "创建待审核邮件草稿",
      "type": "n8n-nodes-base.gmail",
      "position": [
        3056,
        624
      ],
      "webhookId": "8b3d78e5-8cea-4205-a9db-c66ec01f9558",
      "parameters": {
        "message": "={{ $json.output.body }}",
        "options": {
          "sendTo": "={{ $('Variables').first().json.email }}"
        },
        "subject": "={{ $json.output.subject }}",
        "resource": "draft",
        "emailType": "html"
      },
      "typeVersion": 2.1
    },
    {
      "id": "a692062b-c142-47de-997e-10ae6c5420ee",
      "name": "生成销售邮件",
      "type": "@n8n/n8n-nodes-langchain.informationExtractor",
      "position": [
        2416,
        480
      ],
      "parameters": {
        "text": "=# Profile of {{ $('Variables').first().json.firstname }} {{ $('Variables').first().json.lastname }}\n{{ Object.keys($json.output).map(key => `## ${key}\\n${$json.output[key]}`).join('\\n') }}",
        "options": {
          "systemPromptTemplate": "=You are a sales representative drafting an email to close a potential customer on the following product: <product>{{ $('Variables').first().json.product_to_sell }}</product>\n\nUse the provided profile to draft the a suitable email which reflects similar communication style and addresses their values, ultimately convinces the customer to inquire about and/or buy this product. Provide only the subject and body of the message as this text will go into a template. Omit the subject and signature."
        },
        "attributes": {
          "attributes": [
            {
              "name": "subject",
              "required": true,
              "description": "the subject of the message"
            },
            {
              "name": "body",
              "required": true,
              "description": "the body of the message with html styling"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "3dc19bf4-167e-46fe-b483-53e752fe0ad2",
      "name": "分析并构建用户画像",
      "type": "@n8n/n8n-nodes-langchain.informationExtractor",
      "position": [
        1808,
        480
      ],
      "parameters": {
        "text": "={{\n$input.all()\n  .map(item => `subject: ${item.json.subject}\ndate: ${$json.headers.date}\nmessage: ${item.json.text.substr(0, item.json.text.indexOf('> wrote:') ?? item.json.text.length).replace(/^On[\\w\\W]+$/im, '')}`\n  ).join('\\n---\\n')\n}}",
        "options": {
          "systemPromptTemplate": "=Your task is to build a persona of a customer or potential customer so that we may better serve them for our business. Analyse the recent correspondence of the user, {{ $('Variables').item.json.email }}, and extract the required attributes."
        },
        "attributes": {
          "attributes": [
            {
              "name": "decision_making_style",
              "required": true,
              "description": "=Analytical vs. Intuitive: Do they rely on data or gut feelings?\n\nRisk Appetite: Conservative, calculated risk-taker, or bold?\n\nSpeed of Decision-Making: Quick and assertive or deliberate and methodical?"
            },
            {
              "name": " communication_preferences",
              "required": true,
              "description": "=Preferred Medium: Email, phone calls, in-person meetings, messaging apps?\n\nDetail Orientation: High-level summaries or deep-dive explanations?\n\nTone & Formality: Casual vs. professional, direct vs. diplomatic?"
            },
            {
              "name": "pain_points_challenges",
              "required": true,
              "description": "=Current Business Challenges: What problems are they actively trying to solve?\n\nIndustry Pressures: Competitive landscape, economic concerns, regulatory issues?\n\nOperational Bottlenecks: Efficiency, team structure, technology gaps?"
            },
            {
              "name": "professional_goals_motivations",
              "required": true,
              "description": "=Personal Career Goals: Promotion, recognition, financial growth, legacy-building?\n\nBusiness Priorities: Revenue growth, innovation, market expansion, cost reduction?\n\nKey Performance Indicators (KPIs): How do they measure success?"
            },
            {
              "name": "work_style_preferences",
              "required": true,
              "description": "=Collaboration vs. Independence: Do they prefer teamwork or autonomy?\n\nLevel of Involvement: Hands-on or delegate-and-review?\n\nResponse Time Expectation: Do they expect immediate follow-ups or are they flexible?"
            },
            {
              "name": "personality_behavioral_traits",
              "required": true,
              "description": "=Big Five Traits: Are they open to new ideas, structured, agreeable, extroverted?\n\nConflict Resolution Style: Do they avoid, confront, or negotiate?\n\nTrust-Building Factors: Do they value reliability, transparency, exclusivity?"
            },
            {
              "name": " buying_investment_behavior",
              "required": true,
              "description": "=Budget Sensitivity: Price-conscious or value-focused?\n\nBrand Loyalty vs. Openness: Do they stick with familiar providers or explore new options?\n\nDecision Influencers: Do they rely on peers, market research, gut instinct?"
            },
            {
              "name": "preferred_business_culture_ethics",
              "required": true,
              "description": "=Formality vs. Informality: Corporate structure vs. entrepreneurial mindset?\n\nCore Values: Integrity, innovation, customer-first, sustainability?\n\nCultural Sensitivity: Are there cultural nuances to be aware of in their decision-making?"
            },
            {
              "name": "industry_competitive_awareness",
              "required": true,
              "description": "=Market Trends Interest: Do they actively track industry shifts?\n\nCompetitor Awareness: Are they reactive to competitors, or focused on internal growth?\n\nTech Adoption: Do they embrace innovation, or are they slow adopters?"
            }
          ]
        }
      },
      "executeOnce": true,
      "typeVersion": 1
    },
    {
      "id": "d1a1b59f-b746-40ef-846f-c596564a2538",
      "name": "获取所有客户往来邮件",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1456,
        480
      ],
      "webhookId": "4d8c4b7a-da0b-49aa-bda8-7b1d89c62636",
      "parameters": {
        "limit": 20,
        "simple": false,
        "filters": {
          "q": "=from:{{ $json.email }}"
        },
        "options": {},
        "operation": "getAll"
      },
      "typeVersion": 2.1
    },
    {
      "id": "e091dea6-9880-48fd-a7ca-7b4fadce66ce",
      "name": "获取联系人",
      "type": "n8n-nodes-base.hubspot",
      "position": [
        560,
        464
      ],
      "parameters": {
        "operation": "search",
        "authentication": "oAuth2",
        "filterGroupsUi": {
          "filterGroupsValues": [
            {
              "filtersUi": {
                "filterValues": [
                  {
                    "value": "DECISION_MAKER",
                    "propertyName": "hs_buying_role|enumeration"
                  }
                ]
              }
            }
          ]
        },
        "additionalFields": {}
      },
      "credentials": {
        "hubspotOAuth2Api": {
          "id": "Vxqd8oQJmbtNmpRz",
          "name": "HubSpot account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "6aae27da-13ce-4535-9e80-b7ff190595ee",
      "name": "遍历每个联系人",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        752,
        464
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "5eb22f9c-dfae-495f-9bf4-027f92670bc5",
      "name": "联系人参考",
      "type": "n8n-nodes-base.noOp",
      "position": [
        960,
        480
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "75f939f6-954a-413f-93ed-267ade013491",
      "name": "便签5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        496,
        336
      ],
      "parameters": {
        "color": 7,
        "width": 640,
        "height": 372,
        "content": "## 1. 在 Hubspot 中选择目标客户"
      },
      "typeVersion": 1
    },
    {
      "id": "c8c9b8c7-1c38-4142-b2fa-d5f0e69e2a5e",
      "name": "便签6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1152,
        336
      ],
      "parameters": {
        "color": 7,
        "width": 520,
        "height": 372,
        "content": "## 2. 获取历史邮件会话"
      },
      "typeVersion": 1
    },
    {
      "id": "d5f35beb-ac07-4f6e-96ed-ce9395e38aee",
      "name": "便签7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1696,
        272
      ],
      "parameters": {
        "color": 7,
        "width": 540,
        "height": 524,
        "content": "## 3. 基于邮件构建用户画像"
      },
      "typeVersion": 1
    },
    {
      "id": "12677fce-489c-4e08-b7fc-558533542de6",
      "name": "便签8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2256,
        272
      ],
      "parameters": {
        "color": 7,
        "width": 560,
        "height": 524,
        "content": "## 4. 使用用户画像撰写销售邮件"
      },
      "typeVersion": 1
    },
    {
      "id": "c20148a9-b8f6-4e24-9522-1df4e72842b2",
      "name": "便签9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2848,
        416
      ],
      "parameters": {
        "color": 7,
        "width": 480,
        "height": 376,
        "content": "## 5. 在 Gmail 中创建草稿"
      },
      "typeVersion": 1
    },
    {
      "id": "d77dac1f-5f9c-45de-b4f3-3a0c076c67b6",
      "name": "便签10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        -16
      ],
      "parameters": {
        "color": 5,
        "width": 480,
        "height": 712,
        "content": "## 本工作流功能"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "Variables": {
      "main": [
        [
          {
            "node": "Get All Customer's Correspondence",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Contact Ref": {
      "main": [
        [
          {
            "node": "Variables",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Contacts": {
      "main": [
        [
          {
            "node": "For Each Contact",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "For Each Contact": {
      "main": [
        [],
        [
          {
            "node": "Contact Ref",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Sales Email": {
      "main": [
        [
          {
            "node": "Create Draft Email For Review",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Analyse and Build Persona",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Analyse and Build Persona": {
      "main": [
        [
          {
            "node": "Generate Sales Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Generate Sales Email",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Create Draft Email For Review": {
      "main": [
        [
          {
            "node": "For Each Contact",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get All Customer's Correspondence": {
      "main": [
        [
          {
            "node": "Analyse and Build Persona",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Test workflow’": {
      "main": [
        [
          {
            "node": "Get Contacts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 客户关系管理, AI 摘要总结

需要付费吗?

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

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

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

作者
Miha

Miha

@miha

Template Engineer @ n8n

外部链接
在 n8n.io 查看

分享此工作流