8
n8n 中文网amn8n.com

从GoHighLevel自动清理非活跃交易到Slack和Sheets

中级

这是一个CRM领域的自动化工作流,包含 15 个节点。主要使用 Code, Slack, Filter, HighLevel, GoogleSheets 等节点。 将GoHighLevel中的非活跃交易自动清理至Slack和Sheets

前置要求
  • Slack Bot Token 或 Webhook URL
  • Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "FpblHtpWHqFmqzwu",
  "meta": {
    "instanceId": "8443f10082278c46aa5cf3acf8ff0f70061a2c58bce76efac814b16290845177",
    "templateCredsSetupCompleted": true
  },
  "name": "从 GoHighLevel 自动清理非活跃交易到 Slack 和 Sheets",
  "tags": [],
  "nodes": [
    {
      "id": "a30f842e-09db-4524-bb2a-f6fb696cd818",
      "name": "工作流描述",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1408,
        -96
      ],
      "parameters": {
        "color": 4,
        "width": 386,
        "height": 400,
        "content": "## 🎯 工作流概览"
      },
      "typeVersion": 1
    },
    {
      "id": "0558197c-899a-470f-93b0-131da334b0f7",
      "name": "计划设置",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -992,
        -400
      ],
      "parameters": {
        "width": 282,
        "height": 311,
        "content": "## ⏰ 计划配置"
      },
      "typeVersion": 1
    },
    {
      "id": "86b8ca02-40c9-4f1d-8192-8c076eb62bc6",
      "name": "每天上午 9 点",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -800,
        -64
      ],
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "860e1aca-04f7-4001-a58b-d2fa695da3e1",
      "name": "HighLevel 配置",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -688,
        112
      ],
      "parameters": {
        "width": 264,
        "height": 274,
        "content": "## 📊 HighLevel 设置"
      },
      "typeVersion": 1
    },
    {
      "id": "9d54a579-e7b9-4d02-a1cd-58f76ebf4c73",
      "name": "获取所有商机",
      "type": "n8n-nodes-base.highLevel",
      "position": [
        -576,
        -64
      ],
      "parameters": {
        "filters": {},
        "resource": "opportunity",
        "operation": "getAll",
        "requestOptions": {}
      },
      "credentials": {
        "highLevelOAuth2Api": {
          "id": "5QWHSi134dLIBEsC",
          "name": "HighLevel account"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "6f31695d-a18d-46c1-aa00-3ce68013db10",
      "name": "过滤逻辑",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -496,
        -384
      ],
      "parameters": {
        "width": 262,
        "height": 296,
        "content": "## 🔍 非活跃过滤器"
      },
      "typeVersion": 1
    },
    {
      "id": "09134267-b553-4979-9be3-d3e74e263b74",
      "name": "过滤非活跃 10 天以上的交易",
      "type": "n8n-nodes-base.filter",
      "position": [
        -352,
        -64
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "c3d4e5f6-a7b8-9012-cdef-123456789012",
              "operator": {
                "type": "number",
                "operation": "gt"
              },
              "leftValue": "={{ Math.floor((new Date() - new Date($json.lastActionDate || $json.updatedAt)) / (1000 * 60 * 60 * 24)) }}",
              "rightValue": 10
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "b9dd983f-bbba-4956-85fd-d3813997f27b",
      "name": "归档配置",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -192,
        112
      ],
      "parameters": {
        "width": 254,
        "height": 264,
        "content": "## 📦 归档操作"
      },
      "typeVersion": 1
    },
    {
      "id": "dc7991c7-79ad-48a3-b79d-d8359afa4d8c",
      "name": "归档非活跃交易",
      "type": "n8n-nodes-base.highLevel",
      "position": [
        -128,
        -64
      ],
      "parameters": {
        "resource": "opportunity",
        "operation": "update",
        "updateFields": {
          "status": "archived"
        },
        "opportunityId": "={{ $json.id }}",
        "requestOptions": {}
      },
      "credentials": {
        "highLevelOAuth2Api": {
          "id": "5QWHSi134dLIBEsC",
          "name": "HighLevel account"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "7f905180-3a1a-4b6f-b049-438b49d50929",
      "name": "处理逻辑",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        48,
        -288
      ],
      "parameters": {
        "width": 256,
        "height": 296,
        "content": "## 🧮 数据处理"
      },
      "typeVersion": 1
    },
    {
      "id": "7fe4471f-287d-4319-8ab0-02f245d9c8f2",
      "name": "格式化交易数据",
      "type": "n8n-nodes-base.code",
      "position": [
        112,
        32
      ],
      "parameters": {
        "jsCode": "// Process and format inactive deal data for logging\nconst formattedData = $input.all().map(item => {\n  const opp = item.json;\n  const lastActivity = new Date(opp.lastActionDate || opp.updatedAt);\n  const daysSinceActivity = Math.floor((Date.now() - lastActivity) / (1000 * 60 * 60 * 24));\n  \n  return {\n    json: {\n      id: opp.id,\n      name: opp.name,\n      pipelineId: opp.pipelineId,\n      pipelineStageId: opp.pipelineStageId,\n      contactId: opp.contactId,\n      contactName: opp.contact?.name || 'N/A',\n      lastActionDate: opp.lastActionDate,\n      updatedAt: opp.updatedAt,\n      daysSinceActivity: daysSinceActivity,\n      isInactive: daysSinceActivity > 10,\n      monetaryValue: opp.monetaryValue || 0,\n      source: opp.source || 'Unknown',\n      tags: Array.isArray(opp.contact?.tags) ? opp.contact.tags.join(', ') : '',\n      archivedAt: new Date().toISOString()\n    }\n  };\n});\n\nreturn formattedData;"
      },
      "typeVersion": 2
    },
    {
      "id": "909dfef7-0703-4893-9465-e806445e492e",
      "name": "Sheets 配置",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        368,
        224
      ],
      "parameters": {
        "width": 278,
        "height": 346,
        "content": "## 📋 Google Sheets 设置"
      },
      "typeVersion": 1
    },
    {
      "id": "046731cb-c515-4430-ba58-f75b46797401",
      "name": "记录到 Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        400,
        64
      ],
      "parameters": {
        "columns": {
          "value": {},
          "schema": [
            {
              "id": "id",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "id",
              "defaultMatch": true,
              "canBeUsedToMatch": true
            },
            {
              "id": "name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "contactName",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "contactName",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "daysSinceActivity",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "daysSinceActivity",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "monetaryValue",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "monetaryValue",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "source",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "source",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "tags",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "tags",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "archivedAt",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "archivedAt",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "autoMapInputData",
          "matchingColumns": [
            "id"
          ]
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "Inactive Pipeliner"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Workflow Description').item.json.sheetId }}"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "kpPEOLCGn963qpoh",
          "name": "automations@techdome.ai"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "3a9b90d5-901f-4dd8-a118-cf76b3da61f5",
      "name": "Slack 设置",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        576,
        -304
      ],
      "parameters": {
        "width": 246,
        "height": 328,
        "content": "## 💬 Slack 通知"
      },
      "typeVersion": 1
    },
    {
      "id": "e1acc249-b80a-4d7d-aa63-b6265b641170",
      "name": "发送 Slack 报告",
      "type": "n8n-nodes-base.slack",
      "position": [
        432,
        -128
      ],
      "webhookId": "2ee869d2-6132-4bfe-8cd3-53415ad11fce",
      "parameters": {
        "text": "=:bookmark_tabs: *Inactive Pipeline Cleaner Report*\n\n*Date:* {{ $now.format('MMMM dd, yyyy') }}\n*Total Deals Archived:* {{ $json.count }}\n*Total Monetary Value:* ${{ $json.totalValue.toLocaleString() }}\n\n*Archived Deals:*\n{{ $json.dealsList.split(',').map((deal, idx) => `${idx + 1}. ${deal.trim()}`).join('\\n') }}",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Workflow Description').item.json.slackChannel }}"
        },
        "otherOptions": {}
      },
      "credentials": {
        "slackApi": {
          "id": "rNqvWj9TfChPVRYY",
          "name": "Slack account vivek"
        }
      },
      "typeVersion": 2.1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "5d204940-94de-4c34-8521-884e2f4345f8",
  "connections": {
    "Daily at 9 AM": {
      "main": [
        [
          {
            "node": "Fetch All Opportunities",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Deal Data": {
      "main": [
        [
          {
            "node": "Log to Google Sheets",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send Slack Report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Archive Inactive Deal": {
      "main": [
        [
          {
            "node": "Format Deal Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch All Opportunities": {
      "main": [
        [
          {
            "node": "Filter Deals Inactive 10+ Days",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Deals Inactive 10+ Days": {
      "main": [
        [
          {
            "node": "Archive Inactive Deal",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 客户关系管理

需要付费吗?

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

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

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

作者
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 查看

分享此工作流