8
n8n 中文网amn8n.com

31 监控销售管道指标

高级

这是一个CRM, AI Summarization领域的自动化工作流,包含 16 个节点。主要使用 Set, Code, GoogleSheets, McpClientTool, ManualTrigger 等节点。 Bright Data、OpenAI和Google表格的实时销售管道分析

前置要求
  • Google Sheets API 凭证
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "eFXzg1O4PWujvjQZ",
  "meta": {
    "instanceId": "c38e3b8a7e4240e6cdca062743f016c1029f385bf40345b6291939dfd83bfd77",
    "templateCredsSetupCompleted": true
  },
  "name": "31 监控销售管道指标",
  "tags": [],
  "nodes": [
    {
      "id": "df762772-ed58-47e6-b95c-cd75d399d230",
      "name": "⚡ 触发器:启动CRM爬虫",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -80,
        0
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "87a7f944-eb5f-4554-a296-83270d2069f5",
      "name": "🔗 设置源URL(CRM/JSONPlaceholder)",
      "type": "n8n-nodes-base.set",
      "position": [
        120,
        0
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "7a1b9454-dbc2-4805-899b-268a0cfc2cdf",
              "name": "URL",
              "type": "string",
              "value": "https://jsonplaceholder.typicode.com/users"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "fb1472a0-27d2-4d73-ae55-7853ec9c7372",
      "name": "🤖 监控销售管道(CRM AI代理)",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        400,
        0
      ],
      "parameters": {
        "text": "=You are a data analyst connected to Bright Data MCP scraping tool.\n\nScrape CRM-like sales data from this public API:\n{{ $json.URL }}\n\nTreat each user as a sales lead. For each entry, extract and simulate the following fields:\n\n{\n\"leadId\": <use id>,\n\"rep\": <use name>,\n\"stage\": <use username as deal stage>,\n\"value\": <convert address.zipcode to number and use as deal value>,\n\"status\": <use company.name to randomly assign status as \"open\", \"won\", or \"lost\">\n}\n\nThen:\n\nCalculate total number of leads\n\nTotal value of pipeline\n\nCount of leads in each stage\n\nCount of deals by status: open, won, lost\n\nIdentify top 3 reps based on simulated deal value",
        "options": {},
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2
    },
    {
      "id": "f7aac7e3-10e8-4564-a634-391f5285e917",
      "name": "🧠 AI大脑",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        300,
        260
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "kmqnyfHdWfA8k1KC",
          "name": "OpenAi account 3"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "9b888f4b-be89-43b1-819e-eafb3bb02643",
      "name": "🌐 Bright Data MCP",
      "type": "n8n-nodes-mcp.mcpClientTool",
      "position": [
        440,
        260
      ],
      "parameters": {
        "toolName": "scrape_as_markdown",
        "operation": "executeTool",
        "toolParameters": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Tool_Parameters', ``, 'json') }}"
      },
      "credentials": {
        "mcpClientApi": {
          "id": "dGu6Ys11ijXSTxcV",
          "name": "MCP Client (STDIO) account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "83dfb033-a62e-47dc-bdea-be936f0534d9",
      "name": "🧩 拆分指标为表格行",
      "type": "n8n-nodes-base.code",
      "position": [
        800,
        0
      ],
      "parameters": {
        "jsCode": "return (() => {\nconst result = [];\n\nconst data = items[0].json.output;\n\n// 1. Total Leads\nresult.push({\n\"Metric Type\": \"Summary\",\n\"Label\": \"Total Leads\",\n\"Value\": data.totalLeads\n});\n\n// 2. Total Pipeline Value\nresult.push({\n\"Metric Type\": \"Summary\",\n\"Label\": \"Total Value\",\n\"Value\": data.totalPipelineValue\n});\n\n// 3. Status Breakdown\nfor (const status in data.statusBreakdown) {\nresult.push({\n\"Metric Type\": \"Status Count\",\n\"Label\": status,\n\"Value\": data.statusBreakdown[status]\n});\n}\n\n// 4. Stage Breakdown\nfor (const stage in data.stageBreakdown) {\nresult.push({\n\"Metric Type\": \"Stage Count\",\n\"Label\": stage,\n\"Value\": data.stageBreakdown[stage]\n});\n}\n\n// 5. Top Reps\nfor (const rep of data.topReps) {\nresult.push({\n\"Metric Type\": \"Top Reps\",\n\"Label\": rep.rep,\n\"Value\": rep.totalValue\n});\n}\n\nreturn result.map(r => ({ json: r }));\n})();"
      },
      "typeVersion": 2
    },
    {
      "id": "bde8a138-5106-4278-b86a-a5b2e1719706",
      "name": "📊 存储CRM洞察(Google Sheet)",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1000,
        0
      ],
      "parameters": {
        "columns": {
          "value": {
            "Label": "={{ $json.Label }}",
            "Value": "={{ $json.Value }}",
            "Metric Type": "={{ $json['Metric Type'] }}"
          },
          "schema": [
            {
              "id": "Metric Type",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Metric Type",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Label",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Label",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Value",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Value",
              "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/1D8VmSbOUEf1jQWQ-_BaHVV_HOdb_d5DIyXzRSMlU5xs/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1D8VmSbOUEf1jQWQ-_BaHVV_HOdb_d5DIyXzRSMlU5xs",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1D8VmSbOUEf1jQWQ-_BaHVV_HOdb_d5DIyXzRSMlU5xs/edit?usp=drivesdk",
          "cachedResultName": "Monitor Sales Pipeline Metrics"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "i899RBJ6SKiYYWwx",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "d363f7ce-1ff8-4dd6-9517-aa0ffaa6dc32",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1620,
        -700
      ],
      "parameters": {
        "color": 4,
        "width": 1300,
        "height": 2700,
        "content": "# 🚀 智能CRM爬虫与管道健康分析器(n8n + Bright Data + Google Sheets)"
      },
      "typeVersion": 1
    },
    {
      "id": "3913ffe7-126f-4162-9533-286d9cb7e010",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        300,
        -1060
      ],
      "parameters": {
        "color": 5,
        "width": 420,
        "height": 1260,
        "content": "🤖 第2部分:AI代理 — 抓取+分析"
      },
      "typeVersion": 1
    },
    {
      "id": "08dd1bdc-e20c-4d67-9d49-d4b8d98dd083",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        740,
        -700
      ],
      "parameters": {
        "color": 6,
        "width": 440,
        "height": 900,
        "content": "🟨 第3部分:格式化并存储到Google Sheets"
      },
      "typeVersion": 1
    },
    {
      "id": "4f470e7c-148e-4486-b15b-083bcef250af",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -120,
        -720
      ],
      "parameters": {
        "color": 3,
        "width": 400,
        "height": 920,
        "content": "🔷 第1部分:启动与设置目标"
      },
      "typeVersion": 1
    },
    {
      "id": "b9e43f5f-eeb7-463b-8a68-2086acb14253",
      "name": "便签5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1240,
        -700
      ],
      "parameters": {
        "color": 7,
        "width": 380,
        "height": 240,
        "content": "## 如果您通过此链接加入Bright Data,我将获得少量佣金——感谢您支持更多免费内容!"
      },
      "typeVersion": 1
    },
    {
      "id": "23b951f8-8dd3-4e3b-b4e3-a5fc474ee033",
      "name": "便签 9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1620,
        -1060
      ],
      "parameters": {
        "color": 4,
        "width": 1300,
        "height": 320,
        "content": "======================================="
      },
      "typeVersion": 1
    },
    {
      "id": "4f1a9df8-f864-4d44-840b-80b9bc4f9e5e",
      "name": "自动修复输出解析器",
      "type": "@n8n/n8n-nodes-langchain.outputParserAutofixing",
      "position": [
        580,
        260
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "fba56334-ce0c-470b-b7ed-f62e96eab480",
      "name": "OpenAI 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        520,
        480
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "kmqnyfHdWfA8k1KC",
          "name": "OpenAi account 3"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "d4df16f4-12d0-4ce0-be84-744b0b861e5a",
      "name": "🧾 清理JSON解析器",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        700,
        480
      ],
      "parameters": {
        "jsonSchemaExample": "{\n\"totalLeads\": 10,\n\"totalPipelineValue\": 556281,\n\"statusBreakdown\": {\n\"open\": 3,\n\"won\": 4,\n\"lost\": 3\n},\n\"stageBreakdown\": {\n\"Bret\": 1,\n\"Antonette\": 1,\n\"Samantha\": 1,\n\"Karianne\": 1,\n\"Kamren\": 1,\n\"Leopoldo_Corkery\": 1,\n\"Elwyn.Skiles\": 1,\n\"Maxime_Nienow\": 1,\n\"Delphine\": 1,\n\"Moriah.Stanton\": 1\n},\n\"topReps\": [\n{\n\"rep\": \"Leanne Graham\",\n\"stage\": \"Bret\",\n\"totalValue\": 929983874\n},\n{\n\"rep\": \"Ervin Howell\",\n\"stage\": \"Antonette\",\n\"totalValue\": 905667771\n},\n{\n\"rep\": \"Clementine Bauch\",\n\"stage\": \"Samantha\",\n\"totalValue\": 595904157\n}\n]\n}"
      },
      "typeVersion": 1.3
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "72c19df5-d177-40b7-9390-21cfb599878c",
  "connections": {
    "🧠 AI Brain ": {
      "ai_languageModel": [
        [
          {
            "node": "🤖 Monitor Sales Pipeline (CRM AI Agent)",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Auto-fixing Output Parser",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "🌐 Bright Data MCP": {
      "ai_tool": [
        [
          {
            "node": "🤖 Monitor Sales Pipeline (CRM AI Agent)",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "🧾 Clean JSON Parser ": {
      "ai_outputParser": [
        [
          {
            "node": "Auto-fixing Output Parser",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Auto-fixing Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "🤖 Monitor Sales Pipeline (CRM AI Agent)",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "⚡ Trigger: Start CRM Scraper": {
      "main": [
        [
          {
            "node": "🔗 Set Source URL (CRM/JSONPlaceholder)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "🧩 Split Metrics for Sheet Rows": {
      "main": [
        [
          {
            "node": "📊 Store CRM Insights (Google Sheet)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "🔗 Set Source URL (CRM/JSONPlaceholder)": {
      "main": [
        [
          {
            "node": "🤖 Monitor Sales Pipeline (CRM AI Agent)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "🤖 Monitor Sales Pipeline (CRM AI Agent)": {
      "main": [
        [
          {
            "node": "🧩 Split Metrics for Sheet Rows",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

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

需要付费吗?

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

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

适合高级用户,包含 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 查看

分享此工作流