8
n8n 中文网amn8n.com

从 GoHighLevel 自动发送客户续约提醒到 Gmail 和 Slack

高级

这是一个CRM领域的自动化工作流,包含 19 个节点。主要使用 If, Code, Gmail, Merge, Slack 等节点。 从GoHighLevel自动发送客户续约提醒到Gmail、Slack和Google Sheets

前置要求
  • Google 账号和 Gmail API 凭证
  • Slack Bot Token 或 Webhook URL
  • Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "zAhUYo1pPedFF2vq",
  "meta": {
    "instanceId": "8443f10082278c46aa5cf3acf8ff0f70061a2c58bce76efac814b16290845177",
    "templateCredsSetupCompleted": true
  },
  "name": "从 GoHighLevel 自动发送客户续约提醒到 Gmail 和 Slack",
  "tags": [],
  "nodes": [
    {
      "id": "e89a6dcb-42d4-4674-bd3d-2f91b86231b2",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3120,
        -64
      ],
      "parameters": {
        "color": 4,
        "width": 420,
        "height": 656,
        "content": "## 🔄 客户保留续约提醒工作流"
      },
      "typeVersion": 1
    },
    {
      "id": "9ffba3e1-2389-47df-8257-708871c6c5e4",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2656,
        -208
      ],
      "parameters": {
        "color": 5,
        "width": 280,
        "height": 240,
        "content": "## ⏰ 计划触发器设置"
      },
      "typeVersion": 1
    },
    {
      "id": "94e0e170-fe29-42a6-9926-d052fbc28fd5",
      "name": "每天上午 9 点计划",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -2560,
        48
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "expression": "0 9 * * *"
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "05b63bb3-1942-4f24-9d53-3b3f2a25a7f5",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2432,
        240
      ],
      "parameters": {
        "color": 5,
        "width": 280,
        "height": 396,
        "content": "## 📥 从 CRM 获取联系人"
      },
      "typeVersion": 1
    },
    {
      "id": "5e3e0e62-267e-4728-a4ae-f92581607f06",
      "name": "从 GoHighLevel 获取联系人",
      "type": "n8n-nodes-base.highLevel",
      "position": [
        -2336,
        48
      ],
      "parameters": {
        "filters": {},
        "options": {},
        "operation": "getAll",
        "requestOptions": {}
      },
      "credentials": {
        "highLevelOAuth2Api": {
          "id": "N9Q1X1RWUjvRIRbt",
          "name": "HighLevel account 2"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "9e665b65-003d-430d-a7f7-48228b7dcad8",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2208,
        -272
      ],
      "parameters": {
        "color": 5,
        "width": 260,
        "height": 292,
        "content": "## 🔍 验证数据质量"
      },
      "typeVersion": 1
    },
    {
      "id": "eb37756d-3de4-4d63-8215-b4e8520bcb5e",
      "name": "检查是否有自定义字段",
      "type": "n8n-nodes-base.if",
      "position": [
        -2112,
        48
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "58341a8d-2417-47e1-b29b-be575b270c35",
              "operator": {
                "type": "array",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.customFields }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "f102174e-cba7-4d13-a322-f2327d9f1449",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1936,
        208
      ],
      "parameters": {
        "color": 5,
        "width": 280,
        "height": 404,
        "content": "## 🎯 筛选即将到期的合同"
      },
      "typeVersion": 1
    },
    {
      "id": "6f9a5a69-8ce9-46c1-88f2-d12a44a3f319",
      "name": "筛选续约代码",
      "type": "n8n-nodes-base.code",
      "position": [
        -1888,
        48
      ],
      "parameters": {
        "jsCode": "// Get current date at midnight for accurate day comparison\nconst today = new Date();\ntoday.setHours(0, 0, 0, 0);\n\n// Array to store filtered contacts\nconst filteredContacts = [];\n\n// Process each contact from input\nfor (const contact of $input.all()) {\n  const item = contact.json;\n  \n  // Check if contact has customFields\n  if (!item.customFields || !Array.isArray(item.customFields)) {\n    continue;\n  }\n  \n  // TODO: Replace with YOUR custom field ID for Contract End Date\n  const contractEndField = item.customFields.find(\n    field => field.id === 'YOUR_CONTRACT_END_DATE_FIELD_ID'\n  );\n  \n  // Skip if no contract end date exists\n  if (!contractEndField || !contractEndField.value) {\n    continue;\n  }\n  \n  // Parse contract end date (timestamp in milliseconds)\n  const contractEndDate = new Date(contractEndField.value);\n  contractEndDate.setHours(0, 0, 0, 0);\n  \n  // Calculate days until expiry\n  const daysUntilExpiry = Math.ceil(\n    (contractEndDate - today) / (1000 * 60 * 60 * 24)\n  );\n  \n  // Filter: expires within next 10 days (0-10 days)\n  if (daysUntilExpiry >= 0 && daysUntilExpiry <= 10) {\n    \n    // TODO: Replace with YOUR custom field ID for Account Manager\n    const accountManagerField = item.customFields.find(\n      field => field.id === 'YOUR_ACCOUNT_MANAGER_FIELD_ID'\n    );\n    \n    // Format the contract end date for display\n    const formattedDate = contractEndDate.toLocaleDateString('en-US', {\n      year: 'numeric',\n      month: 'long',\n      day: 'numeric'\n    });\n    \n    // Create enriched contact object\n    filteredContacts.push({\n      json: {\n        // Original contact data\n        id: item.id,\n        contactName: item.contactName,\n        firstName: item.firstName || 'N/A',\n        lastName: item.lastName || 'N/A',\n        email: item.email || 'No email on file',\n        companyName: item.companyName || 'N/A',\n        phone: item.phone,\n        \n        // Contract information\n        contractEndDate: formattedDate,\n        contractEndDateRaw: contractEndDate.toISOString(),\n        contractEndTimestamp: contractEndField.value,\n        daysUntilExpiry: daysUntilExpiry,\n        \n        // Account manager info\n        accountManager: accountManagerField?.value || 'Unassigned',\n        \n        // Additional fields for workflow\n        allCustomFields: item.customFields,\n        tags: item.tags || [],\n        source: item.source\n      }\n    });\n  }\n}\n\n// Return filtered contacts\nreturn filteredContacts;"
      },
      "typeVersion": 2
    },
    {
      "id": "6f7a46e5-115c-4bef-9cc7-e30b96b1b94d",
      "name": "验证在 10 天内到期",
      "type": "n8n-nodes-base.filter",
      "position": [
        -1664,
        48
      ],
      "parameters": {
        "conditions": {
          "number": [
            {
              "value1": "={{ $json.daysUntilExpiry }}",
              "value2": 10,
              "operation": "smallerEqual"
            }
          ],
          "string": [
            {
              "value1": "={{ $json.contractEndDate }}",
              "operation": "isNotEmpty"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "3b9392da-852b-4692-bfac-5c177bbda695",
      "name": "便签5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1536,
        -400
      ],
      "parameters": {
        "color": 5,
        "width": 280,
        "height": 340,
        "content": "## 📧 发送客户邮件"
      },
      "typeVersion": 1
    },
    {
      "id": "17f722d7-781c-41d4-bd15-b84b187df947",
      "name": "通过 Gmail 发送续约邮件",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -1440,
        -48
      ],
      "webhookId": "c62251a2-e50a-4f59-8e3e-d35403ca9d82",
      "parameters": {
        "sendTo": "={{ $json.email }}",
        "message": "=Hi {{ $json.firstName }} {{ $json.lastName }},\n\nThis is a friendly reminder that your contract with us is set to expire on {{ $json.contractEndDate }}.\n\nWe'd love to continue working with you! Please let us know if you'd like to discuss renewal options.\n\nYour account manager will be reaching out shortly.\n\nBest regards,\nYour Team",
        "options": {},
        "subject": "Important: Your Contract Renewal is Coming Up"
      },
      "typeVersion": 2.1
    },
    {
      "id": "3e716197-e31d-49d9-8c3e-b1ba215bed06",
      "name": "便签6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1488,
        304
      ],
      "parameters": {
        "color": 5,
        "width": 280,
        "height": 384,
        "content": "## 📢 Slack 团队通知"
      },
      "typeVersion": 1
    },
    {
      "id": "79b9f0dd-1fd1-4562-b93e-99e3bc111aeb",
      "name": "向团队发送 Slack 提醒",
      "type": "n8n-nodes-base.slack",
      "position": [
        -1440,
        144
      ],
      "webhookId": "2d02c3a0-61c7-4742-b2d5-665e3ad8dab8",
      "parameters": {
        "text": "=🔔 *Contract Renewal Alert*\n\n*Client:* {{ $json.firstName }} {{ $json.lastName }}\n*Email:* {{ $json.email }}\n*Company:* {{ $json.companyName || \"N/A\" }}\n*Contract Expires:* {{ $json.contractEndDate }}\n*Days Remaining:* {{ $json.daysUntilExpiry }}\n*Account Manager:* {{ $json.accountManager }}\n\n✅ Renewal email has been sent to client.\n📋 Please follow up within 3 business days.",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_SLACK_CHANNEL_ID",
          "cachedResultName": "Select your renewals channel"
        },
        "otherOptions": {}
      },
      "typeVersion": 2.1
    },
    {
      "id": "f3448850-b573-416a-b34c-8e1e7d985151",
      "name": "合并邮件和 Slack 结果",
      "type": "n8n-nodes-base.merge",
      "position": [
        -1216,
        48
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "combinationMode": "mergeByPosition"
      },
      "typeVersion": 2.1
    },
    {
      "id": "96ae9e61-3ffc-4f04-b6ac-2a58495dc455",
      "name": "便签7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1072,
        -272
      ],
      "parameters": {
        "color": 5,
        "width": 260,
        "height": 296,
        "content": "## 📊 生成摘要报告"
      },
      "typeVersion": 1
    },
    {
      "id": "c61d0e08-0b24-4be6-bbcd-b58de927212a",
      "name": "生成摘要报告",
      "type": "n8n-nodes-base.code",
      "position": [
        -992,
        48
      ],
      "parameters": {
        "jsCode": "const totalReminders = $input.all().length;\nconst timestamp = new Date().toLocaleString();\n\nreturn {\n  json: {\n    summary: `Renewal Reminder Workflow Completed`,\n    totalRemindersSent: totalReminders,\n    timestamp: timestamp,\n    message: `${totalReminders} renewal reminder(s) sent successfully on ${timestamp}`\n  }\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "9e39598a-d4f0-43e9-9885-a306371772e1",
      "name": "便签8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -752,
        256
      ],
      "parameters": {
        "color": 5,
        "width": 280,
        "height": 268,
        "content": "## 📝 记录到 Google Sheets"
      },
      "typeVersion": 1
    },
    {
      "id": "ace3170b-c470-4458-b601-db08918f1572",
      "name": "将结果记录到 Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -768,
        48
      ],
      "parameters": {
        "columns": {
          "value": {},
          "schema": [
            {
              "id": "summary",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "summary",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "totalRemindersSent",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "totalRemindersSent",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "timestamp",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "timestamp",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "message",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "message",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "autoMapInputData",
          "matchingColumns": []
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "Sheet1",
          "cachedResultName": "Select sheet name"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_GOOGLE_SHEET_ID",
          "cachedResultName": "Select your tracking sheet"
        }
      },
      "typeVersion": 4.7
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "180a6f20-55ff-43e1-bbd0-85e6eebaf0bb",
  "connections": {
    "Filter Renewals Code": {
      "main": [
        [
          {
            "node": "Verify Expiring Within 10 Days",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Daily at 9 AM": {
      "main": [
        [
          {
            "node": "Fetch Contacts from GoHighLevel",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Has Custom Fields": {
      "main": [
        [
          {
            "node": "Filter Renewals Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Summary Report": {
      "main": [
        [
          {
            "node": "Log Results to Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Slack Alert to Team": {
      "main": [
        [
          {
            "node": "Merge Email and Slack Results",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Send Renewal Email via Gmail": {
      "main": [
        [
          {
            "node": "Merge Email and Slack Results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Email and Slack Results": {
      "main": [
        [
          {
            "node": "Generate Summary Report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Verify Expiring Within 10 Days": {
      "main": [
        [
          {
            "node": "Send Renewal Email via Gmail",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send Slack Alert to Team",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Contacts from GoHighLevel": {
      "main": [
        [
          {
            "node": "Check Has Custom Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 客户关系管理

需要付费吗?

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

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

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

分享此工作流