8
n8n 中文网amn8n.com

基于AI的潜在客户评分与个性化回复(JotForm、GPT和Gmail)

中级

这是一个Lead Nurturing, AI Summarization领域的自动化工作流,包含 15 个节点。主要使用 Code, Gmail, HttpRequest, GoogleSheets, JotFormTrigger 等节点。 基于AI的潜在客户评分与个性化回复:使用JotForm、GPT和Gmail

前置要求
  • Google 账号和 Gmail API 凭证
  • 可能需要目标 API 的认证凭证
  • Google Sheets API 凭证
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "8d41476c63702cd0f2be55363b48153c5d4820bb18197ca147e7be50ef236112",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "372728ab-7a20-4a2d-bbf0-76f8fed19211",
      "name": "触发器:JotForm提交",
      "type": "n8n-nodes-base.jotFormTrigger",
      "position": [
        -560,
        -224
      ],
      "webhookId": "6e8cdedd-cdc4-4a69-8cbf-e8bc6be40dc7",
      "parameters": {
        "form": "252826674643466"
      },
      "credentials": {
        "jotFormApi": {
          "id": "ZQzE9kLfYcfbpT81",
          "name": "[Naveen]JotForm account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "d5eb227f-dfcd-457e-865b-925636a309ba",
      "name": "AI:潜在客户评分分析",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        -336,
        -224
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-nano",
          "cachedResultName": "GPT-4.1-NANO"
        },
        "options": {
          "temperature": 0.2
        },
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "You are an expert lead scoring assistant for a digital marketing agency. Your task is to analyze incoming lead data and assign a score.\nBased on the provided information, you must output a JSON object with the following keys:\n- \"score\": a number from 1 to 100 (100 being the best).\n- \"tier\": a string with the value \"high\", \"medium\", or \"low\".\n- \"reasoning\": a brief, one-sentence explanation for the score.\n\nScoring Criteria:\n- High Score (80-100): Clear project need, matches our services, high budget ($25k+), works at a known company.\n- Medium Score (40-79): Vague project, medium budget ($10k-$25k), or unknown company.\n- Low Score (1-39): Incomplete form, low budget (<$10k), or doesn't seem like a good fit."
            },
            {
              "content": "=Analyze this new lead submission:\nFull Name: {{ $json['Full Name'].values().join(' ') }}\nEmail: {{ $json['E-mail'] }}\nCompany: {{ $json.Company }}\nMessage: {{ $json.Message }}\nBudget: {{ $json['Estimated Budget'] }}"
            }
          ]
        }
      },
      "credentials": {
        "openAiApi": {
          "id": "2FqzrBEciWnWPmSG",
          "name": "iRocket OpenAi account"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "8d04bdae-caf6-42f8-936d-636a39ab007d",
      "name": "处理:提取和合并数据",
      "type": "n8n-nodes-base.code",
      "position": [
        16,
        -224
      ],
      "parameters": {
        "jsCode": "// The entire input item from the previous node (OpenAI)\nconst item = $input.first();\n\n// The original lead data from the Jotform trigger (passed through by the OpenAI node)\nconst leadData = item.json;\n\n// The AI's response string, which we need to parse\nconst aiResponseString = item.json.message.content;\n\nlet aiData;\ntry {\n  // Parse the string into a JSON object\n  aiData = JSON.parse(aiResponseString);\n} catch (error) {\n  // If parsing fails, set default values\n  aiData = { score: 0, tier: 'low', reasoning: 'Failed to parse AI response.' };\n}\n\n// Merge the original lead data with the new, parsed AI data\nconst mergedData = {\n  ...leadData,\n  aiScore: aiData.score,\n  aiTier: aiData.tier,\n  aiReasoning: aiData.reasoning\n};\n\n// Return the new, clean data structure\nreturn [{ json: mergedData }];"
      },
      "typeVersion": 2
    },
    {
      "id": "9510e135-6881-46ea-99ab-861e63b03b2c",
      "name": "表格:创建潜在客户记录",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        240,
        -224
      ],
      "parameters": {
        "columns": {
          "value": {
            "email": "={{ $('Trigger: JotForm Submission').item.json['E-mail'] }}",
            "ai_tier": "={{ $json.aiTier }}",
            "company": "={{ $('Trigger: JotForm Submission').item.json.Company }}",
            "message": "={{ $('Trigger: JotForm Submission').item.json.Message }}",
            "ai_score": "={{ $json.aiScore }}",
            "last_name": "={{ $('Trigger: JotForm Submission').item.json['Full Name'].last }}",
            "first_name": "={{ $('Trigger: JotForm Submission').item.json['Full Name'].first }}",
            "ai_reasoning": "={{ $json.aiReasoning }}",
            "estimated_budget": "={{ $('Trigger: JotForm Submission').item.json['Estimated Budget'] }}"
          },
          "schema": [
            {
              "id": "first_name",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "first_name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "last_name",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "last_name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "company",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "company",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "email",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "message",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "message",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "estimated_budget",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "estimated_budget",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "ai_score",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "ai_score",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "ai_tier",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "ai_tier",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "ai_reasoning",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "ai_reasoning",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1HeD3mMYKT0PMkhEQ7uq-mCZE50mwWpIYvOhEkhTeNdA/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1HeD3mMYKT0PMkhEQ7uq-mCZE50mwWpIYvOhEkhTeNdA",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1HeD3mMYKT0PMkhEQ7uq-mCZE50mwWpIYvOhEkhTeNdA/edit?usp=drivesdk",
          "cachedResultName": "AI Lead Scoring"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "V4NHfo08zBK4IW4e",
          "name": "[Naveen]Google Sheets account"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "5f21398e-568b-417d-b7d1-f6d080ec89f1",
      "name": "API:公司信息丰富请求",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        464,
        -224
      ],
      "parameters": {
        "url": "https://n8n.nickautomations.com/webhook/enrich",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "domain",
              "value": "={{ $json.email.split('@')[1] }}"
            }
          ]
        },
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "wY2hC21TwfphZKzu",
          "name": "[company-enrich-api]Header Auth account"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "8e7d85b2-269b-4ee8-bab7-c9a6596ac662",
      "name": "AI:生成个性化邮件",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        688,
        -224
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-nano",
          "cachedResultName": "GPT-4.1-NANO"
        },
        "options": {
          "temperature": 0.7
        },
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "You are an expert Business Development Representative for \"Innovate Digital,\" a top-tier digital marketing agency. Your writing style is professional, concise, and friendly.\n\nYour task is to write a personalized follow-up email to a new lead who has submitted an inquiry on our website.\n\nInstructions:\n1.  Start with a friendly greeting using the lead's first name.\n2.  Acknowledge their submission and mention their company name.\n3.  Reference their specific project need from their message.\n4.  Subtly mention something you learned from their company data (e.g., their industry, a technology they use, or their company size) to show you've done your homework.\n5.  Based on their AI score tier (\"high\", \"medium\", \"low\"), adjust the tone and call-to-action:\n    - **High Tier:** Express strong enthusiasm and suggest a direct call with a senior strategist. Mention their project is a \"high priority.\"\n    - **Medium Tier:** Be encouraging and suggest a brief discovery call to explore fit. Frame it as a \"consultation.\"\n    - **Low Tier:** Be polite and helpful. Direct them to a resource (like a blog post or case study) and mention you'll keep them in mind for future opportunities. Do not push for a meeting.\n6.  End with a clear call to action and a professional sign-off from \"The Innovate Digital Team.\"\n7.  **Crucially, only output the raw HTML body of the email. Do not include a subject line, greeting, or sign-off in the final output, as those will be handled separately. Use <p> tags for paragraphs.**"
            },
            {
              "content": "=Lead Information:\n- Full Name: {{ $('Sheets: Create Lead Record').item.json.first_name }} {{ $('Sheets: Create Lead Record').item.json.last_name }}\n- Email: {{ $('Sheets: Create Lead Record').item.json.email }}\n- Company: {{ $('Sheets: Create Lead Record').item.json.company }}\n- Original Message: {{ $('Sheets: Create Lead Record').item.json.message }}\n- Budget: {{ $('Sheets: Create Lead Record').item.json.estimated_budget }}\n- AI Score Tier: {{ $('Sheets: Create Lead Record').item.json.ai_tier }}\n\nEnriched Company Data:\n- Industry: {{ $json.industry }}\n- Employee Count: {{ $json.employeeCount }}\n- Technologies Used: {{ $json.techStack.join(', ') }}\n- Location: {{ $json.headquarters }}"
            }
          ]
        }
      },
      "credentials": {
        "openAiApi": {
          "id": "2FqzrBEciWnWPmSG",
          "name": "iRocket OpenAi account"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "fabd8eab-9fc2-4f24-bceb-ddcc5787e7a2",
      "name": "邮件:发送潜在客户回复",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1040,
        -224
      ],
      "webhookId": "fd751397-0d5e-49d2-ac2e-281f68514d16",
      "parameters": {
        "sendTo": "={{ $('Sheets: Create Lead Record').item.json.email }}",
        "message": "={{ $json.message.content }}",
        "options": {
          "appendAttribution": false
        },
        "subject": "=Re: Your inquiry from {{ $('Sheets: Create Lead Record').item.json.company }}"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "Wk6NbtIq585tte9D",
          "name": "Naveen Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "0f6949a3-0765-42f7-b86b-4e382fc0c44b",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -96,
        -1248
      ],
      "parameters": {
        "width": 944,
        "height": 544,
        "content": "# 🤖 AI驱动的潜在客户评分与个性化触达"
      },
      "typeVersion": 1
    },
    {
      "id": "46a86749-55d7-48fa-a334-26425ffca5e2",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1136,
        -320
      ],
      "parameters": {
        "color": 7,
        "width": 528,
        "height": 368,
        "content": "## 1️⃣ JotForm触发器设置"
      },
      "typeVersion": 1
    },
    {
      "id": "35fe5e10-f6b8-4bac-91dc-600cd92531ba",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -464,
        -640
      ],
      "parameters": {
        "color": 7,
        "width": 480,
        "height": 352,
        "content": "## 2️⃣ AI潜在客户评分"
      },
      "typeVersion": 1
    },
    {
      "id": "c2ed72d5-d26e-4958-8d22-fb33f9580b09",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -176,
        16
      ],
      "parameters": {
        "color": 7,
        "width": 448,
        "height": 288,
        "content": "## 3️⃣ 提取和合并数据"
      },
      "typeVersion": 1
    },
    {
      "id": "31a8b91f-7377-43a6-bfba-79b11bd0bed3",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        80,
        -640
      ],
      "parameters": {
        "color": 7,
        "width": 480,
        "height": 352,
        "content": "## 4️⃣ Google Sheets记录"
      },
      "typeVersion": 1
    },
    {
      "id": "bb3067c1-cb27-4eb5-99c9-f81f700225b6",
      "name": "便签5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        352,
        16
      ],
      "parameters": {
        "color": 7,
        "width": 512,
        "height": 304,
        "content": "## 5️⃣ 公司信息丰富API"
      },
      "typeVersion": 1
    },
    {
      "id": "b7b0fea7-5298-4b5f-8657-1689e0d5e9d4",
      "name": "便签6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        640,
        -640
      ],
      "parameters": {
        "color": 7,
        "width": 512,
        "height": 352,
        "content": "## 6️⃣ 个性化邮件AI"
      },
      "typeVersion": 1
    },
    {
      "id": "e9462407-a72b-4673-98f6-02c9576ef21b",
      "name": "便签7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1264,
        -256
      ],
      "parameters": {
        "color": 7,
        "width": 432,
        "height": 288,
        "content": "## 7️⃣ 发送邮件回复"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "AI: Lead Scoring Analysis": {
      "main": [
        [
          {
            "node": "Process: Extract & Merge Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sheets: Create Lead Record": {
      "main": [
        [
          {
            "node": "API: Company Enrichment Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Trigger: JotForm Submission": {
      "main": [
        [
          {
            "node": "AI: Lead Scoring Analysis",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Process: Extract & Merge Data": {
      "main": [
        [
          {
            "node": "Sheets: Create Lead Record",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI: Generate Personalized Email": {
      "main": [
        [
          {
            "node": "Email: Send Lead Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "API: Company Enrichment Request": {
      "main": [
        [
          {
            "node": "AI: Generate Personalized Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 客户培育, AI 摘要总结

需要付费吗?

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

工作流信息
难度等级
中级
节点数量15
分类2
节点类型7
难度说明

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

作者
Naveen Choudhary

Naveen Choudhary

@n8nstein

I create AI-driven n8n workflows that turn repetitive tasks into smooth, hands-off automations. Want to explore an idea? Book a quick consult: https://cal.com/nickchoudhary/30min

外部链接
在 n8n.io 查看

分享此工作流