8
n8n 中文网amn8n.com

冷线索成交关闭工作流

中级

这是一个Content Creation, Multimodal AI领域的自动化工作流,包含 15 个节点。主要使用 Code, Gmail, Slack, Filter, Hubspot 等节点。 基于Gmail反馈和Slack通知的HubSpot冷线索交易自动关闭

前置要求
  • Google 账号和 Gmail API 凭证
  • Slack Bot Token 或 Webhook URL
  • HubSpot API Key
  • 可能需要目标 API 的认证凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "INSTANCE_ID_PLACEHOLDER",
    "templateCredsSetupCompleted": false
  },
  "name": "冷线索成交关闭工作流",
  "tags": [],
  "nodes": [
    {
      "id": "99a95283-6245-4d88-ae58-07aaef8ddf14",
      "name": "计划触发器",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -304,
        -16
      ],
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "35be2b12-2b12-42ee-aa01-df7c49daf6d4",
      "name": "获取 HubSpot 交易",
      "type": "n8n-nodes-base.hubspot",
      "position": [
        -80,
        -16
      ],
      "parameters": {
        "filters": {
          "propertiesCollection": {
            "propertiesValues": {
              "properties": [
                "dealname",
                "hs_lastmodifieddate",
                "notes_last_updated",
                "notes_last_contacted"
              ],
              "propertyMode": "valueOnly"
            }
          }
        },
        "resource": "deal",
        "operation": "getAll",
        "returnAll": true,
        "authentication": "appToken"
      },
      "credentials": {
        "hubspotAppToken": {
          "id": "YOUR_HUBSPOT_CREDENTIAL_ID",
          "name": "HubSpot account"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "ff92028e-afa9-4ed2-b123-aa2619f612dd",
      "name": "提取交易字段",
      "type": "n8n-nodes-base.code",
      "position": [
        144,
        -16
      ],
      "parameters": {
        "jsCode": "return items.map(item => {\n  const props = item.json.properties || {};\n\n  return {\n    json: {\n      dealId: item.json.dealId || '',\n      dealname: props.dealname?.value || '',\n      lastmodifieddate: props.hs_lastmodifieddate?.value || '',\n      notes_last_updated: props.notes_last_updated?.value || '',\n      notes_last_contacted: props.notes_last_contacted?.value || ''\n    }\n  };\n});"
      },
      "typeVersion": 2
    },
    {
      "id": "5f50f06b-dc6a-45eb-b8b5-17b3f092f7ce",
      "name": "筛选冷线索(21天以上)",
      "type": "n8n-nodes-base.filter",
      "position": [
        368,
        -16
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 1,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "1",
              "operator": {
                "type": "number",
                "operation": "lt"
              },
              "leftValue": "={{ $json.lastmodifieddate.toNumber() }}",
              "rightValue": "={{ Date.now() - 21 * 24 * 60 * 60 * 1000 }}"
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "f3e64724-432c-4354-a115-61185fb3d23e",
      "name": "更新交易为\"已关闭-失败\"",
      "type": "n8n-nodes-base.hubspot",
      "position": [
        592,
        -16
      ],
      "parameters": {
        "dealId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.dealId }}"
        },
        "resource": "deal",
        "operation": "update",
        "updateFields": {
          "stage": "closedlost"
        },
        "authentication": "appToken"
      },
      "credentials": {
        "hubspotAppToken": {
          "id": "YOUR_HUBSPOT_CREDENTIAL_ID",
          "name": "HubSpot account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "4d51776d-1c40-435a-989f-660f4546b401",
      "name": "获取交易关联",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        800,
        -16
      ],
      "parameters": {
        "url": "=https://api.hubapi.com/crm/v3/objects/deals/{{ $json.dealId }}?associations=contacts",
        "options": {},
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer YOUR_HUBSPOT_ACCESS_TOKEN"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "2d48cf93-9066-482b-9c7d-0b317ff99406",
      "name": "提取联系人ID",
      "type": "n8n-nodes-base.code",
      "position": [
        1008,
        -16
      ],
      "parameters": {
        "jsCode": "// Extract contact IDs from deals data\nconst dealsData = $input.all();\nconst contactIds = [];\n\ndealsData.forEach(item => {\n  const deal = item.json;\n  if (deal.associations && deal.associations.contacts && deal.associations.contacts.results) {\n    deal.associations.contacts.results.forEach(contact => {\n      contactIds.push({\n        contactId: contact.id,\n        dealId: deal.id,\n        dealName: deal.properties.dealname\n      });\n    });\n  }\n});\n\nreturn contactIds;"
      },
      "typeVersion": 2
    },
    {
      "id": "955cad66-4b5e-45b0-9c82-78f27ed78823",
      "name": "获取联系人详情",
      "type": "n8n-nodes-base.hubspot",
      "position": [
        1216,
        -16
      ],
      "parameters": {
        "contactId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.contactId }}"
        },
        "operation": "get",
        "authentication": "appToken",
        "additionalFields": {
          "propertiesCollection": {
            "propertiesValues": {
              "properties": [
                "email",
                "firstname",
                "lastname",
                "hs_full_name_or_email"
              ]
            }
          }
        }
      },
      "credentials": {
        "hubspotAppToken": {
          "id": "YOUR_HUBSPOT_CREDENTIAL_ID",
          "name": "HubSpot account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "0ef1bd2f-8986-42eb-b09f-3e3c09ed3403",
      "name": "提取联系人邮箱",
      "type": "n8n-nodes-base.code",
      "position": [
        1424,
        -16
      ],
      "parameters": {
        "jsCode": "// Code Node (JavaScript)\n\nreturn items.map(item => {\n  let email = null;\n\n  // try to safely access the email field\n  if (item.json?.properties?.email?.value) {\n    email = item.json.properties.email.value;\n  }\n\n  return {\n    json: {\n      email\n    }\n  };\n});"
      },
      "typeVersion": 2
    },
    {
      "id": "ea48344a-33e0-442d-9b15-24708f6376f4",
      "name": "发送 Gmail 反馈请求",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1648,
        -16
      ],
      "webhookId": "WEBHOOK_ID_PLACEHOLDER",
      "parameters": {
        "sendTo": "=your-email@example.com",
        "message": "=Hi {{ $('Get Contact Details').item.json.properties.firstname.value }},<br><br>\n\nI hope you're doing well.<br><br>\n\nThank you once again for considering [Your Company] for your project. While I understand you've decided to move in a different direction, I truly appreciate the time and effort you spent engaging with us.<br><br>\n\nWe'd Love Your Feedback<br>\nIf you're open to it, I'd be grateful for any thoughts you'd like to share about your decision—anything that could help us improve going forward.<br><br>\n\nOpen Door for the Future<br>\nShould your needs evolve in the future, I'd be happy to reconnect and support you in any way we can.<br><br>\n\nWishing you all the best with your project and continued success ahead.<br><br>\n\nWarm regards,<br><br>\n[Your Company]<br>\n",
        "options": {
          "appendAttribution": false
        },
        "subject": "=Thank You — We'd Value Your Feedback"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "YOUR_GMAIL_CREDENTIAL_ID",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "da6063b5-6c22-4312-960a-276b9a8a90dd",
      "name": "发送 Slack 通知",
      "type": "n8n-nodes-base.slack",
      "position": [
        1856,
        -16
      ],
      "webhookId": "WEBHOOK_ID_PLACEHOLDER",
      "parameters": {
        "text": "=Deals which are moved to Closed Lost: {{ $('Extract Contact IDs').item.json.dealId }}",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_SLACK_CHANNEL_ID",
          "cachedResultName": "general"
        },
        "otherOptions": {},
        "authentication": "oAuth2"
      },
      "credentials": {
        "slackOAuth2Api": {
          "id": "YOUR_SLACK_CREDENTIAL_ID",
          "name": "Slack account"
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "00280018-e849-44a3-a90a-e4b41e3d3fb4",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -352,
        -336
      ],
      "parameters": {
        "color": 4,
        "width": 640,
        "height": 624,
        "content": "## 触发器与交易获取"
      },
      "typeVersion": 1
    },
    {
      "id": "26416831-06bb-45ef-983a-44c74160ae87",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        304,
        -336
      ],
      "parameters": {
        "color": 2,
        "width": 432,
        "height": 624,
        "content": "## 线索资格认定(冷交易)"
      },
      "typeVersion": 1
    },
    {
      "id": "9bf5bb30-24d1-4f31-a07b-dd781175e066",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        752,
        -336
      ],
      "parameters": {
        "color": 6,
        "width": 832,
        "height": 624,
        "content": "## 交易 → 联系人映射"
      },
      "typeVersion": 1
    },
    {
      "id": "cedf1213-f134-4ddd-a96c-764d1320193e",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1600,
        -336
      ],
      "parameters": {
        "color": 3,
        "width": 384,
        "height": 624,
        "content": "## 跟进与通知"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "TEMPLATE_VERSION_ID",
  "connections": {
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Get HubSpot Deals",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get HubSpot Deals": {
      "main": [
        [
          {
            "node": "Extract Deal Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Contact IDs": {
      "main": [
        [
          {
            "node": "Get Contact Details",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Deal Fields": {
      "main": [
        [
          {
            "node": "Filter Cold Leads (21+ days)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Contact Details": {
      "main": [
        [
          {
            "node": "Extract Contact Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Contact Email": {
      "main": [
        [
          {
            "node": "Send Gmail Feedback Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Deal Associations": {
      "main": [
        [
          {
            "node": "Extract Contact IDs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Deal to Closed Lost": {
      "main": [
        [
          {
            "node": "Fetch Deal Associations",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Gmail Feedback Request": {
      "main": [
        [
          {
            "node": "Send Slack Notification",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Cold Leads (21+ days)": {
      "main": [
        [
          {
            "node": "Update Deal to Closed Lost",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 内容创作, 多模态 AI

需要付费吗?

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

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

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

作者
Avkash Kakdiya

Avkash Kakdiya

@itechnotion

🚀 Founder of iTechNotion — we build custom AI-powered automation workflows for startups, agencies, and founders. 💡 Specializing in agentic AI systems, content automation, sales funnels, and digital workers. 🔧 14+ years in tech | Building scalable no-code/low-code solutions using n8n, OpenAI, and other API-first tools. 📬 Let’s automate what slows you down.

外部链接
在 n8n.io 查看

分享此工作流