8
n8n 中文网amn8n.com

知识库自动更新

高级

这是一个Content Creation, Multimodal AI领域的自动化工作流,包含 24 个节点。主要使用 If, Code, Zendesk, EmailSend, ErrorTrigger 等节点。 将 Zendesk 操作指南工单同步到 Google Sheets 知识库

前置要求
  • Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "cgDm9vVlMd7iOO7R",
  "meta": {
    "instanceId": "8443f10082278c46aa5cf3acf8ff0f70061a2c58bce76efac814b16290845177"
  },
  "name": "知识库自动更新",
  "tags": [],
  "nodes": [
    {
      "id": "48804c68-423a-4268-bb12-95531adf0425",
      "name": "当点击\"执行工作流\"时",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -1504,
        1712
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "ca452dad-821d-491f-870e-72d97a903534",
      "name": "错误触发器",
      "type": "n8n-nodes-base.errorTrigger",
      "position": [
        -1280,
        2448
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "12c1be58-113b-4aa7-9278-da78048ce9a7",
      "name": "错误触发节点",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1648,
        2432
      ],
      "parameters": {
        "width": 320,
        "height": 328,
        "content": "## 错误触发节点"
      },
      "typeVersion": 1
    },
    {
      "id": "5449c962-eb4a-498f-9244-812a865bb0d4",
      "name": "格式化错误节点",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1264,
        2704
      ],
      "parameters": {
        "width": 320,
        "height": 384,
        "content": "## 格式化错误详情"
      },
      "typeVersion": 1
    },
    {
      "id": "dca1671e-2b16-479c-8dca-d9b58d8c2ccc",
      "name": "记录错误节点",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -944,
        2304
      ],
      "parameters": {
        "width": 320,
        "height": 488,
        "content": "## 错误记录表格"
      },
      "typeVersion": 1
    },
    {
      "id": "0d60a036-f2b3-495e-900e-3e3dc9f6af3f",
      "name": "电子邮件错误节点",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -256,
        2096
      ],
      "parameters": {
        "width": 320,
        "height": 424,
        "content": "## 电子邮件错误通知"
      },
      "typeVersion": 1
    },
    {
      "id": "4946b2e9-c107-4793-ada0-e95ffe07b966",
      "name": "成功摘要节点",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -544,
        2608
      ],
      "parameters": {
        "width": 320,
        "height": 332,
        "content": "## 成功摘要"
      },
      "typeVersion": 1
    },
    {
      "id": "4ee4440b-c840-4b6f-bece-1de4273cf79f",
      "name": "执行日志节点",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -880,
        2880
      ],
      "parameters": {
        "width": 320,
        "height": 460,
        "content": "## 执行日志表格"
      },
      "typeVersion": 1
    },
    {
      "id": "6f884973-d34f-4fac-b31b-dbead40cf933",
      "name": "工作流描述1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2160,
        1600
      ],
      "parameters": {
        "width": 526,
        "height": 336,
        "content": "## 工作流目的"
      },
      "typeVersion": 1
    },
    {
      "id": "c821dc37-e8cc-4e0f-b37c-284041f38fcc",
      "name": "触发说明1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1600,
        1360
      ],
      "parameters": {
        "width": 320,
        "height": 296,
        "content": "## 手动触发"
      },
      "typeVersion": 1
    },
    {
      "id": "b62bdc8f-683f-4025-9659-08e3f678a5dd",
      "name": "Zendesk 获取详情1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1440,
        1904
      ],
      "parameters": {
        "width": 320,
        "height": 312,
        "content": "## Zendesk 集成"
      },
      "typeVersion": 1
    },
    {
      "id": "1e144223-9445-4c91-8355-7a1b734b3539",
      "name": "筛选说明1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1200,
        1376
      ],
      "parameters": {
        "width": 320,
        "height": 296,
        "content": "## 筛选逻辑"
      },
      "typeVersion": 1
    },
    {
      "id": "672f5275-a2ac-4025-b125-d12e969e7186",
      "name": "用户详情目的1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -976,
        1888
      ],
      "parameters": {
        "width": 320,
        "height": 296,
        "content": "## 用户详情丰富"
      },
      "typeVersion": 1
    },
    {
      "id": "e88abaf3-a1b1-4fc7-a5cd-b17ada33241f",
      "name": "表格更新逻辑1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -768,
        1280
      ],
      "parameters": {
        "width": 320,
        "height": 384,
        "content": "## Google Sheets 更新"
      },
      "typeVersion": 1
    },
    {
      "id": "d031d1a6-f10b-45f4-9f12-e57894161b76",
      "name": "错误处理文档1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -400,
        1280
      ],
      "parameters": {
        "width": 400,
        "height": 400,
        "content": "## 🚨 错误处理与日志记录"
      },
      "typeVersion": 1
    },
    {
      "id": "01f922f2-c854-4550-98d8-02d00d331e23",
      "name": "仅筛选 HowTo 票据1",
      "type": "n8n-nodes-base.if",
      "position": [
        -1088,
        1712
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "cc47baeb-cdfb-4a6b-94ca-ef18c6450d9f",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.tags[0] }}",
              "rightValue": "=howto"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "767d5d14-50c1-4b0b-b851-0f4ddee830ae",
      "name": "获取请求者用户信息1",
      "type": "n8n-nodes-base.zendesk",
      "maxTries": 3,
      "position": [
        -864,
        1712
      ],
      "parameters": {
        "id": "={{ $json.requester_id }}",
        "resource": "user",
        "operation": "get"
      },
      "credentials": {
        "zendeskApi": {
          "id": "BQ61OjTaFfNPQ1bK",
          "name": "Zendesk account-anuj"
        }
      },
      "retryOnFail": true,
      "typeVersion": 1,
      "continueOnFail": true,
      "waitBetweenTries": 1000
    },
    {
      "id": "f04ef795-df09-4f97-9ecb-ab19679f6219",
      "name": "更新知识库表格1",
      "type": "n8n-nodes-base.googleSheets",
      "maxTries": 3,
      "position": [
        -640,
        1712
      ],
      "parameters": {
        "columns": {
          "value": {
            "Tag": "={{ $('Filter HowTo Tickets Only1').item.json.tags[0] || 'No tags' }}",
            "email": "={{ $json.email }}",
            "owner": "={{ $json.name }}",
            "Status": "={{ $('Filter HowTo Tickets Only1').item.json.status }}",
            "Ticket No.": "={{ $('Filter HowTo Tickets Only1').item.json.id }}",
            "Description": "={{ $('Filter HowTo Tickets Only1').item.json.description }}"
          },
          "schema": [
            {
              "id": "Ticket No.",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Ticket No.",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Description",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Description",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "owner",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "owner",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "email",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Tag",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Tag",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Description"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Utpt2Z8krX-29nE3_HAJVmm9yUp9NRcq-_P8JL1UqRk/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1Utpt2Z8krX-29nE3_HAJVmm9yUp9NRcq-_P8JL1UqRk",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Utpt2Z8krX-29nE3_HAJVmm9yUp9NRcq-_P8JL1UqRk/edit?usp=drivesdk",
          "cachedResultName": "Ticket status dummy"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "kpPEOLCGn963qpoh",
          "name": "automations@techdome.ai"
        }
      },
      "retryOnFail": true,
      "typeVersion": 4.6,
      "continueOnFail": true,
      "waitBetweenTries": 2000
    },
    {
      "id": "b5adbd34-2c67-4226-aa0a-10cb8f18b97f",
      "name": "获取所有 Zendesk 票据1",
      "type": "n8n-nodes-base.zendesk",
      "maxTries": 3,
      "position": [
        -1312,
        1712
      ],
      "parameters": {
        "options": {},
        "operation": "getAll",
        "returnAll": true
      },
      "credentials": {
        "zendeskApi": {
          "id": "BQ61OjTaFfNPQ1bK",
          "name": "Zendesk account-anuj"
        }
      },
      "retryOnFail": true,
      "typeVersion": 1,
      "waitBetweenTries": 1000
    },
    {
      "id": "641b189d-d542-4c82-8dca-3e72d1bb1152",
      "name": "格式化错误详情1",
      "type": "n8n-nodes-base.code",
      "position": [
        -1056,
        2448
      ],
      "parameters": {
        "jsCode": "// Extract error details and format for logging\nconst errorData = $input.item.json;\n\nconst formattedError = {\n  timestamp: new Date().toISOString(),\n  workflowName: $workflow.name,\n  executionId: $execution.id,\n  nodeName: errorData.node?.name || 'Unknown Node',\n  errorMessage: errorData.error?.message || 'Unknown Error',\n  errorType: errorData.error?.name || 'Error',\n  ticketId: errorData.error?.context?.itemIndex !== undefined \n    ? `Item ${errorData.error.context.itemIndex}` \n    : 'N/A',\n  stackTrace: errorData.error?.stack?.substring(0, 500) || 'No stack trace',\n  workflowStatus: 'FAILED',\n  severity: 'HIGH'\n};\n\nreturn { json: formattedError };"
      },
      "typeVersion": 2
    },
    {
      "id": "fd059320-ee35-47fc-bb65-3c7e9d907c95",
      "name": "记录错误到表格1",
      "type": "n8n-nodes-base.googleSheets",
      "notes": "Creates Error Log sheet if it doesn't exist",
      "position": [
        -784,
        2448
      ],
      "parameters": {
        "columns": {
          "value": {
            "Status": "={{ $json.workflowStatus }}",
            "Severity": "={{ $json.severity }}",
            "Node Name": "={{ $json.nodeName }}",
            "Timestamp": "={{ $json.timestamp }}",
            "Error Type": "={{ $json.errorType }}",
            "Stack Trace": "={{ $json.stackTrace }}",
            "Execution ID": "={{ $json.executionId }}",
            "Error Message": "={{ $json.errorMessage }}",
            "Workflow Name": "={{ $json.workflowName }}",
            "Ticket/Item ID": "={{ $json.ticketId }}"
          },
          "schema": [
            {
              "id": "Timestamp",
              "type": "string",
              "required": false,
              "displayName": "Timestamp"
            },
            {
              "id": "Workflow Name",
              "type": "string",
              "required": false,
              "displayName": "Workflow Name"
            },
            {
              "id": "Execution ID",
              "type": "string",
              "required": false,
              "displayName": "Execution ID"
            },
            {
              "id": "Node Name",
              "type": "string",
              "required": false,
              "displayName": "Node Name"
            },
            {
              "id": "Error Message",
              "type": "string",
              "required": false,
              "displayName": "Error Message"
            },
            {
              "id": "Error Type",
              "type": "string",
              "required": false,
              "displayName": "Error Type"
            },
            {
              "id": "Ticket/Item ID",
              "type": "string",
              "required": false,
              "displayName": "Ticket/Item ID"
            },
            {
              "id": "Stack Trace",
              "type": "string",
              "required": false,
              "displayName": "Stack Trace"
            },
            {
              "id": "Status",
              "type": "string",
              "required": false,
              "displayName": "Status"
            },
            {
              "id": "Severity",
              "type": "string",
              "required": false,
              "displayName": "Severity"
            }
          ],
          "mappingMode": "defineBelow"
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=1",
          "cachedResultName": "Error Log"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1Utpt2Z8krX-29nE3_HAJVmm9yUp9NRcq-_P8JL1UqRk",
          "cachedResultName": "Ticket status dummy"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "s4dP1fNuVZ2gWvs3",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "9ab36aa6-753b-48ff-8aae-102f0daea66b",
      "name": "发送错误通知1",
      "type": "n8n-nodes-base.emailSend",
      "notes": "Configure your SMTP credentials",
      "position": [
        -512,
        2448
      ],
      "webhookId": "c0a84dff-82d2-4618-ab81-5b7baab4555a",
      "parameters": {
        "options": {},
        "subject": "🚨 Knowledge Base Workflow Error - {{ $json.nodeName }}",
        "toEmail": "team@yourcompany.com",
        "fromEmail": "workflow-errors@yourcompany.com"
      },
      "typeVersion": 2.1
    },
    {
      "id": "ffaa5350-2709-44de-b6eb-d3554053d164",
      "name": "成功摘要1",
      "type": "n8n-nodes-base.code",
      "position": [
        -416,
        1712
      ],
      "parameters": {
        "jsCode": "// Log successful execution summary\nconst items = $input.all();\n\nconst summary = {\n  timestamp: new Date().toISOString(),\n  workflowName: $workflow.name,\n  executionId: $execution.id,\n  status: 'SUCCESS',\n  ticketsProcessed: items.length,\n  message: `Successfully processed ${items.length} tickets`\n};\n\nreturn { json: summary };"
      },
      "typeVersion": 2
    },
    {
      "id": "3ca07889-3c23-42bf-9ef0-7f6241b8c6c4",
      "name": "记录成功执行1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -192,
        1712
      ],
      "parameters": {
        "columns": {
          "value": {
            "Status": "={{ $json.status }}",
            "Message": "={{ $json.message }}",
            "Timestamp": "={{ $json.timestamp }}",
            "Execution ID": "={{ $json.executionId }}",
            "Workflow Name": "={{ $json.workflowName }}",
            "Tickets Processed": "={{ $json.ticketsProcessed }}"
          },
          "schema": [
            {
              "id": "Timestamp",
              "type": "string",
              "required": false,
              "displayName": "Timestamp"
            },
            {
              "id": "Workflow Name",
              "type": "string",
              "required": false,
              "displayName": "Workflow Name"
            },
            {
              "id": "Execution ID",
              "type": "string",
              "required": false,
              "displayName": "Execution ID"
            },
            {
              "id": "Status",
              "type": "string",
              "required": false,
              "displayName": "Status"
            },
            {
              "id": "Tickets Processed",
              "type": "number",
              "required": false,
              "displayName": "Tickets Processed"
            },
            {
              "id": "Message",
              "type": "string",
              "required": false,
              "displayName": "Message"
            }
          ],
          "mappingMode": "defineBelow"
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=2",
          "cachedResultName": "Execution Log"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1Utpt2Z8krX-29nE3_HAJVmm9yUp9NRcq-_P8JL1UqRk",
          "cachedResultName": "Ticket status dummy"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "s4dP1fNuVZ2gWvs3",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.6
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "5e36abd5-9ff1-48ad-b877-f26093d34fe1",
  "connections": {
    "Error Trigger": {
      "main": [
        [
          {
            "node": "Format Error Details1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Success Summary1": {
      "main": [
        [
          {
            "node": "Log Successful Execution1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log Error to Sheet1": {
      "main": [
        [
          {
            "node": "Send Error Notification1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Error Details1": {
      "main": [
        [
          {
            "node": "Log Error to Sheet1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Requester User Info1": {
      "main": [
        [
          {
            "node": "Update Knowledge Base Sheet1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch All Zendesk Tickets1": {
      "main": [
        [
          {
            "node": "Filter HowTo Tickets Only1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter HowTo Tickets Only1": {
      "main": [
        [
          {
            "node": "Get Requester User Info1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Knowledge Base Sheet1": {
      "main": [
        [
          {
            "node": "Success Summary1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking 'Execute workflow'": {
      "main": [
        [
          {
            "node": "Fetch All Zendesk Tickets1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 内容创作, 多模态 AI

需要付费吗?

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

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

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

作者
Rahul Joshi

Rahul Joshi

@rahul08

Rahul Joshi is a seasoned technology leader specializing in the n8n automation tool and AI-driven workflow automation. With deep expertise in building open-source workflow automation and self-hosted automation platforms, he helps organizations eliminate manual processes through intelligent n8n ai agent automation solutions.

外部链接
在 n8n.io 查看

分享此工作流