8
n8n 中文网amn8n.com

22 监控流失指标

高级

这是一个CRM, AI Summarization领域的自动化工作流,包含 20 个节点。主要使用 If, Set, Code, Gmail, McpClientTool 等节点。 使用Bright Data MCP和OpenAI监控客户流失指标

前置要求
  • Google 账号和 Gmail API 凭证
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "JC8NHUFMRr3Ss4U1",
  "meta": {
    "instanceId": "60046904b104f0f72b2629a9d88fe9f676be4035769f1f08dad1dd38a76b9480",
    "templateCredsSetupCompleted": true
  },
  "name": "22 监控流失指标",
  "tags": [],
  "nodes": [
    {
      "id": "25d6648a-74f7-46eb-afb9-d2e305373165",
      "name": "OpenAI 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        380,
        280
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "8sEyPDkC5p4w4Jha",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "42614abe-c0a6-4149-b0cc-96dbe6cade08",
      "name": "每日检查触发器",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -60,
        0
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 9
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "f2f3dcdf-00d8-46ac-951a-4c1a7c964068",
      "name": "设置管理仪表板 URL",
      "type": "n8n-nodes-base.set",
      "position": [
        140,
        0
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "c07e5c58-b422-4384-85a5-a8049080f8f9",
              "name": "database",
              "type": "string",
              "value": "https://docs.google.com/spreadsheets/d/1SuilmbqeTypIigl3PGeJYzsQt8pKNjil/edit?gid=1026450716#gid=1026450716"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "2f224d5a-e0c7-4651-80de-b298e4cf5f5a",
      "name": "抓取用户数据 (AI Agent)",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        440,
        0
      ],
      "parameters": {
        "text": "=scrape the database URL below and extract the data.\nURL: {{ $json.database }}",
        "options": {},
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2
    },
    {
      "id": "c9eab14a-dd60-4a99-aa61-5a42fb9f7a72",
      "name": "Bright Data MCP 客户端",
      "type": "n8n-nodes-mcp.mcpClientTool",
      "position": [
        580,
        280
      ],
      "parameters": {
        "toolName": "scrape_as_markdown",
        "operation": "executeTool",
        "toolParameters": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Tool_Parameters', ``, 'json') }}"
      },
      "credentials": {
        "mcpClientApi": {
          "id": "eqq94k789oJCd6jU",
          "name": "MCP Client (STDIO) account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "ea714fc5-b2cc-44dd-821e-2beaa818937e",
      "name": "格式化用户登录数据",
      "type": "n8n-nodes-base.code",
      "position": [
        780,
        0
      ],
      "parameters": {
        "jsCode": "// 1️⃣ Get the input array from the agent response\nconst users = items[0].json.output;\n\n// 2️⃣ Map each user to an individual n8n item\nconst output = users.map(user => {\n  return {\n    json: {\n      name: user.name,\n      email: user.email,\n      last_login: user.last_login,\n      plan: user.plan\n    }\n  };\n});\n\n// 3️⃣ Return the output array with each user as separate item\nreturn output;\n"
      },
      "typeVersion": 2
    },
    {
      "id": "598f0e1b-e8d7-47c6-ba60-d390151359f1",
      "name": "将日期转换为距上次登录天数",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        960,
        0
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "GPT-4O-MINI"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "=I will provide you with a last login date in YYYY-MM-DD format.\n\nPlease calculate the number of days between that date and today, and respond only with:\n\n<number_of_days>\n\nFor example, if the last login date is 2024-06-01, and today is 2024-07-01, then reply:\n\n30\n\nHere is the last login date: {{ $json.last_login }}\n"
            }
          ]
        }
      },
      "credentials": {
        "openAiApi": {
          "id": "8sEyPDkC5p4w4Jha",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "6ace5da5-be7e-4b65-9b03-87460b040dd5",
      "name": "将天数转换为整数",
      "type": "n8n-nodes-base.set",
      "position": [
        1280,
        0
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "45b3fe33-21b3-4ece-ac05-e9bd693ae035",
              "name": "message.content",
              "type": "number",
              "value": "={{ $json.message.content }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "7cd275d8-32e8-4b66-8b3b-4b9fbaff6f7c",
      "name": "检查非活跃阈值 (>=30 天)",
      "type": "n8n-nodes-base.if",
      "position": [
        1680,
        0
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "a52ad37c-cc43-44a0-8018-9f7ef657a974",
              "operator": {
                "type": "number",
                "operation": "gte"
              },
              "leftValue": "={{ $json.message.content }}",
              "rightValue": 30
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "d960ebcd-7571-4bad-9940-a89cd5b96b94",
      "name": "发送重新参与邮件",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1920,
        -140
      ],
      "webhookId": "d1e41033-adf9-41d0-a47a-97448c74347b",
      "parameters": {
        "sendTo": "={{ $('Format User Login Data').item.json.email }}",
        "message": "=We are missing you.\n\nYou haven't visited our application from a while. So we just wanted to reach out in case there is some problems.\n\nWe would like you to come back.\n\nKind regards,\nTeam [company name]",
        "options": {},
        "subject": "We are missing you, we have an offer for you",
        "emailType": "text"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "AQDSl75AdzK3vmqJ",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "88a609e0-e60b-47d5-9da8-28302a4e3a4d",
      "name": "不执行任何操作 (用户活跃)",
      "type": "n8n-nodes-base.noOp",
      "position": [
        1920,
        140
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "66cc00e8-e9c9-454f-b600-ecc771e57ca3",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -80,
        -680
      ],
      "parameters": {
        "color": 6,
        "width": 360,
        "height": 860,
        "content": "## 🧩 **第一部分:触发器与仪表板输入**"
      },
      "typeVersion": 1
    },
    {
      "id": "9d74403a-fd7d-41c1-b866-91ff1fdc0fa2",
      "name": "便签 1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        400,
        -720
      ],
      "parameters": {
        "color": 3,
        "width": 1040,
        "height": 900,
        "content": "## 🤖 **第二部分:AI 驱动的抓取与日期转换**"
      },
      "typeVersion": 1
    },
    {
      "id": "ba433321-f29a-4f05-beb0-7a2943c7e362",
      "name": "便签 2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1640,
        -540
      ],
      "parameters": {
        "color": 5,
        "width": 400,
        "height": 860,
        "content": "## ✉️ **第三部分:智能通知逻辑**"
      },
      "typeVersion": 1
    },
    {
      "id": "4422fbed-c696-4511-80ef-4a6eca6c9f64",
      "name": "便签 5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2180,
        -540
      ],
      "parameters": {
        "color": 7,
        "width": 380,
        "height": 240,
        "content": "## 如果您通过此链接加入 Bright Data,我将获得一小笔佣金 — 感谢您支持更多免费内容!"
      },
      "typeVersion": 1
    },
    {
      "id": "07a48184-3a1b-4756-8d79-b552df19a45d",
      "name": "便签9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1740,
        -640
      ],
      "parameters": {
        "color": 4,
        "width": 1300,
        "height": 320,
        "content": "======================================="
      },
      "typeVersion": 1
    },
    {
      "id": "07f592f8-0aac-4817-9c6f-5c62325b794b",
      "name": "便签 4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1740,
        -300
      ],
      "parameters": {
        "color": 4,
        "width": 1289,
        "height": 2278,
        "content": "# ✅ **工作流标题:非活跃用户检测与重新参与邮件自动化**"
      },
      "typeVersion": 1
    },
    {
      "id": "b943feef-921c-4958-a656-b64ef489822b",
      "name": "自动修复输出解析器",
      "type": "@n8n/n8n-nodes-langchain.outputParserAutofixing",
      "position": [
        740,
        280
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "7026ca7f-f4d3-4d15-920a-ce84a3da578d",
      "name": "OpenAI 聊天模型1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        720,
        500
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "8sEyPDkC5p4w4Jha",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "c4772d37-4e51-48e2-b8aa-2b47f1b25503",
      "name": "结构化输出解析器",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        880,
        500
      ],
      "parameters": {
        "jsonSchemaExample": "[\n  {\n    \"name\": \"User 1\",\n    \"email\": \"user1@example.com\",\n    \"last_login\": \"2024-06-01\",\n    \"plan\": \"Pro\"\n  },\n  {\n    \"name\": \"User 2\",\n    \"email\": \"user2@example.com\",\n    \"last_login\": \"2024-05-20\",\n    \"plan\": \"Free\"\n  },\n  {\n    \"name\": \"User 3\",\n    \"email\": \"user3@example.com\",\n    \"last_login\": \"2024-04-15\",\n    \"plan\": \"Enterprise\"\n  },\n  {\n    \"name\": \"User 4\",\n    \"email\": \"user4@example.com\",\n    \"last_login\": \"2024-07-01\",\n    \"plan\": \"Pro\"\n  },\n  {\n    \"name\": \"User 5\",\n    \"email\": \"user5@example.com\",\n    \"last_login\": \"2024-03-25\",\n    \"plan\": \"Free\"\n  },\n  {\n    \"name\": \"User 6\",\n    \"email\": \"user6@example.com\",\n    \"last_login\": \"2024-05-10\",\n    \"plan\": \"Enterprise\"\n  },\n  {\n    \"name\": \"User 7\",\n    \"email\": \"user7@example.com\",\n    \"last_login\": \"2024-06-20\",\n    \"plan\": \"Pro\"\n  },\n  {\n    \"name\": \"User 8\",\n    \"email\": \"user8@example.com\",\n    \"last_login\": \"2024-04-05\",\n    \"plan\": \"Free\"\n  },\n  {\n    \"name\": \"User 9\",\n    \"email\": \"user9@example.com\",\n    \"last_login\": \"2024-05-30\",\n    \"plan\": \"Enterprise\"\n  },\n  {\n    \"name\": \"User 10\",\n    \"email\": \"user10@example.com\",\n    \"last_login\": \"2024-03-15\",\n    \"plan\": \"Pro\"\n  }\n]\n"
      },
      "typeVersion": 1.2
    }
  ],
  "active": false,
  "pinData": {
    "Scrape User Data (AI Agent)": [
      {
        "json": {
          "output": [
            {
              "name": "User 1",
              "plan": "Pro",
              "email": "user1@example.com",
              "last_login": "2024-06-01"
            },
            {
              "name": "User 2",
              "plan": "Free",
              "email": "user2@example.com",
              "last_login": "2024-05-20"
            },
            {
              "name": "User 3",
              "plan": "Enterprise",
              "email": "user3@example.com",
              "last_login": "2024-04-15"
            },
            {
              "name": "User 4",
              "plan": "Pro",
              "email": "user4@example.com",
              "last_login": "2024-07-01"
            },
            {
              "name": "User 5",
              "plan": "Free",
              "email": "user5@example.com",
              "last_login": "2024-03-25"
            },
            {
              "name": "User 6",
              "plan": "Enterprise",
              "email": "user6@example.com",
              "last_login": "2024-05-10"
            },
            {
              "name": "User 7",
              "plan": "Pro",
              "email": "user7@example.com",
              "last_login": "2024-06-20"
            },
            {
              "name": "User 8",
              "plan": "Free",
              "email": "user8@example.com",
              "last_login": "2024-04-05"
            },
            {
              "name": "User 9",
              "plan": "Enterprise",
              "email": "user9@example.com",
              "last_login": "2024-05-30"
            },
            {
              "name": "User 10",
              "plan": "Pro",
              "email": "user10@example.com",
              "last_login": "2024-03-15"
            }
          ]
        }
      }
    ]
  },
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "3590dd60-19d3-4b24-98e0-c6e495a0b9c0",
  "connections": {
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Scrape User Data (AI Agent)",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Auto-fixing Output Parser",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Daily Check Trigger": {
      "main": [
        [
          {
            "node": "Set Admin Dashboard URL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Bright Data MCP Client": {
      "ai_tool": [
        [
          {
            "node": "Scrape User Data (AI Agent)",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Format User Login Data": {
      "main": [
        [
          {
            "node": "Convert Date to Days Since Login",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert Days to Integer": {
      "main": [
        [
          {
            "node": "Check Inactive Threshold (>=30 days)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Admin Dashboard URL": {
      "main": [
        [
          {
            "node": "Scrape User Data (AI Agent)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Auto-fixing Output Parser",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Auto-fixing Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Scrape User Data (AI Agent)",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Scrape User Data (AI Agent)": {
      "main": [
        [
          {
            "node": "Format User Login Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert Date to Days Since Login": {
      "main": [
        [
          {
            "node": "Convert Days to Integer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Inactive Threshold (>=30 days)": {
      "main": [
        [
          {
            "node": "Send Re-engagement Email",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Do Nothing (User Active)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

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

需要付费吗?

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

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

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

作者
Yaron Been

Yaron Been

@yaron-nofluff

Building AI Agents and Automations | Growth Marketer | Entrepreneur | Book Author & Podcast Host If you need any help with Automations, feel free to reach out via linkedin: https://www.linkedin.com/in/yaronbeen/ And check out my Youtube channel: https://www.youtube.com/@YaronBeen/videos

外部链接
在 n8n.io 查看

分享此工作流