8
n8n 中文网amn8n.com

潜在客户培育流失检测器

高级

这是一个Lead Nurturing领域的自动化工作流,包含 23 个节点。主要使用 If, Code, Wait, Gmail, Slack 等节点。 使用HighLevel、Gmail、Slack和Google表格的自动化销售跟进系统

前置要求
  • Google 账号和 Gmail API 凭证
  • Slack Bot Token 或 Webhook URL
  • Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "HQsEQI9dgnQXbgkF",
  "meta": {
    "instanceId": "8443f10082278c46aa5cf3acf8ff0f70061a2c58bce76efac814b16290845177",
    "templateCredsSetupCompleted": true
  },
  "name": "潜在客户培育流失检测器",
  "tags": [],
  "nodes": [
    {
      "id": "5f8b2f26-9f5d-40be-baad-51f65e9eb357",
      "name": "当点击“执行工作流”时",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -832,
        -16
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "c014b22a-fc48-4f32-94e2-72e7ce3cf3f9",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -656,
        -400
      ],
      "parameters": {
        "height": 352,
        "content": "## 节点名称:从 HighLevel 获取联系人"
      },
      "typeVersion": 1
    },
    {
      "id": "2fa119c2-8252-480e-b7b6-964e04100266",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -384,
        176
      ],
      "parameters": {
        "height": 272,
        "content": "## 节点名称:验证交易获取是否成功"
      },
      "typeVersion": 1
    },
    {
      "id": "7c00102b-0b79-498a-b8ec-e1b9f2488392",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -48,
        608
      ],
      "parameters": {
        "height": 336,
        "content": "## 节点名称:在 Google Sheets 中记录错误"
      },
      "typeVersion": 1
    },
    {
      "id": "65e796c2-8e01-4009-b900-c523a669657a",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -48,
        -400
      ],
      "parameters": {
        "height": 352,
        "content": "## 节点名称:筛选无回复的联系人"
      },
      "typeVersion": 1
    },
    {
      "id": "d1f3ba19-cfb4-4845-b628-cff0f4238c65",
      "name": "便签说明4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        224,
        144
      ],
      "parameters": {
        "height": 336,
        "content": "## 节点名称:获取最近的联系人"
      },
      "typeVersion": 1
    },
    {
      "id": "723f4c58-76e0-4cf2-ae04-88c3820e7d15",
      "name": "便签说明5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        464,
        -352
      ],
      "parameters": {
        "height": 320,
        "content": "## 节点名称:向联系人发送跟进邮件"
      },
      "typeVersion": 1
    },
    {
      "id": "8ee4227f-f4b3-4bcb-a154-cf316050baef",
      "name": "便签 6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        720,
        160
      ],
      "parameters": {
        "height": 304,
        "content": "## 节点名称:在下一次操作前等待 24 小时"
      },
      "typeVersion": 1
    },
    {
      "id": "f1211abc-1883-4c50-b75c-0a835a549ae5",
      "name": "便签 7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        912,
        -432
      ],
      "parameters": {
        "height": 368,
        "content": "## 节点名称:根据线程 ID 检索邮件线程以获取回复"
      },
      "typeVersion": 1
    },
    {
      "id": "796c98f8-270a-46e7-8f95-4b35ebce2a4d",
      "name": "## 为什么选择 4o 模型?👆",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1152,
        144
      ],
      "parameters": {
        "height": 384,
        "content": "## 节点名称:检查联系人是否回复了“是”"
      },
      "typeVersion": 1
    },
    {
      "id": "01d082d9-9575-4287-af57-ec6f7b85e5e0",
      "name": "便签 9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1456,
        304
      ],
      "parameters": {
        "height": 400,
        "content": "## 节点名称:如果无回复则在 Slack 中通知销售团队"
      },
      "typeVersion": 1
    },
    {
      "id": "b7874a2b-ce74-4492-8623-37d0689dfbf8",
      "name": "便签10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1440,
        -640
      ],
      "parameters": {
        "height": 384,
        "content": "## 节点名称:如果收到回复则在 Slack 中通知销售团队"
      },
      "typeVersion": 1
    },
    {
      "id": "9e35ac7e-8c3c-4821-bbba-a5b5fbf3f8c8",
      "name": "从 HighLevel 获取联系人",
      "type": "n8n-nodes-base.highLevel",
      "position": [
        -576,
        -16
      ],
      "parameters": {
        "filters": {},
        "options": {},
        "operation": "getAll",
        "requestOptions": {}
      },
      "credentials": {
        "highLevelOAuth2Api": {
          "id": "5QWHSi134dLIBEsC",
          "name": "HighLevel account"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "7fdab81f-d78c-4ed3-887b-d28092afde3a",
      "name": "验证交易获取成功",
      "type": "n8n-nodes-base.if",
      "position": [
        -304,
        -16
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "e2adb005-2b3c-4d1e-8445-442df1fe925a",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.id }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "8ef5a95b-518d-42e9-9cf1-d0f84232f8e0",
      "name": "在 Google Sheets 中记录错误",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        16,
        416
      ],
      "parameters": {
        "columns": {
          "value": {},
          "schema": [
            {
              "id": "error_id",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "error_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "error",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "error",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "error_id"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1338537721,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Uldk_4BxWbdZTDZxFUeohIfeBmGHHqVEl9Ogb0l6R8Y/edit#gid=1338537721",
          "cachedResultName": "error log sheet"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1Uldk_4BxWbdZTDZxFUeohIfeBmGHHqVEl9Ogb0l6R8Y",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Uldk_4BxWbdZTDZxFUeohIfeBmGHHqVEl9Ogb0l6R8Y/edit?usp=drivesdk",
          "cachedResultName": "Interviewer Brief Pack "
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "kpPEOLCGn963qpoh",
          "name": "automations@techdome.ai"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "6285af42-d462-460d-90dc-853899d8486d",
      "name": "筛选无回复的联系人",
      "type": "n8n-nodes-base.code",
      "position": [
        32,
        -16
      ],
      "parameters": {
        "jsCode": "// Get all contacts from the input\nconst contacts = $input.all().map(item => item.json);\n\n// Get the current date and time\nconst now = new Date();\n\n// Filter contacts with no response in the last 24 hours\nconst contactsWithNoResponse = contacts.filter(contact => {\n  const lastResponseTime = new Date(contact.dateUpdated);\n\n  // Calculate the time difference in hours\n  const timeDiff = now - lastResponseTime; \n  const timeDiffInHours = timeDiff / (1000 * 60 * 60);\n\n  // Check if no response in the last 24 hours\n  return timeDiffInHours >= 24; \n});\n\n// Return the filtered contacts as separate items\nreturn contactsWithNoResponse.map(contact => ({\n  json: contact\n}));"
      },
      "typeVersion": 2
    },
    {
      "id": "971be9a4-415a-4fca-8a70-ed7d528f4d72",
      "name": "获取最近的联系人",
      "type": "n8n-nodes-base.code",
      "position": [
        288,
        -16
      ],
      "parameters": {
        "jsCode": "// Get all contacts from the input\nconst contacts = $input.all().map(item => item.json);\n\n// Sort contacts by dateUpdated (most recent first)\nconst sortedContacts = contacts.sort((a, b) => {\n  return new Date(b.dateUpdated) - new Date(a.dateUpdated);\n});\n\n// Get the most recent contact\nconst mostRecentContact = sortedContacts[0];\n\n// Calculate hours ago\nconst now = new Date();\nconst lastUpdated = new Date(mostRecentContact.dateUpdated);\nconst timeDiff = now - lastUpdated;\nconst hoursAgo = Math.floor(timeDiff / (1000 * 60 * 60));\n\n// Format the output\nconst formattedOutput = `${mostRecentContact.contactName} (${mostRecentContact.email || 'no email'}) - \\`dateUpdated: \"${mostRecentContact.dateUpdated}\"\\`\n* That's ~${hoursAgo} hours ago ✅`;\n\n// Return the formatted output\nreturn [\n  {\n    json: {\n      mostRecentContact: mostRecentContact,\n      formattedOutput: formattedOutput,\n      hoursAgo: hoursAgo,\n      contactName: mostRecentContact.contactName,\n      email: mostRecentContact.email,\n      dateUpdated: mostRecentContact.dateUpdated\n    }\n  }\n];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "e70e4622-1756-4e65-a5a2-13ba657be75f",
      "name": "向联系人发送跟进邮件",
      "type": "n8n-nodes-base.gmail",
      "position": [
        544,
        -16
      ],
      "webhookId": "0c82c299-6938-42ed-bda6-5007d79af34f",
      "parameters": {
        "sendTo": "=newscctv22@gmail.com",
        "message": "=<p>Hi {{ $json.firstName || $json.contactName }},</p>\n\n<p>I hope this email finds you well!</p>\n\n<p>I wanted to follow up with you as I noticed we haven't heard back from you in the last {{ $json.hoursAgo }} hours (since {{ $json.dateUpdated }}).</p>\n\n<p>Just checking in to see if you had any questions or if there's anything I can help you with?</p>\n\n<p>Looking forward to hearing from you! Replay to \" yes \" to confirm your Availability</p>\n\n<p>Best regards,<br>\nYour Team</p>",
        "options": {},
        "subject": "=Just Checking In - {{ $json.contactName }}"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "RchiXdmY8WaQhOSJ",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "a41f8e94-b84f-45e4-a968-f3f865b0ec09",
      "name": "在下一次操作前等待 24 小时",
      "type": "n8n-nodes-base.wait",
      "position": [
        784,
        -16
      ],
      "webhookId": "7475fece-4562-46b3-a702-7a5c5fe88266",
      "parameters": {
        "amount": 42
      },
      "typeVersion": 1
    },
    {
      "id": "cfe934cb-4747-4162-a4c0-e130d013e172",
      "name": "检索邮件线程以获取回复",
      "type": "n8n-nodes-base.gmail",
      "position": [
        992,
        -16
      ],
      "webhookId": "ffb3a844-8c8b-4f17-a6e9-98e0371f4214",
      "parameters": {
        "options": {},
        "resource": "thread",
        "threadId": "={{ $json.threadId }}",
        "operation": "get"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "RchiXdmY8WaQhOSJ",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "f9c94301-54c7-40e8-b5c0-75146fa7dab1",
      "name": "检查联系人是否回复了“是”",
      "type": "n8n-nodes-base.if",
      "position": [
        1200,
        -16
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "4a6d1310-29be-4559-8bea-afe8fe0f0f30",
              "operator": {
                "type": "string",
                "operation": "contains"
              },
              "leftValue": "={{ $json.messages[1].snippet }}",
              "rightValue": "yes"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "d254c041-3f7e-4c12-9df5-7a996c97f938",
      "name": "如果无回复则在 Slack 中通知销售团队",
      "type": "n8n-nodes-base.slack",
      "position": [
        1520,
        128
      ],
      "webhookId": "ddaa7632-9e35-4bd3-82d6-572d5cae84cc",
      "parameters": {
        "text": "=⚠️ *No Response Yet - Follow-up Sent*\n\n*Contact:* {{ $json.messages[0].Subject.replace('Just Checking In - ', '') }}\n*Email:* {{ $json.messages[0].To }}\n\n*Follow-up Sent:* {{ new Date($json.messages[0].internalDate).toLocaleString() }}\n*Message:* {{ $json.messages[0].snippet }}\n\n⏳ Waiting for response... Consider next follow-up action.",
        "user": {
          "__rl": true,
          "mode": "list",
          "value": "U09HMPVD466",
          "cachedResultName": "newscctv22"
        },
        "select": "user",
        "otherOptions": {}
      },
      "credentials": {
        "slackApi": {
          "id": "rNqvWj9TfChPVRYY",
          "name": "Slack account vivek"
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "a1659ee2-859a-4540-9470-3d0b5a464dbe",
      "name": "如果收到回复则在 Slack 中通知销售团队",
      "type": "n8n-nodes-base.slack",
      "position": [
        1520,
        -224
      ],
      "webhookId": "ddaa7632-9e35-4bd3-82d6-572d5cae84cc",
      "parameters": {
        "text": "=🎉 *Great News! We Got a Response!*\n\n*Contact:* {{ $json.messages[0].Subject.replace('Just Checking In - ', '') }}\n*Email:* {{ $json.messages[0].To }}\n\n*Their Response:*\n> {{ $json.messages[1].snippet }}\n✅ Follow-up was successful! Time to take next action.",
        "user": {
          "__rl": true,
          "mode": "list",
          "value": "U09HMPVD466",
          "cachedResultName": "newscctv22"
        },
        "select": "user",
        "otherOptions": {}
      },
      "credentials": {
        "slackApi": {
          "id": "rNqvWj9TfChPVRYY",
          "name": "Slack account vivek"
        }
      },
      "typeVersion": 2.3
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "6b99bb1c-a693-4c09-abd4-9bd98bb6cb3e",
  "connections": {
    "Get Most Recent Contact": {
      "main": [
        [
          {
            "node": "Send Follow-Up Email to Contact",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validate Deal Fetch Success": {
      "main": [
        [
          {
            "node": "Filter Contacts with No Response",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Log Errors in Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Contacts from HighLevel": {
      "main": [
        [
          {
            "node": "Validate Deal Fetch Success",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Follow-Up Email to Contact": {
      "main": [
        [
          {
            "node": "Wait for 24 Hours Before Next Action",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Contacts with No Response": {
      "main": [
        [
          {
            "node": "Get Most Recent Contact",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Retrieve Email Thread for Response": {
      "main": [
        [
          {
            "node": "Check If Contact Responded with 'Yes'",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait for 24 Hours Before Next Action": {
      "main": [
        [
          {
            "node": "Retrieve Email Thread for Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Fetch Contacts from HighLevel",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check If Contact Responded with 'Yes'": {
      "main": [
        [
          {
            "node": "Notify Sales Team in Slack if Response Received",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Notify Sales Team in Slack if No Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 客户培育

需要付费吗?

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

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

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

作者
Rahul Joshi

Rahul Joshi

@rahul08

Rahul Joshi is a seasoned technology leader specializing in the n8n automation tool and AI-driven workflow automation. With deep expertise in building open-source workflow automation and self-hosted automation platforms, he helps organizations eliminate manual processes through intelligent n8n ai agent automation solutions.

外部链接
在 n8n.io 查看

分享此工作流