8
n8n 中文网amn8n.com

Gmail 整理器

中级

这是一个Ticket Management, AI Summarization领域的自动化工作流,包含 11 个节点。主要使用 Gmail, Switch, GmailTrigger 等节点。 使用基于规则的分类和智能操作自动化Gmail收件箱整理

前置要求
  • Google 账号和 Gmail API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "OlJ23u8YjjeZ3DGu",
  "meta": {
    "instanceId": "922f87b0adfedb3ae09541ddf50e19d9af2c8cfac1d8da5d9cd4cdfe64d30bee",
    "templateCredsSetupCompleted": true
  },
  "name": "Gmail 整理器",
  "tags": [],
  "nodes": [
    {
      "id": "a81015eb-1a7b-4832-8506-f84835713f21",
      "name": "收到新邮件",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        -1380,
        100
      ],
      "parameters": {
        "simple": false,
        "filters": {},
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "9ab80617-5aa2-4c1a-9d5a-aab0c4387a45",
      "name": "按内容分类邮件",
      "type": "n8n-nodes-base.switch",
      "position": [
        -1080,
        100
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "Work Emails",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": false,
                  "typeValidation": "strict"
                },
                "combinator": "or",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "contains"
                    },
                    "leftValue": "={{ $json.from }}",
                    "rightValue": "@company.com"
                  },
                  {
                    "operator": {
                      "type": "string",
                      "operation": "contains"
                    },
                    "leftValue": "={{ $json.from }}",
                    "rightValue": "work"
                  },
                  {
                    "operator": {
                      "type": "string",
                      "operation": "contains"
                    },
                    "leftValue": "={{ $json.subject }}",
                    "rightValue": "meeting"
                  },
                  {
                    "operator": {
                      "type": "string",
                      "operation": "contains"
                    },
                    "leftValue": "={{ $json.subject }}",
                    "rightValue": "project"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Shopping Orders",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": false,
                  "typeValidation": "strict"
                },
                "combinator": "or",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "contains"
                    },
                    "leftValue": "={{ $json.from }}",
                    "rightValue": "amazon"
                  },
                  {
                    "operator": {
                      "type": "string",
                      "operation": "contains"
                    },
                    "leftValue": "={{ $json.from }}",
                    "rightValue": "shop"
                  },
                  {
                    "operator": {
                      "type": "string",
                      "operation": "contains"
                    },
                    "leftValue": "={{ $json.subject }}",
                    "rightValue": "order"
                  },
                  {
                    "operator": {
                      "type": "string",
                      "operation": "contains"
                    },
                    "leftValue": "={{ $json.subject }}",
                    "rightValue": "receipt"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Newsletters",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": false,
                  "typeValidation": "strict"
                },
                "combinator": "or",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "contains"
                    },
                    "leftValue": "={{ $json.subject }}",
                    "rightValue": "newsletter"
                  },
                  {
                    "operator": {
                      "type": "string",
                      "operation": "contains"
                    },
                    "leftValue": "={{ $json.subject }}",
                    "rightValue": "unsubscribe"
                  },
                  {
                    "operator": {
                      "type": "string",
                      "operation": "contains"
                    },
                    "leftValue": "={{ $json.from }}",
                    "rightValue": "noreply"
                  },
                  {
                    "operator": {
                      "type": "string",
                      "operation": "contains"
                    },
                    "leftValue": "={{ $json.from }}",
                    "rightValue": "no-reply"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "ab60dc70-310e-4e7f-97d5-21a29d2c771d",
      "name": "应用工作标签",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -780,
        -60
      ],
      "webhookId": "5811f32f-af7e-42f2-8879-229732f87e08",
      "parameters": {
        "labelIds": [
          "Work"
        ],
        "messageId": "={{ $json.id }}",
        "operation": "addLabels"
      },
      "typeVersion": 2.1
    },
    {
      "id": "6d74ae5c-fd8b-4b6f-8cb8-7500dd88e091",
      "name": "应用购物标签",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -780,
        100
      ],
      "webhookId": "b0698510-399f-458b-8d6e-c25e77ae99ab",
      "parameters": {
        "labelIds": [
          "Shopping"
        ],
        "messageId": "={{ $json.id }}",
        "operation": "addLabels"
      },
      "typeVersion": 2.1
    },
    {
      "id": "f365dfaf-18b3-46e4-9d3a-bebefa47e422",
      "name": "应用新闻通讯标签",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -780,
        240
      ],
      "webhookId": "d919fdfa-29bb-4e93-a14d-67d03add6d5e",
      "parameters": {
        "labelIds": [
          "Newsletter"
        ],
        "messageId": "={{ $json.id }}",
        "operation": "addLabels"
      },
      "typeVersion": 2.1
    },
    {
      "id": "1b9ca166-9430-427f-9179-0ca6fcca702c",
      "name": "标记工作邮件为重要",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -480,
        -60
      ],
      "webhookId": "b22b979e-a84c-465c-8c19-fef43732b80e",
      "parameters": {
        "operation": "markAsImportant"
      },
      "typeVersion": 2.1
    },
    {
      "id": "814ee0b2-f75a-49aa-9fb4-87424b73d199",
      "name": "归档新闻通讯邮件",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -480,
        240
      ],
      "webhookId": "2578e1a0-654d-42a9-baee-45c7fa5a5cd4",
      "parameters": {
        "labelIds": [
          "ARCHIVE"
        ],
        "messageId": "={{ $json.id }}",
        "operation": "addLabels"
      },
      "typeVersion": 2.1
    },
    {
      "id": "266c2c00-6ec6-42b6-bf45-24717edc1bb9",
      "name": "主工作流说明",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2020,
        -400
      ],
      "parameters": {
        "color": 4,
        "width": 450,
        "height": 1000,
        "content": "# 📧 Gmail 智能邮件整理器"
      },
      "typeVersion": 1
    },
    {
      "id": "5f96a973-6add-441e-a509-b4e94e33342e",
      "name": "步骤 1 - 邮件检测",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1400,
        -380
      ],
      "parameters": {
        "color": 7,
        "width": 300,
        "height": 260,
        "content": "## 步骤 1:邮件检测"
      },
      "typeVersion": 1
    },
    {
      "id": "0ea0e02b-fdfd-434d-a731-7c665bff1701",
      "name": "步骤 2 - 智能分类",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -880,
        -420
      ],
      "parameters": {
        "color": 7,
        "width": 300,
        "height": 280,
        "content": "## 步骤 2:智能分类"
      },
      "typeVersion": 1
    },
    {
      "id": "277ab3e7-95a6-4df3-ac77-e5cf37df1c55",
      "name": "步骤 3 - 自动化操作",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -360,
        -380
      ],
      "parameters": {
        "color": 7,
        "width": 350,
        "height": 260,
        "content": "## 步骤 3:自动化操作"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "637565f8-6faf-45a0-a198-419d4f89973e",
  "connections": {
    "Apply Work Label": {
      "main": [
        [
          {
            "node": "Mark Work Email as Important",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "New Email Received": {
      "main": [
        [
          {
            "node": "Categorize Email by Content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Apply Newsletter Label": {
      "main": [
        [
          {
            "node": "Archive Newsletter Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Categorize Email by Content": {
      "main": [
        [
          {
            "node": "Apply Work Label",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Apply Shopping Label",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Apply Newsletter Label",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

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

需要付费吗?

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

工作流信息
难度等级
中级
节点数量11
分类2
节点类型4
难度说明

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

外部链接
在 n8n.io 查看

分享此工作流