Slack AI 聊天机器人:上下文感知,回复提及和私信

高级

这是一个Internal Wiki、AI Chatbot领域的自动化工作流,包含 19 个节点。主要使用 If、Set、Slack、SlackTool、SlackTrigger 等节点。 Slack AI 聊天机器人:上下文感知,回复提及和私信

前置要求
  • Slack Bot Token 或 Webhook URL
  • OpenAI API Key
  • Pinecone API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "ff93c7924b638fb6ca7815d8ed0b9e89bc1a4b863863649bb0ed513cdccf1946",
    "templateCredsSetupCompleted": true
  },
  "name": "Slack AI ChatBot:上下文感知,回复提及和私信",
  "nodes": [
    {
      "id": "56138b72-10df-438f-8b9e-d82e1ebd87c2",
      "name": "Pinecone 向量存储",
      "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
      "disabled": true,
      "position": [
        3720,
        3080
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "3835abae-f509-4dd0-900a-9742c06ae820",
      "name": "为 Agent 映射数据",
      "type": "n8n-nodes-base.set",
      "position": [
        2680,
        2620
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "a0d16777-a89f-402c-b917-abb5da590b25",
      "name": "机器人应在私信或公共频道中回复",
      "type": "n8n-nodes-base.if",
      "position": [
        3380,
        2620
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "161739af-625d-4c80-b142-24d81eb51064",
      "name": "### 替换 Airtable 连接",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2140,
        2360
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "14fbf245-db4e-4812-986b-8f94293c3b15",
      "name": "便签5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2640,
        2880
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "b76e4fc2-f503-4341-add4-51b9ac47781c",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3560,
        2300
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "de201034-00f1-4add-be95-53cff68d0d8b",
      "name": "Embeddings OpenAI",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "disabled": true,
      "position": [
        3660,
        3240
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "27d04c7c-0d05-4846-8e4f-533ef6ca0651",
      "name": "便签6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3600,
        2980
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "468354ca-36a4-41b6-b0bd-c0d643088f21",
      "name": "AI Agent1",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        2960,
        2620
      ],
      "parameters": {},
      "typeVersion": 1.8
    },
    {
      "id": "5c7ade77-c267-40a5-b04b-f1cdde87ed42",
      "name": "便签7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2880,
        2280
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "d14546a5-c5f1-495c-a7bf-2618f2841cea",
      "name": "便签8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2400,
        2000
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "ea3ceb64-862a-49e3-9b43-1b0a1902cee7",
      "name": "便签10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3160,
        2860
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "849f22d8-8181-469e-9ffd-c555b33776bc",
      "name": "思考",
      "type": "@n8n/n8n-nodes-langchain.toolThink",
      "position": [
        3040,
        3000
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "f5597b86-dffc-4280-8707-343ec3a7a116",
      "name": "回复公共提及",
      "type": "n8n-nodes-base.slack",
      "position": [
        3680,
        2760
      ],
      "webhookId": "5422b76a-2c31-4599-b46c-7a22996267a8",
      "parameters": {},
      "typeVersion": 2.3
    },
    {
      "id": "17b4e501-e5ee-4fb2-8a95-73b21b8b686f",
      "name": "回复私信",
      "type": "n8n-nodes-base.slack",
      "position": [
        3680,
        2480
      ],
      "webhookId": "5422b76a-2c31-4599-b46c-7a22996267a8",
      "parameters": {},
      "typeVersion": 2.3
    },
    {
      "id": "cb98b088-6c08-4538-a0ba-6a2f27244be4",
      "name": "获取 Slack 频道历史记录",
      "type": "n8n-nodes-base.slackTool",
      "position": [
        3260,
        3060
      ],
      "webhookId": "a3b43e18-2da6-4e4f-acb5-626eb4160658",
      "parameters": {},
      "typeVersion": 2.3
    },
    {
      "id": "9dbfc53e-3cca-438c-92d1-4308559d7a87",
      "name": "Slack 触发器",
      "type": "n8n-nodes-base.slackTrigger",
      "position": [
        2300,
        2620
      ],
      "webhookId": "546f6e17-5cb0-4d6d-8a49-27ed1f3c9f73",
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "68931226-a994-468d-8271-862f19b26e0d",
      "name": "OpenAI 聊天模型1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        2720,
        2980
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "a319ebb9-3523-47c6-b0af-7c04c00b1712",
      "name": "简单记忆1",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        2920,
        3000
      ],
      "parameters": {},
      "typeVersion": 1.3
    }
  ],
  "pinData": {},
  "connections": {
    "Think": {
      "ai_tool": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent1": {
      "main": [
        [
          {
            "node": "Either the bot should reply in dm or in public channel",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Slack Trigger": {
      "main": [
        [
          {
            "node": "Mapping data for the Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory1": {
      "ai_memory": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI": {
      "ai_embedding": [
        [
          {
            "node": "Pinecone Vector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Mapping data for the Agent": {
      "main": [
        [
          {
            "node": "AI Agent1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get the history of a channel in Slack": {
      "ai_tool": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Either the bot should reply in dm or in public channel": {
      "main": [
        [
          {
            "node": "Reply to DM",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Reply to public mention",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

这是一个高级难度的工作流,适用于Internal Wiki、AI Chatbot等场景。适合高级用户,包含 16+ 个节点的复杂工作流

需要付费吗?

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

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

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

作者
Theo Marcadet

Theo Marcadet

@theomarcadet

Just like every business has its own processes, every business will have its own AI agents — I sell and teach that transition From France 🇫🇷 — Discipline, Humility, Benevolence

外部链接
在 n8n.io 上查看 →

分享此工作流