8
n8n 中文网amn8n.com

使用 AI 分诊自动化 Google Forms 的客户支持回复

高级

这是一个Ticket Management, AI Summarization领域的自动化工作流,包含 22 个节点。主要使用 If, Set, Code, Gmail, Slack 等节点。 使用GPT-4o-mini AI分诊的自动化Google Forms和Gmail客户支持

前置要求
  • Google 账号和 Gmail API 凭证
  • Slack Bot Token 或 Webhook URL
  • Google Sheets API 凭证
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "4n8IO7lfpLukkhLP",
  "meta": {
    "instanceId": "062f0e1ec3617ffb26cbc1b3c3518f28f3e57f08ddc210c471f532bb0bd6cf07"
  },
  "name": "使用 AI 分诊自动化 Google Forms 的客户支持回复",
  "tags": [],
  "nodes": [
    {
      "id": "00ee0984-b75a-4eda-939d-db882cee466d",
      "name": "Google Form 回复触发器",
      "type": "n8n-nodes-base.googleSheetsTrigger",
      "position": [
        -576,
        352
      ],
      "parameters": {
        "event": "rowAdded",
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        }
      },
      "typeVersion": 1
    },
    {
      "id": "1ef2d3c8-4431-4c88-9f15-09be5d27c6f0",
      "name": "映射表单列名",
      "type": "n8n-nodes-base.set",
      "position": [
        -240,
        352
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "id-1",
              "name": "emailColumnName",
              "type": "string",
              "value": "Email Address"
            },
            {
              "id": "id-2",
              "name": "inquiryColumnName",
              "type": "string",
              "value": "Inquiry"
            },
            {
              "id": "id-3",
              "name": "nameColumnName",
              "type": "string",
              "value": "Name"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "dd8030ab-2052-4789-bb69-95d577d65eba",
      "name": "使用 AI 分诊进行分析",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        -16,
        352
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {},
        "responses": {
          "values": [
            {
              "content": "=You are an expert customer support triage system with deep understanding of multiple languages and cultural context.\n\nAnalyze this customer inquiry:\n\nCustomer Name: {{$json[\"Name\"]}}\nCustomer Email: {{$json[\"Email Address\"]}}\nInquiry: {{$json.inquiry}}\n\nURGENCY CLASSIFICATION RULES (be strict):\n\nHIGH urgency - Use when ANY of these apply:\n- Product is broken/damaged/defective\n- Words indicating immediate need: immediately, urgent, ASAP\n- Customer explicitly states they are troubled or frustrated\n- Complaints or angry tone\n- Request for refund/replacement/exchange\n- Service failure or system down\n- Time-sensitive issues\n\nMEDIUM urgency - Use when:\n- General questions about product usage\n- Feature inquiries or clarifications\n- Manual/documentation questions\n- Non-urgent support requests\n- Neutral tone inquiries\n\nLOW urgency - Use when:\n- General information requests\n- Compliments or positive feedback\n- Future product inquiries\n- Casual questions with no time pressure\n\nCATEGORIES:\n- technical: Software bugs, technical issues, errors, login problems\n- sales: Pricing, product information, purchase inquiries\n- support: How-to questions, usage help, troubleshooting\n- billing: Payment issues, invoices, refunds\n- general: Everything else\n\nSENTIMENT:\n- negative: Complaints, problems, dissatisfaction, frustrated tone\n- neutral: Questions, information requests\n- positive: Compliments, satisfaction, thank you messages\n\nReturn ONLY valid JSON in this format (no markdown, no code blocks):\n{\n  \"urgency\": \"low\" | \"medium\" | \"high\",\n  \"category\": \"technical\" | \"sales\" | \"support\" | \"billing\" | \"general\",\n  \"sentiment\": \"positive\" | \"neutral\" | \"negative\",\n  \"keywords\": [\"keyword1\", \"keyword2\"],\n  \"summary\": \"One sentence summary\"\n}"
            }
          ]
        },
        "builtInTools": {}
      },
      "typeVersion": 2
    },
    {
      "id": "7022d016-142f-40f0-ae43-876b609f7897",
      "name": "解析 AI 分析结果",
      "type": "n8n-nodes-base.code",
      "position": [
        336,
        352
      ],
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "// Parse AI analysis results\nconst allData = $input.item.json;\n\nlet analysis = {\n  urgency: 'medium',\n  category: 'general',\n  sentiment: 'neutral',\n  keywords: [],\n  summary: ''\n};\n\nif (allData.output && Array.isArray(allData.output) && allData.output.length > 0) {\n  const outputItem = allData.output[0];\n  if (outputItem.content && Array.isArray(outputItem.content) && outputItem.content.length > 0) {\n    const aiResponse = outputItem.content[0].text || '{}';\n    try {\n      analysis = JSON.parse(aiResponse);\n    } catch (e) {\n      console.log('Failed to parse AI response:', aiResponse);\n    }\n  }\n}\n\n// Get original form data\nconst workflowConfig = $('Map Form Column Names').first().json;\nconst emailColumnName = workflowConfig.emailColumnName || 'Email Address';\nconst inquiryColumnName = workflowConfig.inquiryColumnName || 'Inquiry';\nconst nameColumnName = workflowConfig.nameColumnName || 'Name';\n\nreturn {\n  email: workflowConfig[emailColumnName] || '',\n  inquiry: workflowConfig[inquiryColumnName] || '',\n  name: workflowConfig[nameColumnName] || '',\n  urgency: analysis.urgency,\n  category: analysis.category,\n  sentiment: analysis.sentiment,\n  keywords: analysis.keywords,\n  summary: analysis.summary,\n  timestamp: new Date().toISOString()\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "bf80a552-17a8-445d-bdb7-288ad0d8bb25",
      "name": "按优先级路由",
      "type": "n8n-nodes-base.switch",
      "position": [
        560,
        336
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "High Priority",
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.urgency }}",
                    "rightValue": "high"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Medium Priority",
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.urgency }}",
                    "rightValue": "medium"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Low Priority",
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.urgency }}",
                    "rightValue": "low"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "7ca42752-5260-4ddc-abd3-a2e52ba53162",
      "name": "生成紧急回复",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        768,
        240
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {},
        "responses": {
          "values": [
            {
              "content": "=Create a polite, professional, and URGENT response email to this HIGH PRIORITY inquiry.\n\nCustomer Name: {{$json.name}}\nInquiry Category: {{$json.category}}\nSentiment: {{$json.sentiment}}\nInquiry: {{$json.inquiry}}\n\nIMPORTANT INSTRUCTIONS:\n- Acknowledge the urgency and apologize if negative sentiment detected\n- Provide immediate next steps\n- Include a commitment to fast response time (within 1-2 hours)\n- Be empathetic and professional\n\nOutput format (strictly follow):\nSUBJECT: (write urgent subject here)\n\nBODY: (write body here)"
            }
          ]
        },
        "builtInTools": {}
      },
      "typeVersion": 2
    },
    {
      "id": "8715f230-d87d-4ef9-808f-96d5679be8a3",
      "name": "生成标准回复",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        768,
        352
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {},
        "responses": {
          "values": [
            {
              "content": "=Create a polite and professional response email to this inquiry.\n\nCustomer Name: {{$json.name}}\nInquiry Category: {{$json.category}}\nInquiry: {{$json.inquiry}}\n\nOutput format (strictly follow):\nSUBJECT: (write subject here)\n\nBODY: (write body here)"
            }
          ]
        },
        "builtInTools": {}
      },
      "typeVersion": 2
    },
    {
      "id": "24788dbe-f143-499b-b54e-ab2f8b081e5b",
      "name": "生成友好回复",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        768,
        464
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {},
        "responses": {
          "values": [
            {
              "content": "=Create a polite and friendly response email to this inquiry.\n\nCustomer Name: {{$json.name}}\nInquiry Category: {{$json.category}}\nInquiry: {{$json.inquiry}}\n\nOutput format (strictly follow):\nSUBJECT: (write subject here)\n\nBODY: (write body here)"
            }
          ]
        },
        "builtInTools": {}
      },
      "typeVersion": 2
    },
    {
      "id": "40134468-499c-4c55-bce1-62a991d82ee4",
      "name": "提取邮件主题和正文",
      "type": "n8n-nodes-base.code",
      "position": [
        1136,
        352
      ],
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "// Get AI-generated email and triage data\nconst allData = $input.item.json;\n\nlet aiResponse = '';\nif (allData.output && Array.isArray(allData.output) && allData.output.length > 0) {\n  const outputItem = allData.output[0];\n  if (outputItem.content && Array.isArray(outputItem.content) && outputItem.content.length > 0) {\n    aiResponse = outputItem.content[0].text || '';\n  }\n}\n\n// Parse subject and body from AI response\nlet subject = 'Thank you for your inquiry';\nlet body = '';\n\nif (aiResponse) {\n  const subjectMatch = aiResponse.match(/SUBJECT:\\s*([\\s\\S]*?)(?=\\nBODY:|$)/);\n  if (subjectMatch && subjectMatch[1]) {\n    subject = subjectMatch[1].trim();\n  }\n\n  const parts = aiResponse.split(/BODY:\\s*/);\n  if (parts.length > 1) {\n    body = parts[1].trim();\n  } else {\n    body = aiResponse.trim();\n  }\n}\n\nconst triageData = $('Parse AI Analysis Results').first().json;\n\nreturn {\n  subject,\n  body,\n  email: triageData.email,\n  name: triageData.name,\n  urgency: triageData.urgency,\n  category: triageData.category,\n  sentiment: triageData.sentiment,\n  keywords: triageData.keywords,\n  summary: triageData.summary,\n  inquiry: triageData.inquiry,\n  timestamp: triageData.timestamp\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "112807ff-a82c-4f08-bcd6-8f80b00c9e7f",
      "name": "通过 Gmail 发送自动回复",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1360,
        352
      ],
      "webhookId": "b58c0315-fb54-4b41-8198-f0ceba77ced1",
      "parameters": {
        "sendTo": "={{ $json.email }}",
        "message": "={{ $json.body }}",
        "options": {
          "appendAttribution": false
        },
        "subject": "={{ $json.subject }}"
      },
      "typeVersion": 2.1
    },
    {
      "id": "90ac9a6c-8644-4369-8dc0-7ad6e48db909",
      "name": "准备跟踪数据",
      "type": "n8n-nodes-base.set",
      "position": [
        1584,
        352
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "id-1",
              "name": "name",
              "type": "string",
              "value": "={{ $('Parse AI Analysis Results').item.json.name }}"
            },
            {
              "id": "id-2",
              "name": "email",
              "type": "string",
              "value": "={{ $('Parse AI Analysis Results').item.json.email }}"
            },
            {
              "id": "id-3",
              "name": "urgency",
              "type": "string",
              "value": "={{ $('Parse AI Analysis Results').item.json.urgency }}"
            },
            {
              "id": "id-4",
              "name": "category",
              "type": "string",
              "value": "={{ $('Parse AI Analysis Results').item.json.category }}"
            },
            {
              "id": "id-5",
              "name": "sentiment",
              "type": "string",
              "value": "={{ $('Parse AI Analysis Results').item.json.sentiment }}"
            },
            {
              "id": "id-6",
              "name": "summary",
              "type": "string",
              "value": "={{ $('Parse AI Analysis Results').item.json.summary }}"
            },
            {
              "id": "id-7",
              "name": "keywords",
              "type": "string",
              "value": "={{ $('Parse AI Analysis Results').item.json.keywords }}"
            },
            {
              "id": "id-8",
              "name": "subject",
              "type": "string",
              "value": "={{ $('Extract Email Subject and Body').item.json.subject }}"
            },
            {
              "id": "id-9",
              "name": "inquiry",
              "type": "string",
              "value": "={{ $('Parse AI Analysis Results').item.json.inquiry }}"
            },
            {
              "id": "id-10",
              "name": "timestamp",
              "type": "string",
              "value": "={{ $('Parse AI Analysis Results').item.json.timestamp }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "bd3aa2c7-e7f0-42e5-843b-9ecba1746432",
      "name": "是否为高优先级?",
      "type": "n8n-nodes-base.if",
      "position": [
        1792,
        352
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "caseSensitive": false,
            "typeValidation": "loose"
          },
          "conditions": [
            {
              "id": "id-1",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.urgency }}",
              "rightValue": "high"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "426bf20f-ab48-453b-945c-a70a65818526",
      "name": "在 Slack 上提醒团队",
      "type": "n8n-nodes-base.slack",
      "position": [
        2032,
        272
      ],
      "webhookId": "9d621a32-e3b1-4280-9c01-599989094a8a",
      "parameters": {
        "text": "=🚨 *HIGH PRIORITY INQUIRY RECEIVED*\n\n*Customer:* {{ $json.name }}\n*Email:* {{ $json.email }}\n*Category:* {{ $json.category }}\n*Sentiment:* {{ $json.sentiment }}\n\n*Summary:* {{ $json.summary }}\n\n*Original Inquiry:*\n{{ $json.inquiry }}\n\n✅ Auto-reply sent. Manual follow-up recommended within 1-2 hours.",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "otherOptions": {},
        "authentication": "oAuth2"
      },
      "typeVersion": 2.3
    },
    {
      "id": "8435195b-82c2-4085-afbe-b1e6bd40830a",
      "name": "记录到跟踪表格",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2208,
        368
      ],
      "parameters": {
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "1ad7a7ae-1f80-4081-a481-74cfd89bdaa7",
      "name": "便签 - 工作流概览",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1408,
        -272
      ],
      "parameters": {
        "width": 680,
        "height": 1596,
        "content": "## 📋 AI 驱动的客户支持自动化"
      },
      "typeVersion": 1
    },
    {
      "id": "d1a6e001-f164-4985-9cc9-c22493349127",
      "name": "便签 - 步骤 1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -688,
        -16
      ],
      "parameters": {
        "color": 7,
        "width": 360,
        "height": 352,
        "content": "### 📥 步骤 1:表单回复触发器"
      },
      "typeVersion": 1
    },
    {
      "id": "4122d26f-5ccf-4ad3-b130-99bbe84a020f",
      "name": "便签 - 步骤 2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -352,
        528
      ],
      "parameters": {
        "color": 7,
        "width": 340,
        "height": 236,
        "content": "### 🔧 步骤 2:映射列名"
      },
      "typeVersion": 1
    },
    {
      "id": "0ee1a9d8-3e37-412e-9a63-db17b354e52e",
      "name": "便签 - 步骤 3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -80,
        -32
      ],
      "parameters": {
        "color": 7,
        "width": 360,
        "height": 364,
        "content": "### 🧠 步骤 3:AI 分诊分析"
      },
      "typeVersion": 1
    },
    {
      "id": "bd556784-eb77-4347-8821-b0c301fca7b4",
      "name": "便签 - 步骤 4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        224,
        528
      ],
      "parameters": {
        "color": 7,
        "width": 360,
        "height": 344,
        "content": "### 🔀 步骤 4:优先级路由"
      },
      "typeVersion": 1
    },
    {
      "id": "d47878da-4235-44b9-bc04-85fa618298e4",
      "name": "便签 - 步骤 5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        688,
        -128
      ],
      "parameters": {
        "color": 7,
        "width": 360,
        "height": 340,
        "content": "### ✉️ 步骤 5:生成 AI 回复"
      },
      "typeVersion": 1
    },
    {
      "id": "49768cd0-7811-43e7-b90e-ec0e0cc599a5",
      "name": "便签 - 步骤 6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1232,
        64
      ],
      "parameters": {
        "color": 7,
        "width": 340,
        "height": 268,
        "content": "### 📤 步骤 6:发送自动回复"
      },
      "typeVersion": 1
    },
    {
      "id": "0de2f195-b296-43b2-99b5-38c41de47dba",
      "name": "便签 - 步骤 7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1872,
        528
      ],
      "parameters": {
        "color": 7,
        "width": 380,
        "height": 380,
        "content": "### 🚨 步骤 7:团队提醒和跟踪"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "2882a4e9-45c4-452d-a1fe-89e9d2629489",
  "connections": {
    "Is High Priority?": {
      "main": [
        [
          {
            "node": "Alert Team on Slack",
            "type": "main",
            "index": 0
          },
          {
            "node": "Log to Tracking Sheet",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Log to Tracking Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Map Form Column Names": {
      "main": [
        [
          {
            "node": "Analyze with AI Triage",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analyze with AI Triage": {
      "main": [
        [
          {
            "node": "Parse AI Analysis Results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Route by Priority Level": {
      "main": [
        [
          {
            "node": "Generate Urgent Response",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Generate Standard Response",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Generate Friendly Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Urgent Response": {
      "main": [
        [
          {
            "node": "Extract Email Subject and Body",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse AI Analysis Results": {
      "main": [
        [
          {
            "node": "Route by Priority Level",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Data for Tracking": {
      "main": [
        [
          {
            "node": "Is High Priority?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Auto-Reply via Gmail": {
      "main": [
        [
          {
            "node": "Prepare Data for Tracking",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Friendly Response": {
      "main": [
        [
          {
            "node": "Extract Email Subject and Body",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Standard Response": {
      "main": [
        [
          {
            "node": "Extract Email Subject and Body",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Form Responses Trigger": {
      "main": [
        [
          {
            "node": "Map Form Column Names",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Email Subject and Body": {
      "main": [
        [
          {
            "node": "Send Auto-Reply via Gmail",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 工单管理, AI 摘要总结

需要付费吗?

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

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

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

外部链接
在 n8n.io 查看

分享此工作流