{
  "name": "客户线索自动化工作流",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "lead-collect",
        "options": {}
      },
      "name": "表单提交触发",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1,
      "position": [0, 0]
    },
    {
      "parameters": {
        "url": "YOUR_COMPANY_INFO_API_URL",
        "method": "GET",
        "options": {}
      },
      "name": "补全公司信息",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [220, 0]
    },
    {
      "parameters": {
        "url": "https://api.moonshot.cn/v1/chat/completions",
        "method": "POST",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            { "name": "Authorization", "value": "Bearer YOUR_LLM_API_KEY" },
            { "name": "Content-Type", "value": "application/json" }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\"model\":\"moonshot-v1-8k\",\"messages\":[{\"role\":\"system\",\"content\":\"你是销售线索评估师。根据线索信息打分(意向度1-10/预算1-10/时效1-10)给出总分0-30与跟进建议(优先/培育/放弃)。仅输出JSON：intent,budget,urgency,total,action,next_step。不编造，信息不足标待补充\"},{\"role\":\"user\",\"content\":\"={{$json.body}}\"}]}",
        "options": {}
      },
      "name": "LLM打分",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [440, 0]
    },
    {
      "parameters": {
        "conditions": {
          "boolean": [
            { "value1": "={{$json.choices[0].message.content}}", "value2": "优先" }
          ]
        }
      },
      "name": "高分分流",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [660, 0]
    },
    {
      "parameters": {
        "url": "YOUR_SLACK_OR_DINGTALK_WEBHOOK",
        "method": "POST",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\"msg_type\":\"text\",\"content\":{\"text\":\"新高分线索：{{=$json.choices[0].message.content}}\"}}",
        "options": {}
      },
      "name": "推送销售群",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [880, -80]
    },
    {
      "parameters": {
        "url": "YOUR_CRM_API_URL",
        "method": "POST",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{$json.choices[0].message.content}}",
        "options": {}
      },
      "name": "入CRM",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [880, 80]
    }
  ],
  "connections": {
    "表单提交触发": { "main": [ [{ "node": "补全公司信息", "type": "main", "index": 0 }] ] },
    "补全公司信息": { "main": [ [{ "node": "LLM打分", "type": "main", "index": 0 }] ] },
    "LLM打分": { "main": [ [{ "node": "高分分流", "type": "main", "index": 0 }] ] },
    "高分分流": { "main": [ [{ "node": "推送销售群", "type": "main", "index": 0 }], [{ "node": "入CRM", "type": "main", "index": 0 }] ] }
  }
}
