8
n8n 中文网amn8n.com

支持收件箱到常见问题解答回填(Gmail/Outlook)

高级

这是一个Ticket Management, AI Summarization领域的自动化工作流,包含 21 个节点。主要使用 If, Code, Gmail, Slack, Notion 等节点。 使用GPT-4o、Gmail、Notion和Slack将支持邮件转换为常见问题解答

前置要求
  • Google 账号和 Gmail API 凭证
  • Slack Bot Token 或 Webhook URL
  • Notion API Key
  • Google Sheets API 凭证
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "uQWmgAxfU9ZS3EEu",
  "meta": {
    "instanceId": "8443f10082278c46aa5cf3acf8ff0f70061a2c58bce76efac814b16290845177",
    "templateCredsSetupCompleted": true
  },
  "name": "支持收件箱到常见问题解答回填(Gmail/Outlook)",
  "tags": [],
  "nodes": [
    {
      "id": "bc069f30-5bcf-4e2c-a657-492eacdae39a",
      "name": "配置GPT-4o模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatAzureOpenAi",
      "position": [
        -144,
        208
      ],
      "parameters": {
        "model": "gpt-4o",
        "options": {}
      },
      "credentials": {
        "azureOpenAiApi": {
          "id": "C3WzT18XqF8OdVM6",
          "name": "Azure Open AI account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "2c8072df-420c-441c-8beb-137df1737650",
      "name": "便签5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -480,
        416
      ],
      "parameters": {
        "color": 7,
        "width": 304,
        "height": 464,
        "content": "## 错误处理与日志记录"
      },
      "typeVersion": 1
    },
    {
      "id": "337ea8c7-d28c-43a4-a288-d7c48ea8788b",
      "name": "Gmail 轮询触发器 – 开发者支持收件箱",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        -912,
        -16
      ],
      "parameters": {
        "filters": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        }
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "RchiXdmY8WaQhOSJ",
          "name": "Gmail account"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "04a188b4-507a-4eb7-8466-5b7703316a61",
      "name": "验证电子邮件负载",
      "type": "n8n-nodes-base.if",
      "position": [
        -624,
        -16
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "e2adb005-2b3c-4d1e-8445-442df1fe925a",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.id }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "1a39d3cf-2b08-4f3d-b9c2-8da386f42283",
      "name": "分析与分类开发者电子邮件(AI)",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -208,
        -32
      ],
      "parameters": {
        "text": "={\n  \"subject\": {{ $json.Subject }} ,\n  \"body\": \"{{$json[\"snippet\"]}}\"\n}\n",
        "options": {
          "systemMessage": "=You are an AI assistant trained to analyze developer support emails and identify recurring questions or issues.\n\nYour task:\n1. Read the email subject and snippet.\n2. Summarize the main problem.\n3. Identify the most likely FAQ category (e.g., API, Authentication, Billing, Setup, Errors, UI).\n4. Suggest a short FAQ title.\n5. Write a 2–3 line clear and helpful answer.\n6. Detect if it matches an existing FAQ type (is_recurring = true/false).\n\nReturn result in **valid JSON** only.\n"
        },
        "promptType": "define"
      },
      "typeVersion": 2.1
    },
    {
      "id": "f3a597c5-7f03-437e-b6b9-c9b9d79cff2d",
      "name": "解析与清理 AI JSON 输出",
      "type": "n8n-nodes-base.code",
      "position": [
        208,
        -32
      ],
      "parameters": {
        "jsCode": "// Remove Markdown code block and parse JSON\nlet raw = $json.output || \"\";\nraw = raw.replace(/```json|```/g, '').trim();\n\nlet parsed = {};\ntry {\n  parsed = JSON.parse(raw);\n} catch (e) {\n  parsed = { error: \"Failed to parse AI output\", raw_output: raw };\n}\n\nreturn parsed;\n"
      },
      "typeVersion": 2
    },
    {
      "id": "a10bfd08-a073-4160-ae69-ebe3ae93c6e2",
      "name": "将常见问题解答条目保存到 Notion 数据库",
      "type": "n8n-nodes-base.notion",
      "position": [
        1312,
        48
      ],
      "parameters": {
        "title": "={{ $json.problem_summary }}",
        "simple": false,
        "options": {},
        "resource": "databasePage",
        "databaseId": {
          "__rl": true,
          "mode": "list",
          "value": "29a802b9-1fa0-804a-b406-e078961e0659",
          "cachedResultUrl": "https://www.notion.so/29a802b91fa0804ab406e078961e0659",
          "cachedResultName": "Release Notes"
        },
        "propertiesUi": {
          "propertyValues": [
            {
              "key": "Priority|rich_text",
              "textContent": "={{ $json.faq_category }}"
            },
            {
              "key": "FAQ Content|rich_text",
              "textContent": "={{ $json.faq_answer }}"
            }
          ]
        }
      },
      "credentials": {
        "notionApi": {
          "id": "iDjtgSTYG9ECVBtT",
          "name": "Notion account 2"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "06741c0d-d998-41e9-9453-eed31e77a189",
      "name": "在 Slack 中宣布新常见问题解答",
      "type": "n8n-nodes-base.slack",
      "position": [
        1568,
        48
      ],
      "webhookId": "ddaa7632-9e35-4bd3-82d6-572d5cae84cc",
      "parameters": {
        "text": "=🧠 *FAQ Update Logged!*\n• *Title:* {{$json[\"properties\"][\"Name\"][\"title\"][0][\"plain_text\"]}}\n• *Category:* {{$json[\"properties\"][\"Priority\"][\"rich_text\"][0][\"plain_text\"]}}\n• *Summary:* {{$json[\"properties\"][\"FAQ Content\"][\"rich_text\"][0][\"plain_text\"].slice(0, 150)}}...\n\n🔗 *View in Notion:* <{{$json[\"url\"]}}|Open FAQ>\n📅 *Logged On:* {{new Date().toLocaleString()}}\n",
        "user": {
          "__rl": true,
          "mode": "list",
          "value": "U09HMPVD466",
          "cachedResultName": "newscctv22"
        },
        "select": "user",
        "otherOptions": {}
      },
      "credentials": {
        "slackApi": {
          "id": "rNqvWj9TfChPVRYY",
          "name": "Slack account vivek"
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "1201a420-9656-47b1-9ef6-65fa62d8e245",
      "name": "将工作流错误记录到Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -464,
        672
      ],
      "parameters": {
        "columns": {
          "value": {},
          "schema": [
            {
              "id": "error_id",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "error_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "error",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "error",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "error_id"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1338537721,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Uldk_4BxWbdZTDZxFUeohIfeBmGHHqVEl9Ogb0l6R8Y/edit#gid=1338537721",
          "cachedResultName": "error log sheet"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1Uldk_4BxWbdZTDZxFUeohIfeBmGHHqVEl9Ogb0l6R8Y",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Uldk_4BxWbdZTDZxFUeohIfeBmGHHqVEl9Ogb0l6R8Y/edit?usp=drivesdk",
          "cachedResultName": "Interviewer Brief Pack "
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "kpPEOLCGn963qpoh",
          "name": "automations@techdome.ai"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "625832c2-b6f8-4f12-b246-eb9d8be74531",
      "name": "配置 GPT-4o 模型1",
      "type": "@n8n/n8n-nodes-langchain.lmChatAzureOpenAi",
      "position": [
        512,
        -304
      ],
      "parameters": {
        "model": "gpt-4o",
        "options": {}
      },
      "credentials": {
        "azureOpenAiApi": {
          "id": "C3WzT18XqF8OdVM6",
          "name": "Azure Open AI account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "a8b1fec3-a3a5-4da6-82cb-85297ef8a092",
      "name": "## 1. 创建新的自定义 OpenAI 凭据",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1632,
        -816
      ],
      "parameters": {
        "color": 7,
        "height": 496,
        "content": "## 确认与反馈循环"
      },
      "typeVersion": 1
    },
    {
      "id": "65fa6207-1bd4-414b-ab20-46517842d2f4",
      "name": "分析电子邮件情感与紧急性(AI)",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        528,
        -512
      ],
      "parameters": {
        "text": "=Analyze this email and determine:\n1. Urgency level (Low/Medium/High/Critical)\n2. Customer sentiment (Positive/Neutral/Frustrated/Angry)\n3. Requires immediate response? (Yes/No)\n\nEmail: {{ $('Gmail Polling Trigger – Developer Support Inbox').item.json.snippet }}\n\nReturn only JSON:\n{\n  \"urgency\": \"High\",\n  \"sentiment\": \"Frustrated\",\n  \"immediate_response_needed\": \"Yes\",\n  \"reason\": \"brief explanation\"\n}",
        "options": {
          "systemMessage": "=You are an expert at analyzing customer support emails. Rate urgency and sentiment accurately and concisely"
        },
        "promptType": "define"
      },
      "typeVersion": 2.1
    },
    {
      "id": "17018fa2-153a-4ca8-8e3b-fc04195a26ce",
      "name": "解析 AI JSON 输出 – 情感分析",
      "type": "n8n-nodes-base.code",
      "position": [
        880,
        -512
      ],
      "parameters": {
        "jsCode": "// Remove Markdown code block and parse JSON\nlet raw = $json.output || \"\";\nraw = raw.replace(/```json|```/g, '').trim();\n\nlet parsed = {};\ntry {\n  parsed = JSON.parse(raw);\n} catch (e) {\n  parsed = { error: \"Failed to parse AI output\", raw_output: raw };\n}\n\nreturn parsed;\n"
      },
      "typeVersion": 2
    },
    {
      "id": "5d7e3019-0c17-4840-9302-f6c4bbe47432",
      "name": "筛选关键或高紧急性电子邮件",
      "type": "n8n-nodes-base.if",
      "position": [
        1120,
        -512
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "db2ac827-dd91-42cd-a79d-b1a78c104dad",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.urgency }}",
              "rightValue": "High"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "7a0f4533-2afc-42f2-926a-298aa2183d3f",
      "name": "在 Slack 中提醒团队 – 关键问题",
      "type": "n8n-nodes-base.slack",
      "position": [
        1424,
        -528
      ],
      "webhookId": "ddaa7632-9e35-4bd3-82d6-572d5cae84cc",
      "parameters": {
        "text": "=🚨 *CRITICAL ISSUE DETECTED*\n   \n   📧 Email: {{ $('Gmail Polling Trigger – Developer Support Inbox').item.json.snippet }}\n   😤 Sentiment: {{ $json.sentiment }}\n   ⚡ Urgency: {{ $json.urgency }}\n   📝 Reason: {{ $json.reason }}\n   \n   👉 *Action Required Immediately*",
        "user": {
          "__rl": true,
          "mode": "list",
          "value": "U09HMPVD466",
          "cachedResultName": "newscctv22"
        },
        "select": "user",
        "otherOptions": {}
      },
      "credentials": {
        "slackApi": {
          "id": "rNqvWj9TfChPVRYY",
          "name": "Slack account vivek"
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "0edeebbe-2001-4a84-823a-e712757190b8",
      "name": "向发件人发送确认电子邮件",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1696,
        -528
      ],
      "webhookId": "0c82c299-6938-42ed-bda6-5007d79af34f",
      "parameters": {
        "sendTo": "={{ $('Gmail Polling Trigger – Developer Support Inbox').item.json.From.match(/<(.+?)>/)?.[1] || $('Gmail Polling Trigger – Developer Support Inbox').item.json.From }}",
        "message": "=Hi there,\n\nThank you for reaching out! We've received your question and added it to our knowledge base.\n\nHere's a quick answer to help you:\n\n📌 Issue: {{ $('Parse & Clean AI JSON Output').item.json.problem_summary }}\n💡 Solution: {{ $('Parse & Clean AI JSON Output').item.json.faq_answer }}\n\nOur team will follow up if additional assistance is needed.\n\nBest regards,\nDeveloper Support Team",
        "options": {},
        "subject": "={{ $('Gmail Polling Trigger – Developer Support Inbox').item.json.snippet }}"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "RchiXdmY8WaQhOSJ",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "aab47485-abe6-4f47-9b71-8a75939ace39",
      "name": "GET 模型",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1552,
        -960
      ],
      "parameters": {
        "width": 512,
        "height": 624,
        "content": "## 工作原理"
      },
      "typeVersion": 1
    },
    {
      "id": "b360458f-2d91-4c7c-bcb4-d7a80b5f7ca6",
      "name": "便签15",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -976,
        -208
      ],
      "parameters": {
        "color": 7,
        "width": 512,
        "height": 384,
        "content": "## 电子邮件接收与验证"
      },
      "typeVersion": 1
    },
    {
      "id": "cc440d05-5ed8-4819-b6a6-f06fc6b55c4d",
      "name": "便签16",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -272,
        -208
      ],
      "parameters": {
        "color": 7,
        "width": 704,
        "height": 576,
        "content": "## AI 分析与常见问题解答生成"
      },
      "typeVersion": 1
    },
    {
      "id": "b738631b-0ab0-4c57-80b4-2d011b01a5ce",
      "name": "便签17",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1200,
        -96
      ],
      "parameters": {
        "color": 7,
        "width": 640,
        "height": 432,
        "content": "## 知识存储与团队通知"
      },
      "typeVersion": 1
    },
    {
      "id": "d95516c3-0ce4-4515-91f0-7ca19ecc3957",
      "name": "便签18",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        464,
        -768
      ],
      "parameters": {
        "color": 7,
        "width": 1104,
        "height": 608,
        "content": "## 紧急性与情感检测"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "7df077a3-0fb2-48e1-9c72-5b88f926f197",
  "connections": {
    "Configure GPT-4o Model": {
      "ai_languageModel": [
        [
          {
            "node": "Analyze & Classify Developer Email (AI)",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Validate Email Payload": {
      "main": [
        [
          {
            "node": "Analyze & Classify Developer Email (AI)",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Log Workflow Errors to Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Configure GPT-4o Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Analyze Email Sentiment & Urgency (AI)",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Parse & Clean AI JSON Output": {
      "main": [
        [
          {
            "node": "Save FAQ Entry to Notion Database",
            "type": "main",
            "index": 0
          },
          {
            "node": "Analyze Email Sentiment & Urgency (AI)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save FAQ Entry to Notion Database": {
      "main": [
        [
          {
            "node": "Announce New FAQ in Slack",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Alert Team in Slack – Critical Issue": {
      "main": [
        [
          {
            "node": " Send Acknowledgment Email to Sender",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analyze Email Sentiment & Urgency (AI)": {
      "main": [
        [
          {
            "node": "Parse AI JSON Output – Sentiment Analysis",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Critical or High-Urgency Emails": {
      "main": [
        [
          {
            "node": "Alert Team in Slack – Critical Issue",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analyze & Classify Developer Email (AI)": {
      "main": [
        [
          {
            "node": "Parse & Clean AI JSON Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse AI JSON Output – Sentiment Analysis": {
      "main": [
        [
          {
            "node": "Filter Critical or High-Urgency Emails",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gmail Polling Trigger – Developer Support Inbox": {
      "main": [
        [
          {
            "node": "Validate Email Payload",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

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

需要付费吗?

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

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

适合高级用户,包含 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 查看

分享此工作流