8
n8n 中文网amn8n.com

构建利用现有支持门户的IT支持助手聊天机器人

高级

这是一个Support领域的自动化工作流,包含 16 个节点。主要使用 If, Set, SplitOut, Aggregate, HttpRequest 等节点。 构建利用现有支持门户的IT支持助手聊天机器人

前置要求
  • 可能需要目标 API 的认证凭证
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "408f9fb9940c3cb18ffdef0e0150fe342d6e655c3a9fac21f0f644e8bedabcd9",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "8f203423-b063-4918-a6ec-dad3ac7d1a20",
      "name": "当聊天消息接收时",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        860,
        -100
      ],
      "webhookId": "c82193c7-163c-4556-942f-81c80037e0ea",
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "d9f2e90f-128b-458b-b3cf-79db2ec08633",
      "name": "OpenAI 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1000,
        100
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "8gccIjcuf3gvaoEr",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "4f752502-8589-4e31-bbe1-4b8395e7325a",
      "name": "简单记忆",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        1160,
        100
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "61ca5a4b-3661-4330-ac4c-e09e75dd764c",
      "name": "Acuity 支持搜索 API",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1840,
        80
      ],
      "parameters": {
        "url": "https://2al21hjwoz-dsn.algolia.net/1/indexes/*/queries?x-algolia-agent=Algolia%20for%20JavaScript%20(3.35.1)%3B%20Browser%20(lite)%3B%20instantsearch.js%201.12.1%3B%20Zendesk%20Integration%20(2.32.0)%3B%20JS%20Helper%20(2.28.1)&x-algolia-application-id=2AL21HJWOZ&x-algolia-api-key=c3c07dd7fb575008575163c085a62b92",
        "method": "POST",
        "options": {},
        "jsonBody": "={{\n{\n  \"requests\":[\n    {\n      \"indexName\":\"Zendesk 4-25\",\n      \"params\": \"query=\" + $json.query + \"&hitsPerPage=5&page=0&facets=%5B%22locale.locale%22%2C%22label_names%22%2C%22category.title%22%5D&tagFilters=&facetFilters=%5B%22locale.locale%3Aen-us%22%5D\"\n    }\n  ]\n}\n}}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Accept-Language",
              "value": "en"
            },
            {
              "name": "Cache-Control",
              "value": "no-cache"
            },
            {
              "name": "Connection",
              "value": "keep-alive"
            },
            {
              "name": "Origin",
              "value": "https://help.acuityscheduling.com"
            },
            {
              "name": "Referer",
              "value": "https://help.acuityscheduling.com/"
            },
            {
              "name": "User-Agent",
              "value": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36"
            },
            {
              "name": "accept",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "8ecd6287-982c-4754-9300-4c6d54202273",
      "name": "提取相关字段",
      "type": "n8n-nodes-base.set",
      "position": [
        2560,
        80
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "a6973f14-e17d-46b0-9c5b-c6d9967dbf99",
              "name": "title",
              "type": "string",
              "value": "={{ $json.title }}"
            },
            {
              "id": "88092adb-7f63-4daa-8c7a-cbd85750e180",
              "name": "body",
              "type": "string",
              "value": "={{ $json.body_safe }}"
            },
            {
              "id": "12718897-a73d-4c3a-bcfb-b17c890458ec",
              "name": "url",
              "type": "string",
              "value": "=https://help.acuityscheduling.com/hc/en-us/articles/{{ $json.id }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "bf5855b2-8e73-4c29-b277-adee63e8bf59",
      "name": "结果转项目",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        2360,
        80
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "results[0].hits"
      },
      "typeVersion": 1
    },
    {
      "id": "c9329816-bbe0-4de7-b6fb-fa87783f6a5c",
      "name": "有结果吗?",
      "type": "n8n-nodes-base.if",
      "position": [
        2040,
        80
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "f5d7e890-f00a-4252-8588-c6662e71790c",
              "operator": {
                "type": "array",
                "operation": "lengthGt",
                "rightType": "number"
              },
              "leftValue": "={{ $json.results[0]?.hits ?? [] }}",
              "rightValue": 0
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "860a178a-d500-4291-acfc-9c9f4638d6c7",
      "name": "空响应",
      "type": "n8n-nodes-base.set",
      "position": [
        2360,
        260
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "0ce36950-83d9-4964-8763-f329a4cda5a8",
              "name": "response",
              "type": "array",
              "value": "[]"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "c9f2a08b-88c2-4287-994c-f7af58e98301",
      "name": "聚合响应",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        2760,
        80
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData",
        "destinationFieldName": "response"
      },
      "typeVersion": 1
    },
    {
      "id": "5f1f8874-7022-4ea1-b0a7-de42c4f800a1",
      "name": "知识库工具",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        1320,
        100
      ],
      "parameters": {
        "name": "acuity_support_search",
        "workflowId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $workflow.id }}"
        },
        "description": "调用此工具查询 AcuityScheduling 支持中心搜索 API",
        "workflowInputs": {
          "value": {
            "query": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('query', ``, 'string') }}"
          },
          "schema": [
            {
              "id": "query",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "query",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "3913ddaa-852e-4463-a072-fe8be22bc184",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        720,
        -300
      ],
      "parameters": {
        "color": 7,
        "width": 780,
        "height": 580,
        "content": "## 1. 带知识库工具的简单聊天机器人"
      },
      "typeVersion": 1
    },
    {
      "id": "e24d75f9-6d3c-4bca-b67f-33737ee969ee",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1540,
        -140
      ],
      "parameters": {
        "color": 7,
        "width": 700,
        "height": 440,
        "content": "## 2. 使用现有帮助门户搜索"
      },
      "typeVersion": 1
    },
    {
      "id": "f5feebf1-fd6d-4558-a868-7ea4f852386c",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2260,
        -140
      ],
      "parameters": {
        "color": 7,
        "width": 720,
        "height": 600,
        "content": "## 3. 清理结果以优化令牌使用"
      },
      "typeVersion": 1
    },
    {
      "id": "8132de59-9b47-460a-9cb9-f2ec83123a3f",
      "name": "AcuityScheduling 支持聊天机器人",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1060,
        -100
      ],
      "parameters": {
        "options": {
          "systemMessage": "You are a support assistant for the SaaS company, AcuityScheduling.com. Your task is to openly help the user with any questions regarding the AcuityScheduling service however, you are restricted to only this service. If the user asks questions unrelated to AcuityScheduling, you may ask them for clarification, explain you are not able to help them out of scope or redirect them to support@acuityScheduling.com. Be factual in your answer, tap into the resources or tools available and do not rely on your training data (which might be out-of-date). When returning a response to the user, you are encouraged to share the URL of the knowledgebase page where the user can explore the documentation for themselves."
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "564bde38-25ea-4969-aa3f-bff66ec2782f",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        260,
        -840
      ],
      "parameters": {
        "width": 440,
        "height": 1120,
        "content": "## 试试看!"
      },
      "typeVersion": 1
    },
    {
      "id": "a918718f-915d-4d5c-a7c2-a015b8a84bbb",
      "name": "知识库工具子工作流",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        1620,
        80
      ],
      "parameters": {
        "workflowInputs": {
          "values": [
            {
              "name": "query"
            }
          ]
        }
      },
      "typeVersion": 1.1
    }
  ],
  "pinData": {},
  "connections": {
    "Has Results?": {
      "main": [
        [
          {
            "node": "Results to Items",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Empty Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AcuityScheduling Support Chatbot",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Results to Items": {
      "main": [
        [
          {
            "node": "Extract Relevant Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AcuityScheduling Support Chatbot",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Knowledgebase Tool": {
      "ai_tool": [
        [
          {
            "node": "AcuityScheduling Support Chatbot",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Extract Relevant Fields": {
      "main": [
        [
          {
            "node": "Aggregate Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Acuity Support Search API": {
      "main": [
        [
          {
            "node": "Has Results?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "AcuityScheduling Support Chatbot",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "KnowledgeBase Tool Subworkflow": {
      "main": [
        [
          {
            "node": "Acuity Support Search API",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 客户支持

需要付费吗?

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

工作流信息
难度等级
高级
节点数量16
分类1
节点类型12
难度说明

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

作者
Jimleuk

Jimleuk

@jimleuk

Freelance consultant based in the UK specialising in AI-powered automations. I work with select clients tackling their most challenging projects. For business enquiries, send me an email at hello@jimle.uk LinkedIn: https://www.linkedin.com/in/jimleuk/ X/Twitter: https://x.com/jimle_uk

外部链接
在 n8n.io 查看

分享此工作流