8
n8n 中文网amn8n.com

使用OpenAI驱动的Outlook助手通过Slack管理日历事件

高级

这是一个AI领域的自动化工作流,包含 16 个节点。主要使用 If, Set, Slack, Webhook, Agent 等节点,结合人工智能技术实现智能自动化。 使用OpenAI驱动的Outlook助手通过Slack管理日历事件

前置要求
  • Slack Bot Token 或 Webhook URL
  • HTTP Webhook 端点(n8n 会自动生成)
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "408f9fb9940c3cb18ffdef0e0150fe342d6e655c3a9fac21f0f644e8bedabcd9",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "e37622d2-d9d4-4aff-8c0f-a2945e739ccd",
      "name": "OpenAI 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -180,
        40
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "8gccIjcuf3gvaoEr",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "702c21cf-6ca5-4b1b-8511-fd082152e50b",
      "name": "搜索所有 Outlook 事件",
      "type": "n8n-nodes-base.microsoftOutlookTool",
      "position": [
        180,
        40
      ],
      "webhookId": "486fda30-984a-4af6-990f-d5f30865fc29",
      "parameters": {
        "limit": 20,
        "filters": {
          "custom": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Filter_Query', ``, 'string') }}"
        },
        "resource": "event",
        "descriptionType": "manual",
        "toolDescription": "Call this tool to consume Microsoft Outlook API and fetch all outlook calendar events across all available calendars for a given filter."
      },
      "credentials": {
        "microsoftOutlookOAuth2Api": {
          "id": "EWg6sbhPKcM5y3Mr",
          "name": "Microsoft Outlook account"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "c4d7571d-0d96-42f5-a1dd-d2ee8e467731",
      "name": "创建新日历事件",
      "type": "n8n-nodes-base.microsoftOutlookTool",
      "position": [
        320,
        40
      ],
      "webhookId": "c4f72f45-2c3f-49cf-ac16-6b8fe701cc41",
      "parameters": {
        "subject": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Title', ``, 'string') }}",
        "resource": "event",
        "operation": "create",
        "calendarId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Calendar', ``, 'string') }}"
        },
        "endDateTime": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('End', ``, 'string') }}",
        "startDateTime": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Start', ``, 'string') }}",
        "descriptionType": "manual",
        "toolDescription": "Call this tool to consume Microsoft Outlook API and create a new outlook calendar event. Ensure the calendar ID exists before proceeding.",
        "additionalFields": {
          "body": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Description', ``, 'string') }}"
        }
      },
      "credentials": {
        "microsoftOutlookOAuth2Api": {
          "id": "EWg6sbhPKcM5y3Mr",
          "name": "Microsoft Outlook account"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "db5e44ab-7ec8-4831-9e41-34c963cd2314",
      "name": "获取可用日历",
      "type": "n8n-nodes-base.microsoftOutlookTool",
      "position": [
        460,
        40
      ],
      "webhookId": "605be4f6-e8c4-4350-9da9-55988b069c5d",
      "parameters": {
        "limit": 20,
        "filters": {},
        "resource": "calendar",
        "descriptionType": "manual",
        "toolDescription": "Call this tool to consume Microsoft Outlook API and fetch a list of available calendars."
      },
      "credentials": {
        "microsoftOutlookOAuth2Api": {
          "id": "EWg6sbhPKcM5y3Mr",
          "name": "Microsoft Outlook account"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "8102e365-eec4-48c6-986b-4ab8aac9e72a",
      "name": "简单记忆",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        -20,
        40
      ],
      "parameters": {
        "sessionKey": "={{ $json.ts }}_{{ $json.user }}",
        "sessionIdType": "customKey"
      },
      "typeVersion": 1.3
    },
    {
      "id": "ebd79d18-86b9-4e8b-9a27-f9878fd3d617",
      "name": "Outlook 日历助手",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -60,
        -180
      ],
      "parameters": {
        "text": "={{ $json.message.substr($json.message.indexOf('>')+1, 9999).trim() }}",
        "options": {
          "systemMessage": "=You are a helpful calendar assistant who can help users with calendar and event enquiries.\n* Today's date and time is {{ $now.toISO() }}."
        },
        "promptType": "define"
      },
      "typeVersion": 1.7
    },
    {
      "id": "f976cea5-be3e-4e14-89f5-b5d05d66f0c7",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1340,
        -860
      ],
      "parameters": {
        "width": 440,
        "height": 720,
        "content": "### 此 n8n 模板展示了如何轻松构建由配备工具的 AI 代理驱动的 Outlook 日历助手。"
      },
      "typeVersion": 1
    },
    {
      "id": "03083765-b3bb-42f6-8f30-7087687bc6eb",
      "name": "发送回复",
      "type": "n8n-nodes-base.slack",
      "position": [
        620,
        -180
      ],
      "webhookId": "68154e10-0b98-4d18-816c-2af8ab954694",
      "parameters": {
        "text": "={{ $json.output }}",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Get Message').item.json.channel }}"
        },
        "otherOptions": {
          "thread_ts": {
            "replyValues": {
              "thread_ts": "={{ $('Get Message').item.json.ts }}"
            }
          },
          "includeLinkToWorkflow": false
        }
      },
      "credentials": {
        "slackApi": {
          "id": "VfK3js0YdqBdQLGP",
          "name": "Slack account"
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "19c8e68b-2bf1-403a-a43d-cdc465233436",
      "name": "响应挑战",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        -240,
        -440
      ],
      "parameters": {
        "options": {},
        "respondWith": "text",
        "responseBody": "={{ $json.body.challenge }}"
      },
      "typeVersion": 1.1
    },
    {
      "id": "2b9f7d68-8e76-440b-9a8b-b9eb4fc7061c",
      "name": "是认证挑战吗?",
      "type": "n8n-nodes-base.if",
      "position": [
        -520,
        -300
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "cd56f5f2-dbb8-4cf0-83c8-f0566510ff51",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.body.challenge }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "c91350ef-5701-4188-8b1f-de12a0076a56",
      "name": "获取消息",
      "type": "n8n-nodes-base.set",
      "position": [
        -240,
        -180
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "44da9c3a-35eb-4636-9483-65492e858d96",
              "name": "ts",
              "type": "string",
              "value": "={{ $json.body.event.ts }}"
            },
            {
              "id": "761840aa-d2e3-4345-95bb-e7866b755880",
              "name": "message",
              "type": "string",
              "value": "={{ $json.body.event.text }}"
            },
            {
              "id": "094457fc-c149-4175-bed2-f0906cb70dea",
              "name": "is_bot",
              "type": "boolean",
              "value": "={{ $json.body.authorizations[0].is_bot }}"
            },
            {
              "id": "baf91a59-88fa-45fc-bfcb-ff27d0fe397d",
              "name": "user",
              "type": "string",
              "value": "={{ $json.body.event.user }}"
            },
            {
              "id": "abc6c16e-50e2-4154-9db9-4e12f9009d01",
              "name": "channel",
              "type": "string",
              "value": "={{ $json.body.event.channel }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "0681782d-21f3-4130-809c-188d83ebb7a9",
      "name": "当 BOT/APP 被提及时",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -800,
        -300
      ],
      "webhookId": "c63b08ce-360d-4185-aae1-294afef5cf2b",
      "parameters": {
        "path": "c63b08ce-360d-4185-aae1-294afef5cf2b",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "typeVersion": 2
    },
    {
      "id": "d0b12a70-e3e8-4149-98ba-dc2cf01f9953",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -800,
        -520
      ],
      "parameters": {
        "color": 7,
        "width": 380,
        "height": 180,
        "content": "## 1. 监听机器人提及"
      },
      "typeVersion": 1
    },
    {
      "id": "095fd13e-a660-46a8-95c6-b960083681f7",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        -440
      ],
      "parameters": {
        "color": 7,
        "width": 540,
        "height": 220,
        "content": "## 2. 配备 Outlook 日历工具的 AI 代理"
      },
      "typeVersion": 1
    },
    {
      "id": "3b2662a2-9a79-4848-89db-a5699942f39c",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        620,
        0
      ],
      "parameters": {
        "color": 7,
        "width": 400,
        "height": 200,
        "content": "## 3. 回复用户"
      },
      "typeVersion": 1
    },
    {
      "id": "f00e8727-12f2-4dad-8736-98bd0996f19a",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1340,
        -120
      ],
      "parameters": {
        "color": 5,
        "width": 440,
        "height": 340,
        "content": "### 设置 Slack 应用事件订阅"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "Get Message": {
      "main": [
        [
          {
            "node": "Outlook Calendar Assistant",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "Outlook Calendar Assistant",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Outlook Calendar Assistant",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Is Auth Challenge?": {
      "main": [
        [
          {
            "node": "Respond to Challenge",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On BOT/APP Mention": {
      "main": [
        [
          {
            "node": "Is Auth Challenge?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Available Calendars": {
      "ai_tool": [
        [
          {
            "node": "Outlook Calendar Assistant",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Create New Calendar Event": {
      "ai_tool": [
        [
          {
            "node": "Outlook Calendar Assistant",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Search All Outlook Events": {
      "ai_tool": [
        [
          {
            "node": "Outlook Calendar Assistant",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Outlook Calendar Assistant": {
      "main": [
        [
          {
            "node": "Send Reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 人工智能

需要付费吗?

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

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

适合高级用户,包含 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 查看

分享此工作流