创建使用GPT-4o的Slack聊天机器人实现自动回复
中级
这是一个AI Chatbot, Multimodal AI领域的自动化工作流,包含 9 个节点。主要使用 Code, Slack, Agent, ChatTrigger, LmChatOpenAi 等节点。 创建使用GPT-4o的Slack聊天机器人实现自动回复
前置要求
- •Slack Bot Token 或 Webhook URL
- •OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"meta": {
"instanceId": "ad0113c344ee237399e44e9f11798b05baeb83a6196d514a9ae9d2ad71c3b5c9",
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "e1ed7ed9-efff-4003-933d-7bf9d0b8949b",
"name": "OpenAI 聊天模型8",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
-1168,
11920
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o",
"cachedResultName": "gpt-4o"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "4l6TDfLZVFS24g3X",
"name": "OpenAi account 4"
}
},
"typeVersion": 1.2
},
{
"id": "62d0e051-8bb1-4206-8fa7-19f93a7e30ea",
"name": "便签61",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1904,
11344
],
"parameters": {
"color": 7,
"width": 1488,
"height": 928,
"content": "# 💬 带Slack监听的OpenAI聊天代理"
},
"typeVersion": 1
},
{
"id": "c65f1027-8100-4b78-af28-c99bccb903bb",
"name": "便签20",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2352,
11344
],
"parameters": {
"width": 400,
"height": 928,
"content": ""
},
"typeVersion": 1
},
{
"id": "1a88867a-350a-42cf-872e-ce2c9074d6c5",
"name": "在Slack中发送用户消息",
"type": "n8n-nodes-base.slack",
"position": [
-1504,
12080
],
"webhookId": "9369d3e1-26af-4e9f-ba26-e2de061a9aa7",
"parameters": {
"text": "=*User:* {{ $json.chatInput }}",
"user": {
"__rl": true,
"mode": "list",
"value": "U09ADJPB7QA",
"cachedResultName": "rbreen672"
},
"select": "user",
"otherOptions": {
"includeLinkToWorkflow": false
},
"authentication": "oAuth2"
},
"credentials": {
"slackOAuth2Api": {
"id": "kJLcFGEETWlwowIc",
"name": "Slack account 9"
}
},
"typeVersion": 2.3
},
{
"id": "434201a3-a5d9-434c-b8c0-f7a13e0dcb41",
"name": "示例聊天代理",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
-1136,
11680
],
"parameters": {
"text": "={{ $('Sample Chatbot').item.json.chatInput }}",
"options": {
"systemMessage": "=you are an ecommerce bot. help the user as if you were working for a mock store. "
},
"promptType": "define"
},
"typeVersion": 2.2
},
{
"id": "d0effa88-1f30-4e6a-a5b3-3edc90d726d2",
"name": "在Slack中发送代理响应",
"type": "n8n-nodes-base.slack",
"position": [
-784,
11856
],
"webhookId": "9369d3e1-26af-4e9f-ba26-e2de061a9aa7",
"parameters": {
"text": "=*Chatbot:* {{ $json.output }}",
"user": {
"__rl": true,
"mode": "list",
"value": "U09ADJPB7QA",
"cachedResultName": "rbreen672"
},
"select": "user",
"otherOptions": {
"includeLinkToWorkflow": false
},
"authentication": "oAuth2"
},
"credentials": {
"slackOAuth2Api": {
"id": "kJLcFGEETWlwowIc",
"name": "Slack account 9"
}
},
"typeVersion": 2.3
},
{
"id": "f9e1139f-2868-467c-aa21-fdd4920d0bd0",
"name": "格式化响应",
"type": "n8n-nodes-base.code",
"position": [
-640,
11632
],
"parameters": {
"jsCode": "return [{ json: { text:$('Sample Chat Agent').first().json.output } }];\n"
},
"typeVersion": 2
},
{
"id": "309558fd-dea7-4634-a5b7-a02b0df2bbcf",
"name": "便签66",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1568,
11552
],
"parameters": {
"color": 3,
"width": 224,
"height": 640,
"content": "### 2️⃣ 连接Slack API"
},
"typeVersion": 1
},
{
"id": "bbb5baca-6411-4d41-8530-3aff0a228513",
"name": "示例聊天机器人",
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"position": [
-1792,
11696
],
"webhookId": "d38a0072-420b-4de8-86b6-03a8f9a6e254",
"parameters": {
"options": {}
},
"typeVersion": 1.3
}
],
"pinData": {},
"connections": {
"bbb5baca-6411-4d41-8530-3aff0a228513": {
"main": [
[
{
"node": "1a88867a-350a-42cf-872e-ce2c9074d6c5",
"type": "main",
"index": 0
}
]
]
},
"434201a3-a5d9-434c-b8c0-f7a13e0dcb41": {
"main": [
[
{
"node": "d0effa88-1f30-4e6a-a5b3-3edc90d726d2",
"type": "main",
"index": 0
}
]
]
},
"e1ed7ed9-efff-4003-933d-7bf9d0b8949b": {
"ai_languageModel": [
[
{
"node": "434201a3-a5d9-434c-b8c0-f7a13e0dcb41",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"1a88867a-350a-42cf-872e-ce2c9074d6c5": {
"main": [
[
{
"node": "434201a3-a5d9-434c-b8c0-f7a13e0dcb41",
"type": "main",
"index": 0
}
]
]
},
"d0effa88-1f30-4e6a-a5b3-3edc90d726d2": {
"main": [
[
{
"node": "f9e1139f-2868-467c-aa21-fdd4920d0bd0",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
中级 - AI 聊天机器人, 多模态 AI
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
使用GPT-5 Nano多语言聊天机器人自动处理电商客户支持
使用GPT-5 Nano多语言聊天机器人自动处理电商客户支持
Set
Merge
Split Out
+
Set
Merge
Split Out
13 节点Robert Breen
AI 聊天机器人
AI网站聊天机器人 - GPT与Google表格CRM线索收集
集成GPT和Google表格的AI网站聊天机器人 - CRM线索收集系统
Code
Google Sheets
Agent
+
Code
Google Sheets
Agent
14 节点Robert Breen
潜在客户开发
使用 GPT-4o-mini 代理自动进行潜在客户资格认定与客户支持
使用 GPT-4o-mini 代理自动进行潜在客户资格认定与客户支持
If
Set
Code
+
If
Set
Code
16 节点Robert Breen
客户培育
基于Google Sheets记忆的博客写作与编辑器 (GPT-4)
基于Google Sheets记忆的博客写作与编辑器 (GPT-4)
If
Code
Filter
+
If
Code
Filter
18 节点Robert Breen
内容创作
使用 GPT-4o 聊天从自然语言查询生成 BigQuery SQL
使用 GPT-4o 聊天从自然语言查询生成 BigQuery SQL
Code
Merge
Aggregate
+
Code
Merge
Aggregate
13 节点Robert Breen
内部知识库
基于 Google Finance、SerpAPI 和 OpenAI 的财务数据问答聊天机器人
集成 Google Finance、SerpAPI 和 OpenAI 的财务数据问答聊天机器人
Set
Http Request
Agent
+
Set
Http Request
Agent
9 节点Robert Breen
AI 聊天机器人
工作流信息
难度等级
中级
节点数量9
分类2
节点类型6
作者
Robert Breen
@rbreenProfessional 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 查看 →
分享此工作流