8
n8n 中文网amn8n.com

基于Gemini AI的Zoho Desk支持工单自动分类

中级

这是一个自动化工作流,包含 14 个节点。主要使用 Code, SplitOut, HttpRequest, ManualTrigger, ChainLlm 等节点。 基于Gemini AI的Zoho Desk支持工单自动分类

前置要求
  • 可能需要目标 API 的认证凭证

分类

-
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "42450f423595f391b7c323eb4191c0bc81df9f6de5483a12f34f76cb4146556c",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "f34db366-b13a-43ac-8d4e-a52e3a7243dd",
      "name": "点击\"执行工作流\"时",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -432,
        -256
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "e2386bfd-2803-4f40-8744-0c86aecfb167",
      "name": "OpenRouter Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        1200,
        -96
      ],
      "parameters": {
        "model": "google/gemini-2.5-flash-lite-preview-09-2025",
        "options": {}
      },
      "credentials": {
        "openRouterApi": {
          "id": "aCsTDT5LGS5D8Ndl",
          "name": "OpenRouter account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "fe6a1452-471c-4e2b-8c64-7d32e35bb33b",
      "name": "筛选分类为空的记录",
      "type": "n8n-nodes-base.code",
      "position": [
        496,
        -256
      ],
      "parameters": {
        "jsCode": "// Filter items where classification is null\nconst filteredItems = $input.all().filter(item => item.json.classification === null);\n\nreturn filteredItems;\n"
      },
      "typeVersion": 2
    },
    {
      "id": "4153b802-af64-4ec1-b55e-2dcd41a8f038",
      "name": "获取会话线程",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueRegularOutput",
      "position": [
        720,
        -256
      ],
      "parameters": {
        "url": "=https://desk.zoho.eu/api/v1/tickets/{{ $json.id }}/threads",
        "options": {},
        "sendQuery": true,
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "oAuth2Api",
        "queryParameters": {
          "parameters": [
            {
              "name": "sortBy",
              "value": "sendDateTime"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {}
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "f41d94a5-3070-4874-a72d-2ff28af6e4ca",
      "name": "获取首个会话线程",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueRegularOutput",
      "position": [
        944,
        -256
      ],
      "parameters": {
        "url": "=https://desk.zoho.eu/api/v1/tickets/{{ $('Filter classification = null').item.json.id }}/threads/{{ $json.data[0].id }}",
        "options": {},
        "sendQuery": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "oAuth2Api",
        "queryParameters": {
          "parameters": [
            {
              "name": "include",
              "value": "plainText"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "dba88e6c-e555-42d6-b0b6-b02c2f5ef977",
      "name": "分类处理",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        1168,
        -256
      ],
      "parameters": {
        "text": "=**Role:** You are an expert support ticket classification system.\n\n**Task:** Read the provided ticket title and request body. Based on the content, classify the ticket into one of the following categories. Respond with only the single, most appropriate category name.\n\n**Categories:**\n• Content\n• Contract\n• Invoice\n• Featured Products\n• Affiliate-Partner\n• Bug\n• Feature\n• Other\n\n---\n\n**Ticket Title:**\n{{ $('Filter classification = null').item.json.subject }}\n\n**Ticket Request:**\n{{ $json.plainText }}\n\n**Category:**",
        "batching": {},
        "promptType": "define"
      },
      "typeVersion": 1.7
    },
    {
      "id": "b14e73ba-0046-4395-9e26-f80014a3332a",
      "name": "更新工单",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueRegularOutput",
      "position": [
        1600,
        -256
      ],
      "parameters": {
        "url": "=https://desk.zoho.eu/api/v1/tickets/{{ $('Filter classification = null').item.json.id }}",
        "method": "PUT",
        "options": {},
        "sendBody": true,
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "classification",
              "value": "={{ $json.text }}"
            }
          ]
        },
        "genericAuthType": "oAuth2Api"
      },
      "typeVersion": 4.2
    },
    {
      "id": "62d15c70-77fb-4947-a808-29e0c366e957",
      "name": "获取所有工单",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueRegularOutput",
      "position": [
        48,
        -256
      ],
      "parameters": {
        "url": "https://desk.zoho.eu/api/v1/tickets/search",
        "options": {
          "pagination": {
            "pagination": {
              "parameters": {
                "parameters": [
                  {
                    "name": "from",
                    "value": "={{ $pageCount * 100 }}"
                  }
                ]
              },
              "completeExpression": "={{ $response.body.data.length === 0 || $response.body.data.length < 100 }}",
              "paginationCompleteWhen": "other"
            }
          }
        },
        "sendQuery": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "oAuth2Api",
        "queryParameters": {
          "parameters": [
            {
              "name": "limit",
              "value": "100"
            },
            {
              "name": "sortBy",
              "value": "createdTime"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "4e551054-ffb2-4d4b-ba37-3b24045c9971",
      "name": "拆分工单",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        272,
        -256
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "data"
      },
      "typeVersion": 1
    },
    {
      "id": "8e29f267-2cae-4429-8914-a58487d45840",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -576,
        -784
      ],
      "parameters": {
        "width": 368,
        "height": 480,
        "content": "## 🎯 工作流用途"
      },
      "typeVersion": 1
    },
    {
      "id": "4b6d79df-3535-4d37-b959-64f5642817eb",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -80,
        -784
      ],
      "parameters": {
        "color": 7,
        "width": 368,
        "height": 480,
        "content": "## 📥 带分页的工单获取"
      },
      "typeVersion": 1
    },
    {
      "id": "a019181e-7023-4002-b106-2635cf4ccf3d",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        384,
        -784
      ],
      "parameters": {
        "color": 7,
        "width": 320,
        "height": 480,
        "content": "## 🔍 筛选逻辑"
      },
      "typeVersion": 1
    },
    {
      "id": "33dbe4e2-6f94-41f9-bc39-2b57c3df728e",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1104,
        -784
      ],
      "parameters": {
        "color": 7,
        "width": 368,
        "height": 480,
        "content": "## 🤖 AI 分类类别"
      },
      "typeVersion": 1
    },
    {
      "id": "57d25075-78d6-42cc-8415-9a51c8c7883e",
      "name": "便签5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1536,
        -512
      ],
      "parameters": {
        "color": 7,
        "width": 272,
        "height": 208,
        "content": "## 💾 保存分类结果"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "Classify": {
      "main": [
        [
          {
            "node": "Update Ticket",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get threads": {
      "main": [
        [
          {
            "node": "Get first thread",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Tickets": {
      "main": [
        [
          {
            "node": "Filter classification = null",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get first thread": {
      "main": [
        [
          {
            "node": "Classify",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch All Tickets": {
      "main": [
        [
          {
            "node": "Split Tickets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenRouter Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Classify",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Filter classification = null": {
      "main": [
        [
          {
            "node": "Get threads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Fetch All Tickets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级

需要付费吗?

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

工作流信息
难度等级
中级
节点数量14
分类-
节点类型7
难度说明

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

作者
Julian Kaiser

Julian Kaiser

@jksr

Full Stack Developer turned AI & Automation Engineer, implementing intelligent solutions with custom code, LLMs & n8n. Use my link to book a free 30-minute call to discuss your AI challenges and see if my services might be a good fit for your needs.

外部链接
在 n8n.io 查看

分享此工作流