8
n8n 中文网amn8n.com

使用GPT-4分析和Slack警报对Zendesk工单进行优先级排序

高级

这是一个AI Summarization, Multimodal AI领域的自动化工作流,包含 18 个节点。主要使用 If, Set, Code, Slack, Webhook 等节点。 使用GPT-4分析和Slack警报对Zendesk工单进行优先级排序

前置要求
  • Slack Bot Token 或 Webhook URL
  • HTTP Webhook 端点(n8n 会自动生成)
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "c6b6fdb08eba7fde8a658947ddccccb48e3919f46ccf2b3d46c8de41ca414379",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "6d945286-6889-45c1-9f64-be5c704f9b87",
      "name": "Zendesk Webhook 触发器",
      "type": "n8n-nodes-base.webhook",
      "position": [
        660,
        40
      ],
      "webhookId": "auto-generate",
      "parameters": {
        "path": "zendesk-webhook",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "typeVersion": 1
    },
    {
      "id": "52dc8682-3625-414b-a298-e5c9a2516d4e",
      "name": "工作流说明",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        180,
        -200
      ],
      "parameters": {
        "color": 4,
        "width": 432,
        "height": 464,
        "content": "## 🎫 Zendesk AI 工单优先级排序工作流"
      },
      "typeVersion": 1
    },
    {
      "id": "16a1998f-dc1a-42a2-8a37-996f34172dee",
      "name": "提取数据说明",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        680,
        -200
      ],
      "parameters": {
        "width": 280,
        "content": "📝 **步骤 1:提取工单数据**"
      },
      "typeVersion": 1
    },
    {
      "id": "58eef0e2-c7e3-4fee-a00c-0bd17aff3c2f",
      "name": "提取工单数据",
      "type": "n8n-nodes-base.set",
      "position": [
        900,
        40
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "9ffd84f6-7b57-413f-8863-f236304fad87",
      "name": "AI 分析说明",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1000,
        -200
      ],
      "parameters": {
        "width": 280,
        "height": 180,
        "content": "🤖 **步骤 2:AI 分析**"
      },
      "typeVersion": 1
    },
    {
      "id": "7d0a3e7c-2634-4fbc-9706-02bdac34e80c",
      "name": "使用 OpenAI 分析工单",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        1140,
        40
      ],
      "parameters": {
        "resource": "chat"
      },
      "typeVersion": 1.3
    },
    {
      "id": "e537d024-ce4d-480e-bfc1-33ff656b3f64",
      "name": "处理响应说明",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1300,
        -200
      ],
      "parameters": {
        "width": 280,
        "content": "⚙️ **步骤 3:处理 AI 响应**"
      },
      "typeVersion": 1
    },
    {
      "id": "eb826f0a-1d6e-4e0f-ad8f-91da5fcfb442",
      "name": "处理 AI 分析",
      "type": "n8n-nodes-base.code",
      "position": [
        1380,
        40
      ],
      "parameters": {
        "jsCode": "// Parse OpenAI response and process urgency data\nconst response = $input.first();\nlet aiAnalysis;\n\ntry {\n  // Extract JSON from AI response\n  const content = response.json.choices[0].message.content;\n  aiAnalysis = JSON.parse(content);\n} catch (error) {\n  // Fallback if JSON parsing fails\n  aiAnalysis = {\n    urgency_score: 3,\n    reasoning: \"Failed to parse AI response, using default priority\",\n    suggested_priority: \"normal\",\n    key_indicators: [],\n    estimated_impact: \"medium\",\n    recommended_response_time: \"4\"\n  };\n}\n\n// Determine if Slack notification needed (urgency 4 or 5)\nconst needsSlackNotification = aiAnalysis.urgency_score >= 4;\n\n// Map urgency score to Zendesk priority\nlet zendeskPriority;\nswitch(aiAnalysis.urgency_score) {\n  case 5:\n    zendeskPriority = \"urgent\";\n    break;\n  case 4:\n    zendeskPriority = \"high\";\n    break;\n  case 3:\n    zendeskPriority = \"normal\";\n    break;\n  case 2:\n    zendeskPriority = \"low\";\n    break;\n  default:\n    zendeskPriority = \"normal\";\n}\n\n// Prepare output data\nreturn {\n  json: {\n    ticket_id: $('Extract Ticket Data').first().json.ticket_id,\n    ticket_subject: $('Extract Ticket Data').first().json.ticket_subject,\n    customer_name: $('Extract Ticket Data').first().json.customer_name,\n    customer_email: $('Extract Ticket Data').first().json.customer_email,\n    urgency_score: aiAnalysis.urgency_score,\n    ai_reasoning: aiAnalysis.reasoning,\n    suggested_priority: aiAnalysis.suggested_priority,\n    zendesk_priority: zendeskPriority,\n    key_indicators: aiAnalysis.key_indicators,\n    estimated_impact: aiAnalysis.estimated_impact,\n    recommended_response_time: aiAnalysis.recommended_response_time,\n    needs_slack_notification: needsSlackNotification,\n    analysis_timestamp: new Date().toISOString()\n  }\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "c079c4a4-ec70-4738-86d5-cef2c18cbfdb",
      "name": "更新 Zendesk 说明",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1620,
        -200
      ],
      "parameters": {
        "width": 280,
        "height": 140,
        "content": "🏷️ **步骤 4:更新 Zendesk**"
      },
      "typeVersion": 1
    },
    {
      "id": "9b212cff-afe1-48e4-877b-b46a0a77b676",
      "name": "更新 Zendesk 工单",
      "type": "n8n-nodes-base.zendesk",
      "position": [
        1620,
        40
      ],
      "parameters": {
        "id": "={{ $json.ticket_id }}",
        "operation": "update",
        "updateFields": {
          "tags": "ai-analyzed,urgency-{{ $json.urgency_score }},{{ $json.estimated_impact }}-impact"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "e93dfce0-fbd7-42be-abdb-e2001be5fb3f",
      "name": "检查是否为高优先级",
      "type": "n8n-nodes-base.if",
      "position": [
        1860,
        40
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "needs_notification",
              "operator": {
                "type": "boolean",
                "operation": "equal"
              },
              "leftValue": "={{ $json.needs_slack_notification }}",
              "rightValue": true
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "12cb1668-828c-4e99-b204-d5cdaa663d1f",
      "name": "Slack 通知说明",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1920,
        -180
      ],
      "parameters": {
        "width": 280,
        "content": "🔔 **步骤 5:Slack 通知**"
      },
      "typeVersion": 1
    },
    {
      "id": "7be5729c-1b6b-4f0b-a9e6-1092a9106529",
      "name": "发送紧急警报到 Slack",
      "type": "n8n-nodes-base.slack",
      "position": [
        2060,
        0
      ],
      "webhookId": "2cfd90d6-1cdf-40cd-97f3-f4140c50ce61",
      "parameters": {
        "text": "🚨 **HIGH PRIORITY TICKET ALERT**",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "name",
          "value": "={{ $('Configuration Variables').first().json.SLACK_CHANNEL }}"
        },
        "otherOptions": {}
      },
      "typeVersion": 2.1
    },
    {
      "id": "d563ed0f-46be-4fb4-9c1a-3bd42fe949bc",
      "name": "响应说明",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2260,
        -180
      ],
      "parameters": {
        "width": 280,
        "content": "✅ **步骤 6:完成响应**"
      },
      "typeVersion": 1
    },
    {
      "id": "b56c81c7-b312-4f00-9903-8abefca85de0",
      "name": "Webhook 响应 - 成功",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        2300,
        0
      ],
      "parameters": {
        "options": {},
        "respondWith": "json",
        "responseBody": "{\n  \"status\": \"success\",\n  \"message\": \"Ticket {{ $('Extract Ticket Data').first().json.ticket_id }} processed successfully\",\n  \"urgency_score\": {{ $json.urgency_score }},\n  \"priority_assigned\": \"{{ $json.zendesk_priority }}\",\n  \"slack_notification_sent\": {{ $json.needs_slack_notification }},\n  \"processed_at\": \"{{ $json.analysis_timestamp }}\"\n}"
      },
      "typeVersion": 1
    },
    {
      "id": "7138e8b6-547e-4001-bb22-fef7d3f3ff6c",
      "name": "Webhook 响应 - 正常",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        2300,
        120
      ],
      "parameters": {
        "options": {},
        "respondWith": "json",
        "responseBody": "{\n  \"status\": \"success\",\n  \"message\": \"Ticket {{ $('Extract Ticket Data').first().json.ticket_id }} processed - normal priority\",\n  \"urgency_score\": {{ $json.urgency_score }},\n  \"priority_assigned\": \"{{ $json.zendesk_priority }}\",\n  \"slack_notification_sent\": false,\n  \"processed_at\": \"{{ $json.analysis_timestamp }}\"\n}"
      },
      "typeVersion": 1
    },
    {
      "id": "3ea300f9-6418-4f7e-9974-4b5371e6889c",
      "name": "配置变量",
      "type": "n8n-nodes-base.set",
      "position": [
        660,
        240
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "8382f894-763b-4e22-84b9-40dcbaec5195",
      "name": "设置说明",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        900,
        240
      ],
      "parameters": {
        "color": 6,
        "width": 400,
        "height": 320,
        "content": "⚙️ **需要配置**"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "Extract Ticket Data": {
      "main": [
        [
          {
            "node": "Analyze Ticket with OpenAI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Process AI Analysis": {
      "main": [
        [
          {
            "node": "Update Zendesk Ticket",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Zendesk Ticket": {
      "main": [
        [
          {
            "node": "Check if High Priority",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check if High Priority": {
      "main": [
        [
          {
            "node": "Send Urgent Alert to Slack",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Webhook Response - Normal",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Configuration Variables": {
      "main": [
        [
          {
            "node": "Extract Ticket Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Zendesk Webhook Trigger": {
      "main": [
        [
          {
            "node": "Configuration Variables",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analyze Ticket with OpenAI": {
      "main": [
        [
          {
            "node": "Process AI Analysis",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Urgent Alert to Slack": {
      "main": [
        [
          {
            "node": "Webhook Response - Success",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

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

需要付费吗?

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

工作流信息
难度等级
高级
节点数量18
分类2
节点类型9
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

作者
PhilanthropEAK Automation

PhilanthropEAK Automation

@philanthropeak

AI-powered automation specialist building practical, accessible workflows for businesses of all sizes. We design solutions that save time, cut errors, and boost customer experience—without complexity. Specialties include AI-driven customer support, social media scheduling, e-commerce automation, beginner-friendly workflows, and free templates. Every workflow is tested, documented, and ready to deliver real business value.

外部链接
在 n8n.io 查看

分享此工作流