8
n8n 中文网amn8n.com

AI 与人工协同的自动跟进提醒(Gmail)

高级

这是一个AI领域的自动化工作流,包含 22 个节点。主要使用 Set, Gmail, Filter, GoogleCalendar, SplitInBatches 等节点,结合人工智能技术实现智能自动化。 AI 与人工协同的自动跟进提醒(Gmail)

前置要求
  • Google 账号和 Gmail API 凭证
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "408f9fb9940c3cb18ffdef0e0150fe342d6e655c3a9fac21f0f644e8bedabcd9",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "cbc2ee05-3bb9-4064-ac26-fed7241e673f",
      "name": "计划触发器",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -460,
        0
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 6
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "4a18dea4-9eda-4b8e-9d0c-fff9793802c5",
      "name": "获取过去事件",
      "type": "n8n-nodes-base.googleCalendar",
      "position": [
        -280,
        0
      ],
      "parameters": {
        "options": {},
        "timeMax": "={{ $now.minus({ day: 2 }) }}",
        "timeMin": "={{ $now.minus({ day: 4 }) }}",
        "calendar": {
          "__rl": true,
          "mode": "id",
          "value": "<your-calendar>"
        },
        "operation": "getAll"
      },
      "credentials": {
        "googleCalendarOAuth2Api": {
          "id": "kWMxmDbMDDJoYFVK",
          "name": "Google Calendar account"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "df2ef6d0-5fcb-43c5-8ba9-2d094dffb4e1",
      "name": "遍历项目",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        200,
        40
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "bedc77ad-f0c9-47ae-9609-48ceda47a224",
      "name": "待跟进标记",
      "type": "n8n-nodes-base.set",
      "position": [
        580,
        200
      ],
      "parameters": {
        "mode": "raw",
        "options": {},
        "jsonOutput": "={{\n{\n  ...$('Loop Over Items').first().json,\n  followUp: $json.isEmpty()\n}\n}}",
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "b332ca5d-45d5-4a79-a028-baa1728aea78",
      "name": "仅限跟进事项",
      "type": "n8n-nodes-base.filter",
      "position": [
        400,
        40
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "73f38d1b-75c6-4372-8e81-a2db61b045a8",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "1b8a6510-f1c5-4969-a68d-143874b5737d",
      "name": "获取自某时起的邮件",
      "type": "n8n-nodes-base.gmail",
      "position": [
        400,
        200
      ],
      "webhookId": "08fbccff-cce6-461a-b040-f5a74920c803",
      "parameters": {
        "limit": 1,
        "filters": {
          "q": "=(from:{{ $json.attendees.find(attendee => !attendee.self)?.email }} OR to:{{ $json.attendees.find(attendee => !attendee.self)?.email }})",
          "receivedAfter": "={{ $json.end.dateTime }}"
        },
        "resource": "thread"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "Sf5Gfl9NiFTNXFWb",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1,
      "alwaysOutputData": true
    },
    {
      "id": "4ce7ac3f-bad8-4822-b166-fd164d733734",
      "name": "输出",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1140,
        220
      ],
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n  \"type\": \"object\",\n  \"properties\": {\n    \"slots\": {\n      \"type\": \"array\",\n      \"items\": {\n        \"type\": \"object\",\n        \"properties\": {\n          \"start\": { \"type\": \"string\" },\n          \"end\": { \"type\": \"string\" }\n        }\n      }\n    }\n  }\n}"
      },
      "typeVersion": 1.2
    },
    {
      "id": "a22c5b78-d213-4e37-b2c6-f3d1dac96858",
      "name": "可用性",
      "type": "n8n-nodes-base.googleCalendarTool",
      "position": [
        1020,
        220
      ],
      "parameters": {
        "options": {
          "timezone": {
            "__rl": true,
            "mode": "id",
            "value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Timezone', ``, 'string') }}",
            "__regex": "([-+/_a-zA-Z0-9]*)"
          }
        },
        "timeMax": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('End_Time', ``, 'string') }}",
        "timeMin": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Start_Time', ``, 'string') }}",
        "calendar": {
          "__rl": true,
          "mode": "id",
          "value": "<your-calendar>"
        },
        "resource": "calendar"
      },
      "credentials": {
        "googleCalendarOAuth2Api": {
          "id": "kWMxmDbMDDJoYFVK",
          "name": "Google Calendar account"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "690c79d3-cf0e-4d15-9419-dafb7d86025b",
      "name": "模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        900,
        220
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "8gccIjcuf3gvaoEr",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "4e9d23c0-f9a0-4e71-b1b8-1011313942ba",
      "name": "会议可用性代理",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        920,
        40
      ],
      "parameters": {
        "text": "=### Details of the previous call as following\ntitle: {{ $json.summary }}\ndate: {{ $json.start.dateTime }} {{ $json.start.timeZone }}\nduration: {{ DateTime.fromISO($json.end.dateTime).diffTo(DateTime.fromISO($json.start.dateTime), 'minutes') }} minutes",
        "options": {
          "systemMessage": "=You are a calendar availability assistant. Analyse the previous meeting and help me find a similar available slot for the next meeting.\n* take into consideration the day, time of day and duration of the previous meeting and try to set the same or similar for the next\n* next meeting should be in the future.\n* return a list of available slots so that I can forward them to the user.\n\nToday's date is {{ $now }}."
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.7
    },
    {
      "id": "851728bf-7f94-4434-9dc6-23569544cdb7",
      "name": "生成消息",
      "type": "n8n-nodes-base.set",
      "position": [
        1260,
        40
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "cf09c95c-f25e-4fd7-bade-a0feaeaffb3b",
              "name": "message",
              "type": "string",
              "value": "=Hey, just noticed there wasn't a follow-up email to {{ $('Only Follow Ups').item.json.attendees.find(x => !x.self).email }} after your last call a few days ago.\n\nHere's are a few available slots to book the next call.\n{{\n$json.output.slots\n  .filter(slot => !DateTime.fromISO(slot.start).isWeekend())\n  .map(slot => `* ${DateTime.fromISO(slot.start).format('cccc, DDD @ hh:mm')} - ${DateTime.fromISO(slot.end).format('hh:mm')}`)\n.join('\\n')\n}}\n\nLet me know which I should book or let me know if it's okay to dismiss."
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "7e45eddc-8c34-402a-86a2-ed89ff463095",
      "name": "会议",
      "type": "n8n-nodes-base.googleCalendarTool",
      "position": [
        2360,
        240
      ],
      "parameters": {
        "end": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('End', ``, 'string') }}",
        "start": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Start', ``, 'string') }}",
        "calendar": {
          "__rl": true,
          "mode": "id",
          "value": "<your-calendar>"
        },
        "additionalFields": {
          "summary": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Summary', ``, 'string') }}",
          "description": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Description', ``, 'string') }}"
        }
      },
      "credentials": {
        "googleCalendarOAuth2Api": {
          "id": "kWMxmDbMDDJoYFVK",
          "name": "Google Calendar account"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "74618cf0-1fe5-4abb-ba38-6818162ce826",
      "name": "模型1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        2180,
        240
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "8gccIjcuf3gvaoEr",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "790cc7ee-fe1b-434f-8736-38952bffbb85",
      "name": "会议预订代理",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        2180,
        60
      ],
      "parameters": {
        "text": "={{ $json.data.text }}",
        "options": {
          "systemMessage": "=You are a meeting booking agent. Your task is to book the meeting requested if confirmed by the user or otherwise do nothing if the user wants to disregard. No need to ask for further approval.\n\nAI: {{ $('Generate Message').first().json.message }}"
        },
        "promptType": "define"
      },
      "typeVersion": 1.7
    },
    {
      "id": "7ed171b2-08ee-49b0-9f9b-b4943549b2f6",
      "name": "标记为已读",
      "type": "n8n-nodes-base.removeDuplicates",
      "position": [
        -100,
        0
      ],
      "parameters": {
        "options": {},
        "operation": "removeItemsSeenInPreviousExecutions",
        "dedupeValue": "={{ $json.id }}"
      },
      "typeVersion": 2
    },
    {
      "id": "c8198538-4e02-429d-9fef-4cc2cb0bb7d0",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -540,
        -200
      ],
      "parameters": {
        "color": 7,
        "width": 620,
        "height": 420,
        "content": "## 1. 获取近期会议"
      },
      "typeVersion": 1
    },
    {
      "id": "ef4888e2-249f-4501-a731-4dc8886dfa1a",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        100,
        -160
      ],
      "parameters": {
        "color": 7,
        "width": 680,
        "height": 600,
        "content": "## 2. 检查此后是否有任何消息"
      },
      "typeVersion": 1
    },
    {
      "id": "d9ccc4d5-2ccb-4f85-ada1-6a6fc5374ff2",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        800,
        -160
      ],
      "parameters": {
        "color": 7,
        "width": 620,
        "height": 580,
        "content": "## 3. 建议下一次通话的可用时间"
      },
      "typeVersion": 1
    },
    {
      "id": "851b15f6-ea6a-4d30-a45b-f9ed087a37fa",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1440,
        -200
      ],
      "parameters": {
        "color": 7,
        "width": 540,
        "height": 520,
        "content": "## 4. 获取人工批准"
      },
      "typeVersion": 1
    },
    {
      "id": "725b187f-d59b-4a7d-bf11-6265a4c995ed",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2000,
        -160
      ],
      "parameters": {
        "color": 7,
        "width": 640,
        "height": 560,
        "content": "## 5. 如果接受则预订会议"
      },
      "typeVersion": 1
    },
    {
      "id": "ae59a45a-01e9-42be-99da-f75ed90f881b",
      "name": "便签5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1000,
        -700
      ],
      "parameters": {
        "width": 420,
        "height": 980,
        "content": "## 试试看!"
      },
      "typeVersion": 1
    },
    {
      "id": "46ef7220-49ea-4dfc-8e4c-ce7da5119daf",
      "name": "发送供人工批准",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1660,
        80
      ],
      "webhookId": "76b88312-1c54-482e-abdd-e699159577f0",
      "parameters": {
        "sendTo": "=<your-email-here>",
        "message": "={{ $json.message }}",
        "options": {},
        "subject": "=Book a follow-up meeting with {{ $('Only Follow Ups').item.json.attendees.find(x => !x.self).email }}?",
        "operation": "sendAndWait",
        "responseType": "freeText"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "Sf5Gfl9NiFTNXFWb",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    }
  ],
  "pinData": {},
  "connections": {
    "Model": {
      "ai_languageModel": [
        [
          {
            "node": "Meeting Availability Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Meeting Booking Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Output": {
      "ai_outputParser": [
        [
          {
            "node": "Meeting Availability Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Meetings": {
      "ai_tool": [
        [
          {
            "node": "Meeting Booking Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Availability": {
      "ai_tool": [
        [
          {
            "node": "Meeting Availability Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Mark as Seen": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Past Events": {
      "main": [
        [
          {
            "node": "Mark as Seen",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [
          {
            "node": "Only Follow Ups",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get Emails Since",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Only Follow Ups": {
      "main": [
        [
          {
            "node": "Meeting Availability Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Message": {
      "main": [
        [
          {
            "node": "Send for Human Approval",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Emails Since": {
      "main": [
        [
          {
            "node": "Flag to Follow Up",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Get Past Events",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Flag to Follow Up": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send for Human Approval": {
      "main": [
        [
          {
            "node": "Meeting Booking Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Meeting Availability Agent": {
      "main": [
        [
          {
            "node": "Generate Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 人工智能

需要付费吗?

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

工作流信息
难度等级
高级
节点数量22
分类1
节点类型12
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

作者
Jimleuk

Jimleuk

@jimleuk

Freelance consultant based in the UK specialising in AI-powered automations. I work with select clients tackling their most challenging projects. For business enquiries, send me an email at hello@jimle.uk LinkedIn: https://www.linkedin.com/in/jimleuk/ X/Twitter: https://x.com/jimle_uk

外部链接
在 n8n.io 查看

分享此工作流