8
n8n 中文网amn8n.com

使用GPT、Gmail、Slack和分析仪表板自动分诊客户支持

高级

这是一个Ticket Management, AI Summarization领域的自动化工作流,包含 21 个节点。主要使用 Code, Slack, OpenAi, Switch, Airtable 等节点。 使用GPT、Gmail、Slack和分析仪表板自动分诊客户支持

前置要求
  • Slack Bot Token 或 Webhook URL
  • OpenAI API Key
  • Airtable API Key
  • Google 账号和 Gmail API 凭证
  • Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "db30e8ae4100235addbd4638770997b7ef11878d049073c888ba440ca84c55fc"
  },
  "nodes": [
    {
      "id": "fd8ec780-8941-4736-88e7-cbc148f1deb7",
      "name": "监控支持邮件",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        -1008,
        112
      ],
      "parameters": {
        "filters": {
          "sender": "",
          "labelIds": [
            "INBOX"
          ],
          "readStatus": "unread"
        },
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "ff2c6f81-1137-4ef5-b96d-69f08c538d9d",
      "name": "AI 分析引擎",
      "type": "n8n-nodes-base.openAi",
      "position": [
        -752,
        112
      ],
      "parameters": {
        "prompt": {
          "messages": [
            {
              "role": "system",
              "content": "You are an expert customer support analyst. Analyze the email and provide: 1) Sentiment (Positive/Neutral/Negative/Critical), 2) Urgency Level (Low/Medium/High/Critical), 3) Category (Technical/Billing/Feature Request/Bug Report/General Inquiry), 4) Key Issues (bullet points), 5) Suggested Response (professional and empathetic). Return as JSON."
            },
            {
              "content": "Email Subject: {{ $json.subject }}\n\nEmail Body: {{ $json.body }}\n\nFrom: {{ $json.from }}"
            }
          ]
        },
        "options": {
          "maxTokens": 1000,
          "temperature": 0.3
        },
        "resource": "chat",
        "requestOptions": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "8b706330-4e9f-40f6-b4f8-02fe2988eed4",
      "name": "解析与增强数据",
      "type": "n8n-nodes-base.code",
      "position": [
        -496,
        112
      ],
      "parameters": {
        "jsCode": "const aiResponse = JSON.parse($input.first().json.choices[0].message.content);\nconst emailData = $('Monitor Support Emails').first().json;\n\nreturn {\n  json: {\n    timestamp: new Date().toISOString(),\n    customer_email: emailData.from,\n    customer_name: emailData.from.split('<')[0].trim(),\n    subject: emailData.subject,\n    body: emailData.body,\n    email_id: emailData.id,\n    thread_id: emailData.threadId,\n    \n    // AI Analysis Results\n    sentiment: aiResponse.sentiment,\n    urgency: aiResponse.urgency_level,\n    category: aiResponse.category,\n    key_issues: aiResponse.key_issues,\n    suggested_response: aiResponse.suggested_response,\n    \n    // Scoring\n    priority_score: calculatePriority(aiResponse.urgency_level, aiResponse.sentiment),\n    requires_immediate_attention: aiResponse.urgency_level === 'Critical' || aiResponse.sentiment === 'Critical'\n  }\n};\n\nfunction calculatePriority(urgency, sentiment) {\n  const urgencyScores = { 'Low': 1, 'Medium': 2, 'High': 3, 'Critical': 4 };\n  const sentimentScores = { 'Positive': 0, 'Neutral': 1, 'Negative': 2, 'Critical': 3 };\n  return (urgencyScores[urgency] || 2) * 25 + (sentimentScores[sentiment] || 1) * 10;\n}"
      },
      "typeVersion": 2
    },
    {
      "id": "52100d0c-5fb5-4e9f-a9bd-06a18a3d548f",
      "name": "按紧急程度路由",
      "type": "n8n-nodes-base.switch",
      "position": [
        -256,
        112
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "",
                    "rightValue": ""
                  }
                ]
              }
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "93c91813-4e80-4d68-9481-ae3ec127f519",
      "name": "警报关键问题",
      "type": "n8n-nodes-base.slack",
      "position": [
        0,
        0
      ],
      "webhookId": "0c0c977b-f166-40b6-87bd-232356728544",
      "parameters": {
        "text": "🚨 *CRITICAL CUSTOMER ISSUE DETECTED*\n\n*Customer:* {{ $json.customer_name }} ({{ $json.customer_email }})\n*Subject:* {{ $json.subject }}\n*Sentiment:* {{ $json.sentiment }} | *Urgency:* {{ $json.urgency }}\n*Category:* {{ $json.category }}\n*Priority Score:* {{ $json.priority_score }}/110\n\n*Key Issues:*\n{{ $json.key_issues }}\n\n*Suggested Response:*\n```\n{{ $json.suggested_response }}\n```\n\n*Action Required:* Respond within 30 minutes\n*Email ID:* {{ $json.email_id }}",
        "otherOptions": {
          "mrkdwn": true
        },
        "authentication": "oAuth2"
      },
      "typeVersion": 2.3
    },
    {
      "id": "9e35f1a2-7e66-4798-bbe9-fd843fd4d67e",
      "name": "记录常规工单",
      "type": "n8n-nodes-base.slack",
      "position": [
        0,
        208
      ],
      "webhookId": "8e6c2a7d-d35a-4ba3-bf96-7b6c33a5d8a4",
      "parameters": {
        "text": "📧 *New Support Ticket*\n\n*Customer:* {{ $json.customer_name }}\n*Category:* {{ $json.category }} | *Priority:* {{ $json.priority_score }}\n*Sentiment:* {{ $json.sentiment }}\n\n*Subject:* {{ $json.subject }}",
        "otherOptions": {},
        "authentication": "oAuth2"
      },
      "typeVersion": 2.3
    },
    {
      "id": "50556621-9a8c-4a12-8c6b-78fd614a2e37",
      "name": "记录到 Airtable 数据库",
      "type": "n8n-nodes-base.airtable",
      "position": [
        256,
        112
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "id",
          "value": "appXXXXXXXXXXXXXX"
        },
        "table": {
          "__rl": true,
          "mode": "id",
          "value": "tblSupportTickets"
        },
        "columns": {
          "value": {
            "Status": "Open",
            "Subject": "={{ $json.subject }}",
            "Urgency": "={{ $json.urgency }}",
            "Category": "={{ $json.category }}",
            "Email_ID": "={{ $json.email_id }}",
            "Sentiment": "={{ $json.sentiment }}",
            "Thread_ID": "={{ $json.thread_id }}",
            "Timestamp": "={{ $json.timestamp }}",
            "Email_Body": "={{ $json.body }}",
            "Key_Issues": "={{ $json.key_issues }}",
            "Customer_Name": "={{ $json.customer_name }}",
            "Customer_Email": "={{ $json.customer_email }}",
            "Priority_Score": "={{ $json.priority_score }}",
            "Suggested_Response": "={{ $json.suggested_response }}",
            "Requires_Immediate_Attention": "={{ $json.requires_immediate_attention }}"
          },
          "mappingMode": "defineBelow"
        },
        "options": {},
        "operation": "create"
      },
      "typeVersion": 2.1
    },
    {
      "id": "39e8213d-f382-4778-9d13-8036b2e52696",
      "name": "更新分析仪表板",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        512,
        112
      ],
      "parameters": {
        "columns": {
          "value": {
            "Date": "={{ $json.timestamp.split('T')[0] }}",
            "Time": "={{ $json.timestamp.split('T')[1].split('.')[0] }}",
            "Email": "={{ $json.customer_email }}",
            "Status": "Open",
            "Subject": "={{ $json.subject }}",
            "Urgency": "={{ $json.urgency }}",
            "Category": "={{ $json.category }}",
            "Critical": "={{ $json.requires_immediate_attention }}",
            "Customer": "={{ $json.customer_name }}",
            "Priority": "={{ $json.priority_score }}",
            "Sentiment": "={{ $json.sentiment }}"
          },
          "mappingMode": "defineBelow"
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "id",
          "value": "gid=0"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "1XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "970abf02-9fac-4109-8fc2-909f333d3224",
      "name": "生成洞察",
      "type": "n8n-nodes-base.openAi",
      "position": [
        752,
        112
      ],
      "parameters": {
        "prompt": {
          "messages": [
            {
              "role": "system",
              "content": "Based on the analysis, generate 3 data insights: 1) Trend identification, 2) Risk assessment, 3) Actionable recommendation for the support team."
            },
            {
              "content": "Ticket Data:\nSentiment: {{ $json.sentiment }}\nCategory: {{ $json.category }}\nUrgency: {{ $json.urgency }}\nIssues: {{ $json.key_issues }}\n\nProvide insights in JSON format with keys: trend, risk, recommendation"
            }
          ]
        },
        "options": {
          "maxTokens": 500,
          "temperature": 0.5
        },
        "resource": "chat",
        "requestOptions": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "ab329b35-05bb-42ec-bfe1-9f8ba4ec6772",
      "name": "存储 AI 洞察",
      "type": "n8n-nodes-base.airtable",
      "position": [
        1008,
        112
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "id",
          "value": "appXXXXXXXXXXXXXX"
        },
        "table": {
          "__rl": true,
          "mode": "id",
          "value": "tblInsights"
        },
        "columns": {
          "value": {
            "Record_ID": "={{ $('Log to Airtable Database').item.json.id }}",
            "AI_Insights": "={{ JSON.parse($json.choices[0].message.content) }}",
            "Generated_At": "={{ new Date().toISOString() }}"
          },
          "mappingMode": "defineBelow"
        },
        "options": {},
        "operation": "update"
      },
      "typeVersion": 2.1
    },
    {
      "id": "02b48c6d-c266-4f92-913d-c76367bb5d96",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1040,
        0
      ],
      "parameters": {
        "width": 176,
        "height": 96,
        "content": "监控 Gmail 收件箱中的新未读邮件"
      },
      "typeVersion": 1
    },
    {
      "id": "98d2e12e-be2a-440b-baf5-8cd6120e4271",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -784,
        0
      ],
      "parameters": {
        "width": 176,
        "height": 96,
        "content": "分析情绪、紧急程度并分类支持请求"
      },
      "typeVersion": 1
    },
    {
      "id": "4310037a-a46e-43f0-bd9d-d32af017d9b8",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -528,
        0
      ],
      "parameters": {
        "width": 176,
        "height": 96,
        "content": "结构化 AI 输出并计算优先级分数"
      },
      "typeVersion": 1
    },
    {
      "id": "81b8f33b-303c-4cf1-905d-6065d3a5b026",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -288,
        0
      ],
      "parameters": {
        "width": 176,
        "height": 96,
        "content": "根据紧急程度分类级别路由工单"
      },
      "typeVersion": 1
    },
    {
      "id": "b7f1ae71-fe6d-4f64-8193-e36ae264af13",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -32,
        -112
      ],
      "parameters": {
        "width": 176,
        "height": 96,
        "content": "为关键工单发送即时 Slack 警报"
      },
      "typeVersion": 1
    },
    {
      "id": "d30db0f5-e392-4114-93b8-674bee6121ec",
      "name": "便签5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -48,
        368
      ],
      "parameters": {
        "width": 176,
        "height": 96,
        "content": "将标准优先级工单发布到 Slack 频道"
      },
      "typeVersion": 1
    },
    {
      "id": "393db2f6-ee8c-4f45-96c0-645c5c530619",
      "name": "### 需要帮助?",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        224,
        0
      ],
      "parameters": {
        "width": 176,
        "height": 96,
        "content": "在 Airtable 基础表中存储完整工单数据"
      },
      "typeVersion": 1
    },
    {
      "id": "279d3e6a-e014-4c23-8ccb-d635b25c0fb3",
      "name": "## 试试看!",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        480,
        0
      ],
      "parameters": {
        "width": 176,
        "height": 96,
        "content": "将工单指标记录到 Google Sheets 仪表板"
      },
      "typeVersion": 1
    },
    {
      "id": "08bb68e3-a7ad-42fa-aea7-5abc319e2b27",
      "name": "GET 模型",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        720,
        0
      ],
      "parameters": {
        "width": 176,
        "height": 96,
        "content": "每日创建 AI 驱动的趋势和风险评估"
      },
      "typeVersion": 1
    },
    {
      "id": "acc25615-d10a-4d12-b1cb-4ecb28c972da",
      "name": "## 1. 创建新的自定义 OpenAI 凭据",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        976,
        0
      ],
      "parameters": {
        "width": 176,
        "height": 96,
        "content": "将生成的洞察保存回 Airtable 记录"
      },
      "typeVersion": 1
    },
    {
      "id": "9ca1492d-826d-45ca-880d-35210ed527c9",
      "name": "便签10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1568,
        -112
      ],
      "parameters": {
        "width": 464,
        "height": 528,
        "content": "# 工作流描述"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "Route by Urgency": {
      "main": [
        [
          {
            "node": "Alert Critical Issues",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Insights": {
      "main": [
        [
          {
            "node": "Store AI Insights",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Analysis Engine": {
      "main": [
        [
          {
            "node": "Parse & Enrich Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log Routine Tickets": {
      "main": [
        [
          {
            "node": "Log to Airtable Database",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse & Enrich Data": {
      "main": [
        [
          {
            "node": "Route by Urgency",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Alert Critical Issues": {
      "main": [
        [
          {
            "node": "Log to Airtable Database",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Monitor Support Emails": {
      "main": [
        [
          {
            "node": "AI Analysis Engine",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log to Airtable Database": {
      "main": [
        [
          {
            "node": "Update Analytics Dashboard",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Analytics Dashboard": {
      "main": [
        [
          {
            "node": "Generate Insights",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

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

需要付费吗?

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

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

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

作者
Daniel Shashko

Daniel Shashko

@tomax

AI automation specialist and a marketing enthusiast. More than 6 years of experience in SEO/GEO. Senior SEO at Bright Data.

外部链接
在 n8n.io 查看

分享此工作流