📨 Gmail邮件AI摘要发送至Telegram

中级

这是一个Other、AI领域的自动化工作流,包含 7 个节点。主要使用 Set、Telegram、GmailTrigger、Agent、LmChatOpenAi 等节点,结合人工智能技术实现智能自动化。 Gmail到Telegram:使用OpenAI GPT-4o的邮件摘要

前置要求
  • Telegram Bot Token
  • Google 账号和 Gmail API 凭证
  • OpenAI API Key

分类

工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "c0Ti00TfFE1MdpZd",
  "meta": {
    "instanceId": "a059b3dfdab56aa587cc6a2c8635f6f2700cf0c7064dbfb5981c26f7ad9eab88",
    "templateCredsSetupCompleted": true
  },
  "name": "📨 将来自 Gmail 的收件邮件 AI 摘要发送到 Telegram",
  "tags": [],
  "nodes": [
    {
      "id": "28581eaf-47f8-43ad-81cf-688d8f77a630",
      "name": "为智能体准备字段",
      "type": "n8n-nodes-base.set",
      "position": [
        -80,
        -160
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "ffff425d-cd86-498a-9984-d4c97c082a7b",
              "name": "summary_language",
              "type": "string",
              "value": "={{ $json.summary_language }}"
            },
            {
              "id": "a6dc9f16-faa1-4d82-be3c-b80937563605",
              "name": "from",
              "type": "string",
              "value": "={{ $json.from?.text || $json.from?.value?.[0]?.address || 'Unknown sender' }}"
            },
            {
              "id": "c4f8daff-77e0-453f-82c2-751a8d6b8061",
              "name": "subject",
              "type": "string",
              "value": "={{ $json.subject }}"
            },
            {
              "id": "43c37703-1f05-4f20-9d6f-0f7c08be6462",
              "name": "message",
              "type": "string",
              "value": "={{ $json.html || $json.text || 'No message content available' }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "f72c5973-cc9d-4815-993c-ed7bd853fcc4",
      "name": "当新邮件到达时",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        -520,
        -160
      ],
      "parameters": {
        "simple": false,
        "filters": {},
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        }
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "52DG6yepye2Q3ivM",
          "name": "Main email"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "95fb2d1e-efbb-4163-9e75-b85cf3fd50bf",
      "name": "设置摘要语言",
      "type": "n8n-nodes-base.set",
      "position": [
        -300,
        -160
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "148dcae1-3b72-4c28-b143-18b4b9877295",
              "name": "summary_language",
              "type": "string",
              "value": "english"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "8db9747f-c0a6-4044-837a-04212c8dbe56",
      "name": "OpenAI 模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        228,
        60
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "hezW67W6g8iheWed",
          "name": "OpenAI"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "8823b3ab-4e9b-4be6-bf6c-9772f1fcd17e",
      "name": "发送摘要到 Telegram",
      "type": "n8n-nodes-base.telegram",
      "position": [
        516,
        -160
      ],
      "webhookId": "b38c3ed8-da48-4c6c-b5a3-181889dd3dd3",
      "parameters": {
        "text": "={{ $json.output }}",
        "chatId": "SAMPLE CHAT ID - CHANGE IT",
        "additionalFields": {
          "parse_mode": "Markdown",
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "tFFmBDMsBJhTfMxK",
          "name": "Sample Telegram account"
        }
      },
      "retryOnFail": true,
      "typeVersion": 1.2,
      "waitBetweenTries": 3000
    },
    {
      "id": "ad603819-26e0-41e8-b4bb-99d30cbc4902",
      "name": "摘要生成智能体",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        140,
        -160
      ],
      "parameters": {
        "text": "=Summarize the following email in this language: {{ $json.summary_language }}\n\nFrom: {{ $json.from }}\nSubject: {{ $json.subject }}\n\n{{ $json.message }}",
        "options": {
          "systemMessage": "You summarize emails in a short, natural, and informal way. Use a casual tone, like you're talking to a friend. Always write in the language specified by the user. Include who sent the email, what it’s about, the most relevant details (like purchase info, prices, discounts, dates, or refund conditions), and ignore anything redundant or overly formal. Avoid robotic language, lists, or instructions like “keep this email.” Just say what matters."
        },
        "promptType": "define"
      },
      "retryOnFail": true,
      "typeVersion": 1.9,
      "waitBetweenTries": 3000
    },
    {
      "id": "89b1c4b0-3de4-4a81-a57b-a5e4951ea654",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -540,
        -680
      ],
      "parameters": {
        "color": 5,
        "width": 1240,
        "height": 480,
        "content": "## 📨 将来自 Gmail 的收件邮件 AI 摘要发送到 Telegram"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "callerPolicy": "workflowsFromSameOwner",
    "executionOrder": "v1",
    "executionTimeout": -1
  },
  "versionId": "c6cbf099-6fdf-45c0-bb63-32132f175d10",
  "connections": {
    "OpenAI Model": {
      "ai_languageModel": [
        [
          {
            "node": "Summary generation agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Set summary language": {
      "main": [
        [
          {
            "node": "Prepare fields for agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare fields for agent": {
      "main": [
        [
          {
            "node": "Summary generation agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Summary generation agent": {
      "main": [
        [
          {
            "node": "Send summary to Telegram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When a new email arrives": {
      "main": [
        [
          {
            "node": "Set summary language",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

这是一个中级难度的工作流,适用于Other、AI等场景。适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

需要付费吗?

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

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

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

作者
Lucía Maio Brioso

Lucía Maio Brioso

@luciamb

I'm a backend software developer who loves n8n ⚙️ I enjoy automating everything and share templates I personally find helpful 💡

外部链接
在 n8n.io 上查看 →

分享此工作流