8
n8n 中文网amn8n.com

使用Gmail和Google日历自动安排邮件中的活动

中级

这是一个Personal Productivity, Multimodal AI领域的自动化工作流,包含 6 个节点。主要使用 If, Code, GmailTrigger, GoogleCalendar 等节点。 通过Gmail和Google日历关键词自动从邮件安排活动

前置要求
  • Google 账号和 Gmail API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "9H630Pk9Y2YFcnEl",
  "meta": {
    "instanceId": "a287613f1596da776459594685fbf4e2b4a12124f80ab8c8772f5e37bff103ae",
    "templateCredsSetupCompleted": true
  },
  "name": "使用 Gmail 和 Google 日历自动安排邮件中的活动",
  "tags": [],
  "nodes": [
    {
      "id": "5d985e91-a21f-43ed-b8c0-8628f84bcea1",
      "name": "监控新邮件",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        0,
        0
      ],
      "parameters": {
        "filters": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        }
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "QFfaHpKmgq4YPiRN",
          "name": "temp"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "c24f4ed6-363a-4064-982c-e5a4ca10a0a3",
      "name": "检查关键词",
      "type": "n8n-nodes-base.if",
      "position": [
        208,
        0
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "or",
          "conditions": [
            {
              "id": "fa1a4a02-f8ab-412f-8977-c924d8d96f81",
              "operator": {
                "type": "string",
                "operation": "contains"
              },
              "leftValue": "={{ $json.subject }}",
              "rightValue": "Meeting"
            },
            {
              "id": "cc6f7dd3-c2ce-4c44-b2cf-6263a73688dd",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.body }}",
              "rightValue": "Appoinment"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "424ba35e-c62b-4c17-896b-d718fb611b93",
      "name": "提取活动详情",
      "type": "n8n-nodes-base.code",
      "position": [
        448,
        0
      ],
      "parameters": {
        "jsCode": "const emailBody = $json.body;\n\n// Simple regex to find a date and time.\n// This is a basic example; more complex logic may be needed.\nconst dateMatch = emailBody.match(/\\b(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\\s+\\d{1,2}/i);\nconst timeMatch = emailBody.match(/\\d{1,2}:\\d{2}\\s?(am|pm)?/i);\n\nconst eventDetails = {\n    title: $json.subject,\n    date: dateMatch ? dateMatch[0] : 'today',\n    time: timeMatch ? timeMatch[0] : '9:00am'\n};\n\nreturn [{ json: eventDetails }];"
      },
      "typeVersion": 2
    },
    {
      "id": "20d9fdca-0ced-411f-a99b-284f45c2e6f0",
      "name": "创建事件",
      "type": "n8n-nodes-base.googleCalendar",
      "position": [
        656,
        0
      ],
      "parameters": {
        "end": "={{ $json.date }} {{ $json.time }}",
        "start": "={{ $json.date }} {{ $json.time }}",
        "calendar": {
          "__rl": true,
          "mode": "id",
          "value": "YOUR_CALENDAR_ID"
        },
        "additionalFields": {
          "summary": "={{ $json.title }}"
        }
      },
      "credentials": {
        "googleCalendarOAuth2Api": {
          "id": "qx4NhkM90xt1yRR5",
          "name": "temp"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "d009e8f8-5758-4be7-b6ee-c7d7e3dbce13",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -80,
        -64
      ],
      "parameters": {
        "width": 960,
        "height": 256,
        "content": "## 流程"
      },
      "typeVersion": 1
    },
    {
      "id": "ad6ae0d0-f03a-4186-afe3-222b7241a76c",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -80,
        224
      ],
      "parameters": {
        "color": 3,
        "width": 960,
        "height": 1104,
        "content": "# 工作流程说明:从邮件自动安排活动"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "8a1bc662-421a-4c5b-8106-d66615647570",
  "connections": {
    "Check for Keywords": {
      "main": [
        [
          {
            "node": "Extract Event Details",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Watch for New Emails": {
      "main": [
        [
          {
            "node": "Check for Keywords",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Event Details": {
      "main": [
        [
          {
            "node": "Create Event",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

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

需要付费吗?

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

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

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

作者
Marth

Marth

@marth

Simplifying Business with Smart Automation. I create and share user-friendly, highly efficient n8n workflow templates for SMEs, focusing on digital marketing, sales, and operational excellence. Get ready to automate, innovate, and elevate your business. Connect me on Linkedin for custom solutions.

外部链接
在 n8n.io 查看

分享此工作流