8
n8n 中文网amn8n.com

使用 GPT-4o-mini 分类 Intercom 消息并路由至 ClickUp 或 Slack

中级

这是一个AI Summarization, Multimodal AI领域的自动化工作流,包含 14 个节点。主要使用 If, Code, Slack, ClickUp, Webhook 等节点。 使用 GPT-4o-mini 分类 Intercom 消息并路由至 ClickUp 或 Slack

前置要求
  • Slack Bot Token 或 Webhook URL
  • HTTP Webhook 端点(n8n 会自动生成)
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "EXAMPLE_INSTANCE_ID",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "c9ffdea8-c384-4ec1-ba34-f228c1ec6694",
      "name": "📨 Intercom Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -1160,
        160
      ],
      "webhookId": "your-webhook-id-here",
      "parameters": {
        "path": "your-webhook-path-here",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 1
    },
    {
      "id": "74f38000-b249-404d-b430-7d864652d00f",
      "name": "🧠 分类器 – AI提示",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -920,
        160
      ],
      "parameters": {
        "text": "You are an AI assistant designed to analyze customer conversations from Intercom. Your task is to classify each conversation into structured fields for workflow automation.\n\nConversation: {{ $json[\"data\"][\"item\"] }}\n\nBased on the provided conversation JSON, respond ONLY with a valid JSON object in the following format:\n\n{\n  \"category\": \"<Support | Product | Sales | Other>\",\n  \"sentiment\": \"<Positive | Neutral | Negative>\",\n  \"urgency\": \"<High | Medium | Low>\",\n  \"reasoning\": \"<Brief explanation of how you classified it>\",\n  \"tags\": [\"tag1\", \"tag2\"]\n}\n\nGuidelines:\n- \"category\": Determine the main topic. Use:\n  - \"Support\" for help requests, bugs, technical issues, etc.\n  - \"Product\" for feature requests, feedback, or UX issues.\n  - \"Sales\" for pricing, demo, onboarding, or enterprise inquiries.\n  - \"Other\" if it doesn't fit above.\n- \"sentiment\": Analyze customer tone. Choose Positive, Neutral, or Negative.\n- \"urgency\": \n  - High = frustrated users, urgent bug, blocked access.\n  - Medium = requesting help soon, moderately concerned.\n  - Low = casual inquiry, general feedback.\n- \"reasoning\": Explain how you decided on the classification.\n- \"tags\": Suggest 2–4 keywords as tags based on context (e.g., \"billing\", \"login\", \"onboarding\").\n\nOnly output valid JSON. Do NOT include explanations or extra text outside the JSON.",
        "options": {},
        "promptType": "define"
      },
      "typeVersion": 2
    },
    {
      "id": "68ee4343-685a-4f13-b0a7-c57c271dafb0",
      "name": "GPT模型(gpt-4o-mini)",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -832,
        380
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "YOUR_OPENAI_CREDENTIAL_ID",
          "name": "OpenAI API Key"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "146ebc31-9ffa-4ade-954a-51bd561236ea",
      "name": "🧮 处理分类",
      "type": "n8n-nodes-base.code",
      "position": [
        -544,
        160
      ],
      "parameters": {
        "jsCode": "// Parse the OpenAI response and structure the data\nconst aiResponse = $input.first().json.choices[0].message.content;\n\ntry {\n  const classification = JSON.parse(aiResponse);\n  \n  // Extract original conversation data\n  const conversationData = $('📨 Intercom Webhook').first().json.data.item;\n  \n  return {\n    json: {\n      // Classification results\n      category: classification.category,\n      sentiment: classification.sentiment,\n      urgency: classification.urgency,\n      reasoning: classification.reasoning,\n      tags: classification.tags || [],\n      \n      // Original conversation data\n      conversation_id: conversationData.id,\n      subject: conversationData.conversation_parts.conversation_parts[0].subject || 'No Subject',\n      message: conversationData.conversation_parts.conversation_parts[0].body,\n      customer_name: conversationData.user.name,\n      customer_email: conversationData.user.email,\n      created_at: conversationData.created_at,\n      \n      // Formatted data for tasks\n      task_title: `[${classification.category.toUpperCase()}] ${conversationData.conversation_parts.conversation_parts[0].subject || 'Support Request'}`,\n      task_description: `**Customer:** ${conversationData.user.name} (${conversationData.user.email})\\n\\n**Original Message:**\\n${conversationData.conversation_parts.conversation_parts[0].body}\\n\\n**AI Classification:**\\n- Category: ${classification.category}\\n- Sentiment: ${classification.sentiment}\\n- Urgency: ${classification.urgency}\\n- Reasoning: ${classification.reasoning}\\n\\n**Conversation ID:** ${conversationData.id}`\n    }\n  };\n} catch (error) {\n  throw new Error(`Failed to parse AI response: ${error.message}`);\n}"
      },
      "typeVersion": 2
    },
    {
      "id": "9ef8a0da-aae3-4c64-96cb-24ef077b389f",
      "name": "🛠️ 是否为支持请求?",
      "type": "n8n-nodes-base.if",
      "position": [
        -324,
        -40
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 1,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "support_condition",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.category }}",
              "rightValue": "Support"
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "5f505600-5d12-4e51-8799-823951346b3b",
      "name": "📦 是否为产品请求?",
      "type": "n8n-nodes-base.if",
      "position": [
        -324,
        160
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 1,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "product_condition",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.category }}",
              "rightValue": "Product"
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "9565f5e6-d9ba-428d-a737-bce1eb24ebc9",
      "name": "💼 是否为销售请求?",
      "type": "n8n-nodes-base.if",
      "position": [
        -324,
        360
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 1,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "sales_condition",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.category }}",
              "rightValue": "Sales"
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "a96be2e2-1e56-4ac6-a7e0-3815748277d0",
      "name": "🧾 创建支持任务",
      "type": "n8n-nodes-base.clickUp",
      "position": [
        -104,
        -40
      ],
      "parameters": {
        "list": "YOUR_CLICKUP_LIST_ID",
        "name": "={{ $json.task_title }}",
        "team": "YOUR_CLICKUP_TEAM_ID",
        "space": "YOUR_CLICKUP_SPACE_NAME",
        "folder": "YOUR_CLICKUP_FOLDER_NAME",
        "authentication": "oAuth2",
        "additionalFields": {
          "tags": "={{ $json.tags.join(', ') }}",
          "status": "YOUR_STATUS_NAME",
          "priority": "={{ $json.urgency }}",
          "assignees": "YOUR_ASSIGNEE_ID"
        }
      },
      "credentials": {
        "clickUpOAuth2Api": {
          "id": "YOUR_CLICKUP_CREDENTIAL_ID",
          "name": "ClickUp OAuth2 API"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "257d17bf-5f65-43d9-a4c5-09cdf06c4e17",
      "name": "🛍️ 创建产品任务",
      "type": "n8n-nodes-base.clickUp",
      "position": [
        -104,
        160
      ],
      "parameters": {
        "list": "YOUR_CLICKUP_LIST_ID",
        "name": "={{ $json.task_title }}",
        "team": "YOUR_CLICKUP_TEAM_ID",
        "space": "YOUR_CLICKUP_SPACE_NAME",
        "folder": "YOUR_CLICKUP_FOLDER_NAME",
        "authentication": "oAuth2",
        "additionalFields": {
          "tags": "={{ $json.tags.join(', ') }}",
          "status": "YOUR_STATUS_NAME",
          "priority": "={{ $json.urgency }}",
          "assignees": "YOUR_ASSIGNEE_ID"
        }
      },
      "credentials": {
        "clickUpOAuth2Api": {
          "id": "YOUR_CLICKUP_CREDENTIAL_ID",
          "name": "ClickUp OAuth2 API"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "6ba00f81-e6af-45b5-86ba-875fec8e30b1",
      "name": "📣 Slack – 通知销售团队",
      "type": "n8n-nodes-base.slack",
      "position": [
        -104,
        360
      ],
      "webhookId": "your-slack-webhook-id",
      "parameters": {
        "text": "🚨 New Sales Inquiry Alert!\n\n**Customer:** {{ $json.customer_name }} ({{ $json.customer_email }})\n**Subject:** {{ $json.subject }}\n**Sentiment:** {{ $json.sentiment }}\n**Urgency:** {{ $json.urgency }}\n\n**Message:**\n{{ $json.message }}\n\n**AI Reasoning:** {{ $json.reasoning }}\n\n**Conversation ID:** {{ $json.conversation_id }}",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "id",
          "value": "YOUR_SLACK_CHANNEL_ID"
        },
        "otherOptions": {}
      },
      "credentials": {
        "slackApi": {
          "id": "YOUR_SLACK_CREDENTIAL_ID",
          "name": "Slack API"
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "96a7c0c2-5b4c-4f13-aa55-d93de00e9401",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1300,
        -180
      ],
      "parameters": {
        "color": 4,
        "width": 320,
        "height": 720,
        "content": "## 📨 1. Webhook接收"
      },
      "typeVersion": 1
    },
    {
      "id": "4153b386-0f82-4da0-9d76-c52824ced79e",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -960,
        -240
      ],
      "parameters": {
        "color": 6,
        "width": 540,
        "height": 780,
        "content": "## 🤖 2. AI分类引擎"
      },
      "typeVersion": 1
    },
    {
      "id": "65b8eff5-9782-403a-b01e-8f72f698ad1e",
      "name": "便签 2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -400,
        -300
      ],
      "parameters": {
        "color": 5,
        "height": 840,
        "content": "## 🔀 3. 条件路由"
      },
      "typeVersion": 1
    },
    {
      "id": "415d9545-aa7b-405b-9aa4-50a02e938602",
      "name": "便签 3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -140,
        -400
      ],
      "parameters": {
        "color": 3,
        "width": 260,
        "height": 940,
        "content": "## 📌 4. 操作处理 🧾"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "📨 Intercom Webhook": {
      "main": [
        [
          {
            "node": "🧠 Classifier – AI prompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "💼 Is Sales Request?": {
      "main": [
        [
          {
            "node": "📣 Slack – Notify Sales team",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GPT model (gpt-4o-mini)": {
      "ai_languageModel": [
        [
          {
            "node": "🧠 Classifier – AI prompt",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "📦 Is Product Request?": {
      "main": [
        [
          {
            "node": "🛍️ Create Product Task",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "🧾 Create Support Task": {
      "main": [
        []
      ]
    },
    "🛠️ Is Support Request?": {
      "main": [
        [
          {
            "node": "🧾 Create Support Task",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "🧮 Process Classification": {
      "main": [
        [
          {
            "node": "🛠️ Is Support Request?",
            "type": "main",
            "index": 0
          },
          {
            "node": "📦 Is Product Request?",
            "type": "main",
            "index": 0
          },
          {
            "node": "💼 Is Sales Request?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "🧠 Classifier – AI prompt": {
      "main": [
        [
          {
            "node": "🧮 Process Classification",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - AI 摘要总结, 多模态 AI

需要付费吗?

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

工作流信息
难度等级
中级
节点数量14
分类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 查看

分享此工作流