8
n8n 中文网amn8n.com

使用Gmail、GPT和表格的自动邮件分类与回复系统

高级

这是一个AI Summarization, Multimodal AI领域的自动化工作流,包含 35 个节点。主要使用 Set, Gmail, ErrorTrigger, GmailTrigger, GoogleSheets 等节点。 使用Gmail、GPT和表格的自动邮件分类与回复系统

前置要求
  • Google 账号和 Gmail API 凭证
  • Google Sheets API 凭证
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "e2e2c9bc62a9282c580eaa52732abefcb4fb323e22933a39566356c65407044d",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "a75f0c4e-9b1e-4f76-81a7-903707c0548a",
      "name": "Gmail 触发器",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        -1376,
        528
      ],
      "parameters": {
        "simple": false,
        "filters": {
          "labelIds": [
            "INBOX"
          ],
          "readStatus": "unread"
        },
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        }
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "cWqq2EMH5CzPA1AE",
          "name": "Gmail account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "53354083-ac12-458b-a234-773b6ba38b7e",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -704,
        464
      ],
      "parameters": {
        "color": 5,
        "width": 512,
        "height": 224,
        "content": "## 邮件标签"
      },
      "typeVersion": 1
    },
    {
      "id": "7e47b472-0331-4bc5-bba8-bda3f42b4e9e",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -704,
        720
      ],
      "parameters": {
        "color": 5,
        "width": 512,
        "height": 224,
        "content": "## 邮件标签"
      },
      "typeVersion": 1
    },
    {
      "id": "b0c7e415-5528-4387-a029-60486c04b92e",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -704,
        976
      ],
      "parameters": {
        "color": 5,
        "width": 512,
        "height": 224,
        "content": "## 邮件标签"
      },
      "typeVersion": 1
    },
    {
      "id": "da115060-3031-4b1c-8a10-5b0e79334817",
      "name": "投诉标签",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -608,
        528
      ],
      "webhookId": "fff737dc-0d9b-4611-acb0-de62ede274ea",
      "parameters": {
        "labelIds": [
          "Label_2738167986001899947"
        ],
        "messageId": "={{ $('Gmail Trigger').item.json.id }}",
        "operation": "addLabels"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "cWqq2EMH5CzPA1AE",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "189ecb15-a0dd-427a-9985-f234bcc45ca8",
      "name": "信息标签",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -608,
        784
      ],
      "webhookId": "8d689704-d3bb-40cb-9fd4-75c4f8bafe2a",
      "parameters": {
        "labelIds": [
          "Label_8719801794646735130"
        ],
        "messageId": "={{ $('Gmail Trigger').item.json.id }}",
        "operation": "addLabels"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "cWqq2EMH5CzPA1AE",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "18a8ab55-c133-4477-92ef-3e8c32ef97c4",
      "name": "其他标签",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -608,
        1040
      ],
      "webhookId": "6e72bf33-af69-4da5-a7b9-c7d6e9634a96",
      "parameters": {
        "labelIds": [
          "UNREAD"
        ],
        "messageId": "={{ $('Gmail Trigger').item.json.id }}",
        "operation": "addLabels"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "cWqq2EMH5CzPA1AE",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "346a2604-416c-4064-9cb1-173d81cd961d",
      "name": "邮件分类器",
      "type": "@n8n/n8n-nodes-langchain.textClassifier",
      "position": [
        -1184,
        480
      ],
      "parameters": {
        "options": {
          "fallback": "other"
        },
        "inputText": "=Subject: {{ $('Gmail Trigger').item.json.subject }}\nText: {{ $('Gmail Trigger').item.json.text }}",
        "categories": {
          "categories": [
            {
              "category": "support",
              "description": "Emails requesting help, troubleshooting, or guidance regarding products or services. Includes technical issues, user problems, or requests for assistance."
            },
            {
              "category": "sales",
              "description": "Emails expressing interest in products or services, requests for quotes, proposals, or meetings with the sales team. Potential client inquiries fall here."
            },
            {
              "category": "complaints",
              "description": "Emails expressing dissatisfaction, reporting errors, or filing complaints. Includes customer grievances or urgent service issues."
            },
            {
              "category": "information",
              "description": "Emails seeking general information, clarifications, or communication that doesn’t fit Support, Sales, or Complaints."
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "bcf2a2b4-2f78-47f3-bd1d-500f3eff0851",
      "name": "集合2",
      "type": "n8n-nodes-base.set",
      "position": [
        -400,
        528
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "b47eaf61-7201-45b5-993a-cbcfaa5765f7",
              "name": "Decision",
              "type": "string",
              "value": "Compliants"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "f26299b0-795b-46c7-b255-0588a9976f50",
      "name": "集合3",
      "type": "n8n-nodes-base.set",
      "position": [
        -400,
        784
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "b47eaf61-7201-45b5-993a-cbcfaa5765f7",
              "name": "Decision",
              "type": "string",
              "value": "Info"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "7f458771-5e7f-4fcb-be7d-da4349bda1e6",
      "name": "集合4",
      "type": "n8n-nodes-base.set",
      "position": [
        -400,
        1040
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "b47eaf61-7201-45b5-993a-cbcfaa5765f7",
              "name": "Decision",
              "type": "string",
              "value": "Other"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "cf5a3309-f478-418a-9ff3-d8dfb7cc3c8c",
      "name": "便签 7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -464,
        480
      ],
      "parameters": {
        "color": 4,
        "height": 192,
        "content": "## 设置决策"
      },
      "typeVersion": 1
    },
    {
      "id": "6262ee85-fef2-4c99-ac5a-c57b0e5e4fff",
      "name": "便签8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -464,
        736
      ],
      "parameters": {
        "color": 4,
        "height": 192,
        "content": "## 设置决策"
      },
      "typeVersion": 1
    },
    {
      "id": "e2abc12a-b6ad-4f15-abc7-13735439ab90",
      "name": "便签 9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -464,
        992
      ],
      "parameters": {
        "color": 4,
        "height": 192,
        "content": "## 设置决策"
      },
      "typeVersion": 1
    },
    {
      "id": "41e62dfb-3838-499c-984c-e0057030ab4f",
      "name": "Google Sheets2",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        192,
        784
      ],
      "parameters": {
        "columns": {
          "value": {
            "Decision": "={{ $json.Decision }}",
            "Original Email": "=Subject: {{ $('Gmail Trigger').item.json.headers.subject }}\nBody: {{ $('Gmail Trigger').item.json.text }}"
          },
          "schema": [
            {
              "id": "Original Email",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Original Email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Decision",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Decision",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Output Email",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Output Email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1SutRXvFjLnnbnakCTNN0O4LqsG-y5nPGDXmipk3EAzE/edit#gid=0",
          "cachedResultName": "Hoja 1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1SutRXvFjLnnbnakCTNN0O4LqsG-y5nPGDXmipk3EAzE",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1SutRXvFjLnnbnakCTNN0O4LqsG-y5nPGDXmipk3EAzE/edit?usp=drivesdk",
          "cachedResultName": "Log Email Automation"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "gEJv4DaO8m5nfe0p",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "cc204b45-f8bb-4f07-98f7-52e55f6e79c2",
      "name": "Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        480,
        -48
      ],
      "parameters": {
        "columns": {
          "value": {
            "Decision": "={{ $json.Decision }}",
            "Output Email": "=Subject: {{ $json.Subject_email }}\nBody: {{ $json.Body_email }}",
            "Original Email": "=Subject: {{ $('Gmail Trigger').item.json.headers.subject }}\nBody: {{ $('Gmail Trigger').item.json.text }}"
          },
          "schema": [
            {
              "id": "Original Email",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Original Email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Decision",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Decision",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Output Email",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Output Email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1SutRXvFjLnnbnakCTNN0O4LqsG-y5nPGDXmipk3EAzE/edit#gid=0",
          "cachedResultName": "Hoja 1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1SutRXvFjLnnbnakCTNN0O4LqsG-y5nPGDXmipk3EAzE",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1SutRXvFjLnnbnakCTNN0O4LqsG-y5nPGDXmipk3EAzE/edit?usp=drivesdk",
          "cachedResultName": "Log Email Automation"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "gEJv4DaO8m5nfe0p",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "a4f688e0-5cdb-4454-a344-159add0f83af",
      "name": "无操作,不执行任何操作",
      "type": "n8n-nodes-base.noOp",
      "position": [
        -48,
        784
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "3210d7da-9a37-47d2-b66f-28f16b9998b2",
      "name": "无操作,不执行任何操作1",
      "type": "n8n-nodes-base.noOp",
      "position": [
        288,
        -48
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "0a55cbc0-ef79-496f-af1d-d420761a17cb",
      "name": "便签10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -704,
        48
      ],
      "parameters": {
        "color": 5,
        "width": 884,
        "height": 392,
        "content": "## 自动回复销售"
      },
      "typeVersion": 1
    },
    {
      "id": "67177cb9-e14b-438b-91b0-af64395dde65",
      "name": "便签11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -704,
        -352
      ],
      "parameters": {
        "color": 5,
        "width": 884,
        "height": 376,
        "content": "## 自动回复支持"
      },
      "typeVersion": 1
    },
    {
      "id": "635385df-9465-42ee-8e86-8996d1fe33d2",
      "name": "便签12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -128,
        64
      ],
      "parameters": {
        "color": 4,
        "height": 240,
        "content": "## 设置决策"
      },
      "typeVersion": 1
    },
    {
      "id": "bb0f23e1-caa2-4a3c-843d-c753d05af101",
      "name": "便签13",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -128,
        -336
      ],
      "parameters": {
        "color": 4,
        "height": 240,
        "content": "## 设置决策"
      },
      "typeVersion": 1
    },
    {
      "id": "e81d3f4d-b225-478e-9f85-0ed9064dcad1",
      "name": "为邮件线程添加标签",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -288,
        288
      ],
      "webhookId": "387c376b-2719-444a-89c3-c0e3473586c1",
      "parameters": {
        "labelIds": [
          "Label_3720213495654917937"
        ],
        "resource": "thread",
        "threadId": "={{ $('Gmail Trigger').item.json.threadId }}",
        "operation": "addLabels"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "cWqq2EMH5CzPA1AE",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "8b549ecf-6957-4789-9353-379f3fb35b38",
      "name": "创建草稿:销售",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -288,
        128
      ],
      "webhookId": "f5d02136-1293-468a-8fcf-b7ada04051a8",
      "parameters": {
        "message": "={{ $json.message.content.Body }}",
        "options": {
          "sendTo": "={{ $('Gmail Trigger').item.json.from.value[0].address }}",
          "threadId": "={{ $('Gmail Trigger').item.json.threadId }}"
        },
        "subject": "={{ $json.message.content.Subject }}",
        "resource": "draft"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "cWqq2EMH5CzPA1AE",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "1aec5594-f0a0-41e0-af09-63fbfafc4f1e",
      "name": "为邮件线程添加标签1",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -288,
        -128
      ],
      "webhookId": "a772d53d-e42c-4b5f-bf56-7f7156a75130",
      "parameters": {
        "labelIds": [
          "Label_7294717935753585870"
        ],
        "resource": "thread",
        "threadId": "={{ $('Gmail Trigger').item.json.threadId }}",
        "operation": "addLabels"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "cWqq2EMH5CzPA1AE",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "ebfc12bd-f8bb-4590-b25f-09ab4e9a1fd5",
      "name": "创建草稿:支持",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -288,
        -288
      ],
      "webhookId": "f5d02136-1293-468a-8fcf-b7ada04051a8",
      "parameters": {
        "message": "={{ $json.message.content.Body }}",
        "options": {
          "sendTo": "={{ $('Gmail Trigger').item.json.from.value[0].address }}",
          "threadId": "={{ $('Gmail Trigger').item.json.threadId }}"
        },
        "subject": "={{ $json.message.content.Subject }}",
        "resource": "draft"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "cWqq2EMH5CzPA1AE",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "bb8c3533-c0a8-47d1-bf4d-834daaa778d3",
      "name": "OpenAI 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -1184,
        736
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "id",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "3yvFVeLWONpgXkMW",
          "name": "OpenRouter Account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "91a3f31d-aa81-4df0-967b-b594bcf49513",
      "name": "向模型发送消息:支持",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        -608,
        -208
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "id",
          "value": "gpt-4.1-mini"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "=Hemos recibido el siguiente mensaje de {{ $('Gmail Trigger').item.json.headers.from.replace(/^From:\\s*/, '').match(/^(.*?)(?=\\s*<)/)[1] }}:\n\n\"{{ $('Gmail Trigger').item.json.text }}\"\n\nRedacta una respuesta profesional en función del mensaje y esta información.\n"
            },
            {
              "role": "assistant",
              "content": "=You are an AI assistant for a professional company. \nGenerate a polite and concise email reply to a support request. \nThe output must always be in valid JSON with two fields: Subject and Body.\n\nRules:\n- Subject: short and professional, e.g. \"We received your request\".\n- Body: acknowledge receipt, mention that support will contact them shortly, under 80 words.\n- Keep tone professional and friendly.\n- Personalize with the sender's name if available.\n- Do not add anything outside the JSON.\n\nExamples of proper JSON outputs:\n{\n  \"Subject\": \"We received your request\",\n  \"Body\": \"Hi John, thank you for reaching out. Our support team will review your issue and contact you shortly.\"\n}\n{\n  \"Subject\": \"Support request received\",\n  \"Body\": \"Hello Sarah, we’ve received your message. A specialist will contact you soon to assist you.\"\n}\n"
            }
          ]
        },
        "jsonOutput": true
      },
      "credentials": {
        "openAiApi": {
          "id": "3yvFVeLWONpgXkMW",
          "name": "OpenRouter Account"
        }
      },
      "executeOnce": false,
      "retryOnFail": true,
      "typeVersion": 1.8
    },
    {
      "id": "bf409083-7bd8-42ff-a88a-7d0f7f73da69",
      "name": "向模型发送消息:销售",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        -624,
        208
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "id",
          "value": "gpt-4.1-mini"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "=Hemos recibido el siguiente mensaje de {{ $('Gmail Trigger').item.json.headers.from.replace(/^From:\\s*/, '').match(/^(.*?)(?=\\s*<)/)[1] }}:\n\n\"{{ $('Gmail Trigger').item.json.text }}\"\n\nRedacta una respuesta profesional en función del mensaje y esta información.\n"
            },
            {
              "role": "assistant",
              "content": "=You are an AI assistant for a professional company. \nGenerate a polite and concise email reply to a sales inquiry. \nThe output must always be in valid JSON with two fields: Subject and Body.\n\nRules:\n- Subject: short and professional, e.g. \"Thank you for your interest\".\n- Body: thank them for their interest, mention the sales team will get back shortly, under 80 words.\n- Keep tone professional and friendly.\n- Personalize with the sender's name if available.\n- Do not add anything outside the JSON.\n\nExamples of proper JSON outputs:\n{\n  \"Subject\": \"Thank you for your interest\",\n  \"Body\": \"Hi Anna, thank you for your interest in our services. Our sales team will contact you shortly to discuss your needs.\"\n}\n{\n  \"Subject\": \"We appreciate your inquiry\",\n  \"Body\": \"Hello Peter, we appreciate your message. A member of our sales team will reach out soon with more details.\"\n}\n\n"
            }
          ]
        },
        "jsonOutput": true
      },
      "credentials": {
        "openAiApi": {
          "id": "3yvFVeLWONpgXkMW",
          "name": "OpenRouter Account"
        }
      },
      "retryOnFail": true,
      "typeVersion": 1.8
    },
    {
      "id": "639b1fb2-53c4-4231-9347-bc481fc0fc31",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -704,
        1232
      ],
      "parameters": {
        "color": 3,
        "width": 512,
        "height": 224,
        "content": "## 您可以根据需要添加任意数量"
      },
      "typeVersion": 1
    },
    {
      "id": "84f2f08a-7ff3-4ed1-916e-939ca497a944",
      "name": "在表格中追加行",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -1168,
        1072
      ],
      "parameters": {
        "columns": {
          "value": {
            "Time": "={{ $now.format('dd-MM-yyyy hh:mm:ss') }}",
            "Workflow ID": "={{ $workflow.id }}",
            "Execution ID": "={{ $execution.id }}",
            "Error Message": "={{ $json.execution.error.message }}",
            "Node with Error": "={{ $json.execution.lastNodeExecuted }}"
          },
          "schema": [
            {
              "id": "Node with Error",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Node with Error",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Error Message",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Error Message",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Time",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Time",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Execution ID",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Execution ID",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Workflow ID",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Workflow ID",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Error"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 390118099,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1SutRXvFjLnnbnakCTNN0O4LqsG-y5nPGDXmipk3EAzE/edit#gid=390118099",
          "cachedResultName": "Errors"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1SutRXvFjLnnbnakCTNN0O4LqsG-y5nPGDXmipk3EAzE",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1SutRXvFjLnnbnakCTNN0O4LqsG-y5nPGDXmipk3EAzE/edit?usp=drivesdk",
          "cachedResultName": "Log Email Automation"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "gEJv4DaO8m5nfe0p",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "6b9fa983-ec6c-4a7c-bda7-e922ad9ae19c",
      "name": "错误触发器",
      "type": "n8n-nodes-base.errorTrigger",
      "position": [
        -1344,
        1072
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "114acc6a-897b-4c73-a596-76f089e93cd0",
      "name": "设置",
      "type": "n8n-nodes-base.set",
      "position": [
        -64,
        -288
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "b47eaf61-7201-45b5-993a-cbcfaa5765f7",
              "name": "Decision",
              "type": "string",
              "value": "Sales"
            },
            {
              "id": "35d39d93-dbfa-43ec-8100-6df72a2874db",
              "name": "Subject_email",
              "type": "string",
              "value": "={{ $('Message a model: Support').item.json.message.content.Subject }}"
            },
            {
              "id": "ed3606d1-16ca-4089-8398-df6490e9e8ad",
              "name": "Body_email",
              "type": "string",
              "value": "={{ $('Message a model: Support').item.json.message.content.Body }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "32f8f930-2db3-4d3f-9134-11d40cd2f655",
      "name": "集合1",
      "type": "n8n-nodes-base.set",
      "position": [
        -64,
        128
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "b47eaf61-7201-45b5-993a-cbcfaa5765f7",
              "name": "Decision",
              "type": "string",
              "value": "Sales"
            },
            {
              "id": "35d39d93-dbfa-43ec-8100-6df72a2874db",
              "name": "Subject_email",
              "type": "string",
              "value": "={{ $('Message a model: Sales').item.json.message.content.Subject }}"
            },
            {
              "id": "ed3606d1-16ca-4089-8398-df6490e9e8ad",
              "name": "Body_email",
              "type": "string",
              "value": "={{ $('Message a model: Sales').item.json.message.content.Body }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "28a2c29e-c959-4a2e-ae80-5afec769d8cd",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2176,
        48
      ],
      "parameters": {
        "color": 3,
        "width": 688,
        "height": 1328,
        "content": "# 邮件自动化工作流"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "Set": {
      "main": [
        [
          {
            "node": "No Operation, do nothing1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set 1": {
      "main": [
        [
          {
            "node": "No Operation, do nothing1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set 2": {
      "main": [
        [
          {
            "node": "No Operation, do nothing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set 3": {
      "main": [
        [
          {
            "node": "No Operation, do nothing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set 4": {
      "main": [
        [
          {
            "node": "No Operation, do nothing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "info label": {
      "main": [
        [
          {
            "node": "Set 3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "other label": {
      "main": [
        [
          {
            "node": "Set 4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Error Trigger": {
      "main": [
        [
          {
            "node": "Append row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gmail Trigger": {
      "main": [
        [
          {
            "node": "Mail Classifier",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Mail Classifier": {
      "main": [
        [
          {
            "node": "Message a model: Support",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Message a model: Sales",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "compliants label",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "info label",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "other label",
            "type": "main",
            "index": 0
          }
        ],
        [],
        [],
        []
      ]
    },
    "compliants label": {
      "main": [
        [
          {
            "node": "Set 2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Mail Classifier",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Add label to thread": {
      "main": [
        []
      ]
    },
    "Create a draft: Sales": {
      "main": [
        [
          {
            "node": "Set 1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Message a model: Sales": {
      "main": [
        [
          {
            "node": "Create a draft: Sales",
            "type": "main",
            "index": 0
          },
          {
            "node": "Add label to thread",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create a draft: Support": {
      "main": [
        [
          {
            "node": "Set",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Message a model: Support": {
      "main": [
        [
          {
            "node": "Add label to thread1",
            "type": "main",
            "index": 0
          },
          {
            "node": "Create a draft: Support",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "No Operation, do nothing": {
      "main": [
        [
          {
            "node": "Google Sheets2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "No Operation, do nothing1": {
      "main": [
        [
          {
            "node": "Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - AI 摘要总结, 多模态 AI

需要付费吗?

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

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

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

作者
Sergio Afonso

Sergio Afonso

@sergioafonso

Fundador de altIAgency, especializado en diseñar y escalar automatizaciones empresariales con n8n y ecosistemas de IA. Mi experiencia combina la integración de flujos complejos con la creación de agentes inteligentes orientados a procesos reales, monetizables y eficientes. Comparto soluciones que transforman operaciones manuales en sistemas automáticos, con un enfoque en escalabilidad, precisión y valor empresarial.

外部链接
在 n8n.io 查看

分享此工作流