8
n8n 中文网amn8n.com

使用 OpenAI 通过自然语言查询 Slack 频道历史记录

中级

这是一个AI RAG, Multimodal AI领域的自动化工作流,包含 9 个节点。主要使用 SlackTool, Agent, ChatTrigger, LmChatOpenAi 等节点。 使用 OpenAI 通过自然语言查询 Slack 频道历史记录

前置要求
  • Slack Bot Token 或 Webhook URL
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "ad0113c344ee237399e44e9f11798b05baeb83a6196d514a9ae9d2ad71c3b5c9",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "e2c58c94-6864-431d-a5e3-56ea2757cf10",
      "name": "Slack频道聊天机器人",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        192,
        -1328
      ],
      "parameters": {
        "options": {
          "systemMessage": "You are a helpful assistant. For all questions, get the slack channel history from the slack history tool. Do not make anythign up. Use only data in the slack tool to answer questions. "
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "bbb5baca-6411-4d41-8530-3aff0a228513",
      "name": "与Slack聊天",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -192,
        -944
      ],
      "webhookId": "d38a0072-420b-4de8-86b6-03a8f9a6e254",
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.3
    },
    {
      "id": "51c83a27-1e6d-4c46-bbaf-d34e5c14f707",
      "name": "便签53",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -256,
        -1344
      ],
      "parameters": {
        "color": 7,
        "width": 224,
        "height": 560,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "3e18db06-f194-4d48-b861-d4724cd83e22",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -816,
        -1568
      ],
      "parameters": {
        "width": 400,
        "height": 1056,
        "content": "## ⚙️ 设置说明"
      },
      "typeVersion": 1
    },
    {
      "id": "113a5a1d-3afb-4bbf-81c6-0e6602121f98",
      "name": "便签52",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        592,
        -1360
      ],
      "parameters": {
        "color": 3,
        "width": 224,
        "height": 640,
        "content": "### 2️⃣ 连接Slack API"
      },
      "typeVersion": 1
    },
    {
      "id": "922d2b75-5e58-4e60-a3a3-84ad97ec63f2",
      "name": "便签50",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -368,
        -1568
      ],
      "parameters": {
        "color": 7,
        "width": 1248,
        "height": 1056,
        "content": "# 💬 Slack频道聊天机器人 (n8n + OpenAI)"
      },
      "typeVersion": 1
    },
    {
      "id": "edca3251-40b1-441c-a4f4-87940abdb157",
      "name": "Slack历史记录",
      "type": "n8n-nodes-base.slackTool",
      "position": [
        672,
        -832
      ],
      "webhookId": "53101cda-61c3-4381-bce3-8ea37fd1ebd7",
      "parameters": {
        "filters": {},
        "resource": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "C04FXLG2YRJ",
          "cachedResultName": "general"
        },
        "operation": "history",
        "returnAll": true
      },
      "credentials": {
        "slackApi": {
          "id": "WOPShnC1AJqiWjZK",
          "name": "Slack account 11"
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "c3dfd3e0-4f0d-41ee-a703-bd9d6fcd7e8f",
      "name": "OpenAI 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        240,
        -736
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "4l6TDfLZVFS24g3X",
          "name": "OpenAi account 4"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "df01d3a5-ea81-4d7c-b82f-dee98257a172",
      "name": "便签54",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        128,
        -912
      ],
      "parameters": {
        "color": 3,
        "width": 288,
        "height": 304,
        "content": "### 1️⃣ 设置 OpenAI 连接"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "Slack History": {
      "ai_tool": [
        [
          {
            "node": "Slack Channel Chatbot",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Chat with Slack": {
      "main": [
        [
          {
            "node": "Slack Channel Chatbot",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Slack Channel Chatbot",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - AI RAG 检索增强, 多模态 AI

需要付费吗?

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

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

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

作者
Robert Breen

Robert Breen

@rbreen

Professional services consultant with over 10 years of experience solving complex business problems across industries. I specialize in n8n and process automation—designing custom workflows that integrate tools like Google Calendar, Airtable, GPT, and internal systems. Whether you need to automate scheduling, sync data, or streamline operations, I build solutions that save time and drive results.

外部链接
在 n8n.io 查看

分享此工作流