8
n8n 中文网amn8n.com

使用AI从带标签的Gmail邮件创建Google Calendar事件

中级

这是一个Personal Productivity, Multimodal AI领域的自动化工作流,包含 11 个节点。主要使用 Gmail, GmailTrigger, GoogleCalendar, Agent, LmChatGoogleGemini 等节点。 通过Google Gemini AI从带标签的Gmail邮件创建Google Calendar事件

前置要求
  • Google 账号和 Gmail API 凭证
  • Google Gemini API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "VF6PzqKpoe5DTKoL",
  "meta": {
    "instanceId": "be79f1890bffac61332dc21f63c1b5526497b6c8770d5a97e4dc9253155e34c2",
    "templateCredsSetupCompleted": true
  },
  "name": "使用 AI 从带标签的 Gmail 邮件创建 Google Calendar 事件",
  "tags": [],
  "nodes": [
    {
      "id": "64518e77-91fe-40ee-b5c8-94daf87cdd26",
      "name": "工作流描述",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        416,
        -340
      ],
      "parameters": {
        "color": 1,
        "width": 700,
        "height": 700,
        "content": "## 使用 AI 从带标签的 Gmail 邮件创建 Google Calendar 事件"
      }
    },
    {
      "id": "47fd7701-2381-442f-9cdc-349d483c8c64",
      "name": "创建 Google Calendar 事件",
      "type": "n8n-nodes-base.googleCalendar",
      "position": [
        896,
        304
      ],
      "parameters": {
        "end": "={{ $json.output.end.dateTime }}",
        "start": "={{ $json.output.start.dateTime }}",
        "calendar": {
          "__rl": true,
          "mode": "id",
          "value": "primary"
        },
        "additionalFields": {
          "summary": "={{ $json.output.summary }}",
          "location": "={{ $json.output.location }}",
          "description": "={{ $json.output.description }}"
        }
      }
    },
    {
      "id": "14a3e816-9995-44f6-8679-0ba3318dd515",
      "name": "发送确认邮件",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1120,
        304
      ],
      "parameters": {
        "sendTo": "YOUR_EMAIL_ADDRESS",
        "message": "=<html><body>\n    <p>An event has been created in your Google Calendar with the following details.</p>\n    <hr>\n    <h2>Event Summary:</h2>\n    <p><strong>Title:</strong> {{ $json.summary }}</p>\n    <p><strong>Time:</strong> {{ new Date($json.start.dateTime).toLocaleString() }} - {{ new Date($json.end.dateTime).toLocaleString() }}</p>\n    <p><strong>Location:</strong> {{ $json.location }}</p>\n    <p><strong>Description:</strong><br>{{ $json.description.replace(/\\n/g, '<br>') }}</p>\n    <p><a href=\"{{ $json.htmlLink }}\">Edit in Google Calendar</a></p>\n    <hr>\n    <h2>Original Email Content:</h2>\n    <pre>{{ $json.description }}</pre>\n</body></html>",
        "options": {
          "attachmentsUi": {
            "values": []
          },
          "appendAttribution": false
        },
        "subject": "=Event Created in Google Calendar: {{ $json.summary }}"
      }
    },
    {
      "id": "afd18080-dbe2-402d-8e0f-1cb1439dcc1c",
      "name": "Gmail 触发器",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        272,
        304
      ],
      "parameters": {
        "simple": false,
        "filters": {
          "labelIds": []
        },
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "2da76e21-c4cb-4a50-83a9-e8575fbeb416",
      "name": "使用 AI 解析事件",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        496,
        304
      ],
      "parameters": {
        "text": "=Extract the Google Calendar event information from the following email content into JSON format.\n\nJSON format:\n{\n  \"summary\": \"Event title (e.g., Meeting, Appointment, Task)\",\n  \"start\": { \"dateTime\": \"YYYY-MM-DDTHH:MM:SS+09:00\" },\n  \"end\": { \"dateTime\": \"YYYY-MM-DDTHH:MM:SS+09:00\" },\n  \"location\": \"Location (e.g., URL for online meetings, Meeting Room A, Cafe)\",\n  \"description\": \"Detailed description of the event (should contain the original email content)\"\n}\n\nIf the date and time are not explicit, infer them based on the current time or set the most likely period. Use 24-hour format for time. Please ensure the timezone is correct for your location (e.g., change 'JST (UTC+9)' if needed). The location is optional.\n\nEmail content:\n{{$json[\"text\"]}}",
        "options": {},
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2.1
    },
    {
      "id": "b53b7775-c167-442e-be5d-c4f60e546b69",
      "name": "结构化输出解析器",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        656,
        528
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"summary\": \"Event title (e.g., Meeting, Appointment, Task)\",\n  \"start\": { \"dateTime\": \"YYYY-MM-DDTHH:MM:SS+09:00\" },\n  \"end\": { \"dateTime\": \"YYYY-MM-DDTHH:MM:SS+09:00\" },\n  \"location\": \"Location (e.g., URL for online meetings, Meeting Room A, Cafe)\",\n  \"description\": \"Detailed description of the event (e.g., the original email content)\"\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "89203420-d082-4f9e-b7cf-1338564a9804",
      "name": "Google Gemini聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        528,
        528
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "4a13fd28-3b5c-4bec-9989-fd5543f90131",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        208,
        208
      ],
      "parameters": {
        "width": 224,
        "height": 256,
        "content": "## 1. 邮件触发器"
      },
      "typeVersion": 1
    },
    {
      "id": "d50510c0-7d34-4730-9c63-bbe77b3d2436",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        472,
        208
      ],
      "parameters": {
        "width": 320,
        "height": 256,
        "content": "## 2. 使用 AI 解析事件"
      },
      "typeVersion": 1
    },
    {
      "id": "c40078b0-cf09-458c-9b42-4436771c299b",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        832,
        208
      ],
      "parameters": {
        "width": 224,
        "height": 256,
        "content": "## 3. 创建日历事件"
      },
      "typeVersion": 1
    },
    {
      "id": "ead2ae4f-28c8-4473-8192-2fbaf6c3ac83",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1088,
        208
      ],
      "parameters": {
        "width": 224,
        "height": 256,
        "content": "## 4. 发送确认邮件"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "27ede62c-79ed-4e33-b0e5-7d5bea5a21e1",
  "connections": {
    "afd18080-dbe2-402d-8e0f-1cb1439dcc1c": {
      "main": [
        [
          {
            "node": "2da76e21-c4cb-4a50-83a9-e8575fbeb416",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "2da76e21-c4cb-4a50-83a9-e8575fbeb416": {
      "main": [
        [
          {
            "node": "47fd7701-2381-442f-9cdc-349d483c8c64",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "89203420-d082-4f9e-b7cf-1338564a9804": {
      "ai_languageModel": [
        [
          {
            "node": "2da76e21-c4cb-4a50-83a9-e8575fbeb416",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "b53b7775-c167-442e-be5d-c4f60e546b69": {
      "ai_outputParser": [
        [
          {
            "node": "2da76e21-c4cb-4a50-83a9-e8575fbeb416",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "47fd7701-2381-442f-9cdc-349d483c8c64": {
      "main": [
        [
          {
            "node": "14a3e816-9995-44f6-8679-0ba3318dd515",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 个人效率, 多模态 AI

需要付费吗?

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

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

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

作者
nobu

nobu

@nobu

As a business coach, I provide comprehensive support that goes beyond automation. I empower companies to implement lasting change by reforming their corporate culture from the ground up. For work-related inquiries and consultations, please follow the link on my profile page.

外部链接
在 n8n.io 查看

分享此工作流

分类

分类: 34