8
n8n 中文网amn8n.com

Gmail到Slack:AI摘要邮件提醒

中级

这是一个AI Summarization, Multimodal AI领域的自动化工作流,包含 10 个节点。主要使用 Gmail, Slack, GmailTrigger, Agent, LmChatOpenAi 等节点。 使用GPT-4o和Gmail发送AI摘要未读邮件提醒到Slack

前置要求
  • Google 账号和 Gmail API 凭证
  • Slack Bot Token 或 Webhook URL
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移

无法加载工作流预览

导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "name": "Gmail 到 Slack:AI 摘要邮件提醒",
  "nodes": [
    {
      "name": "未读邮件触发器",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        0,
        0
      ],
      "parameters": {
        "filters": {
          "readStatus": "unread"
        },
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        }
      },
      "typeVersion": 1.3
    },
    {
      "name": "获取邮箱",
      "type": "n8n-nodes-base.gmail",
      "position": [
        224,
        0
      ],
      "parameters": {
        "simple": false,
        "options": {},
        "messageId": "={{ $json.id }}",
        "operation": "get"
      },
      "typeVersion": 2.1
    },
    {
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        448,
        0
      ],
      "parameters": {
        "text": "=You are an assistant that summarises emails. \nSummarise the following email into a concise message (max 250 characters).\n\nYour output must be valid JSON with exactly two fields:\n- \"sender\": the sender’s name\n- \"summary\": the 250-character summary\n\nHere is the required output format:\n{\n  \"sender\": \"Example Sender\",\n  \"summary\": \"Example summary of the email, no more than 250 characters.\"\n}\n\nEmail content:\n{{ $json[\"text\"] }}",
        "options": {},
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2.2
    },
    {
      "name": "OpenAI 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        464,
        224
      ],
      "parameters": {
        "model": {
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "typeVersion": 1.2
    },
    {
      "name": "结构化输出解析器",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        592,
        224
      ],
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n  \"type\": \"object\",\n  \"properties\": {\n    \"sender\": {\n      \"type\": \"string\",\n      \"description\": \"The sender’s name from the email\"\n    },\n    \"summary\": {\n      \"type\": \"string\",\n      \"maxLength\": 250,\n      \"description\": \"A concise summary of the email content\"\n    }\n  },\n  \"required\": [\"sender\", \"summary\"],\n  \"additionalProperties\": false\n}"
      },
      "typeVersion": 1.3
    },
    {
      "name": "发送通知到 Slack",
      "type": "n8n-nodes-base.slack",
      "position": [
        800,
        0
      ],
      "parameters": {
        "text": "={{ $json.output.sender }}: {{ $json.output.summary }}",
        "select": "user",
        "otherOptions": {
          "includeLinkToWorkflow": false
        },
        "authentication": "oAuth2"
      },
      "typeVersion": 2.3
    },
    {
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -192,
        304
      ],
      "parameters": {
        "width": 272,
        "height": 128,
        "content": "### 🛠️ 首先连接凭据"
      },
      "typeVersion": 1
    },
    {
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -80,
        -128
      ],
      "parameters": {
        "color": 5,
        "width": 272,
        "height": 304,
        "content": "### 🔁 调整频率"
      },
      "typeVersion": 1
    },
    {
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        368,
        -224
      ],
      "parameters": {
        "color": 5,
        "width": 336,
        "height": 608,
        "content": "### 🧪 调整 AI 摘要"
      },
      "typeVersion": 1
    },
    {
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        720,
        -224
      ],
      "parameters": {
        "color": 5,
        "width": 256,
        "height": 608,
        "content": "### 📣 Slack 通知提示"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "connections": {
    "AI Agent": {
      "main": [
        [
          {
            "node": "Send Notification to Slack",
            "type": "main",
            "index": 0
          }
        ]
      ],
      "ai_outputParser": [
        [
          {
            "node": "Structured Output Parser",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ],
      "ai_languageModel": [
        [
          {
            "node": "OpenAI Chat Model",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Get Email": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Trigger on Unread Email": {
      "main": [
        [
          {
            "node": "Get Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

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

需要付费吗?

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

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

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

作者
Matt Chong | n8n Creator

Matt Chong | n8n Creator

@mattxchong

Automation nerd fueled by good coffee, deep curiosity, and clean flows.

外部链接
在 n8n.io 查看

分享此工作流