8
n8n 中文网amn8n.com

带聊天机器人和 GPT-4.1 的自动化 Slack 频道审核工作流

高级

这是一个AI Summarization, Multimodal AI领域的自动化工作流,包含 16 个节点。主要使用 Code, Slack, Filter, ScheduleTrigger 等节点。 自动化Slack频道闲置审核与报告生成,用于工作区清理

前置要求
  • Slack Bot Token 或 Webhook URL
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "IrGwRuTSulKQNDCO",
  "meta": {
    "instanceId": "4a2e6764ba7a6bc9890d9225f4b21d570ce88fc9bd57549c89057fcee58fed0f",
    "templateCredsSetupCompleted": true
  },
  "name": "带聊天机器人和 GPT-4.1 的自动化 Slack 频道审核工作流",
  "tags": [],
  "nodes": [
    {
      "id": "58a17978-d554-4042-ae0e-262a1cd5a285",
      "name": "获取多个频道",
      "type": "n8n-nodes-base.slack",
      "position": [
        -224,
        32
      ],
      "webhookId": "eaeb65ef-583f-41ad-ba11-ffe56bfe87e0",
      "parameters": {
        "filters": {
          "types": [
            "public_channel",
            "private_channel"
          ]
        },
        "resource": "channel",
        "operation": "getAll",
        "authentication": "oAuth2"
      },
      "credentials": {
        "slackOAuth2Api": {
          "id": "4JSKt9sIRV1KGswQ",
          "name": "Slack account"
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "12bde87c-f8a8-4eb3-bf81-8e94916f1db6",
      "name": "获取频道历史记录",
      "type": "n8n-nodes-base.slack",
      "position": [
        0,
        32
      ],
      "webhookId": "301affce-942f-465e-8c4b-75e7fafc382a",
      "parameters": {
        "limit": 1,
        "filters": {},
        "resource": "channel",
        "channelId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.id }}"
        },
        "operation": "history",
        "authentication": "oAuth2"
      },
      "credentials": {
        "slackOAuth2Api": {
          "id": "4JSKt9sIRV1KGswQ",
          "name": "Slack account"
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "7043ccc2-4d82-49a5-ba8c-299e9842e92d",
      "name": "筛选最后讨论在30天前的频道",
      "type": "n8n-nodes-base.filter",
      "position": [
        224,
        32
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "1d9de0c9-232d-455b-a625-563dc785f484",
              "operator": {
                "type": "dateTime",
                "operation": "before"
              },
              "leftValue": "={{ $json.ts.toDateTime('s') }}",
              "rightValue": "={{ $today.minus(30,'days') }}"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "b3c69271-5007-484d-89d6-48b1384fcf20",
      "name": "收集过期频道信息",
      "type": "n8n-nodes-base.code",
      "position": [
        448,
        32
      ],
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "const channel = $('Get many channels').item.json;\n\nreturn {\n  json: {\n    ChannelID: channel.id,\n    ChannelName: channel.name,\n    CreatedDate: new Date(channel.created * 1000).toLocaleDateString('en-US'),\n    TotalMember: $('Get many channels').item.json.num_members,\n    Purpose: $('Get many channels').item.json.purpose.value || 'N/A'\n  }\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "24fb2413-9c3c-4894-bfa3-f18f15011de9",
      "name": "处理 Slack 报告",
      "type": "n8n-nodes-base.code",
      "position": [
        672,
        32
      ],
      "parameters": {
        "jsCode": "const channels = $input.all().map(item => item.json);\n\nlet report = '*📊 Weekly Slack Channel Inactivity Report*\\n\\n';\nreport += 'The following channels have had *no discussion in the past 30 days*. Please review and take action if needed:\\n\\n';\nreport += '```';\nreport += 'Channel ID       Name                        Members  Created On   Purpose\\n';\nreport += '-------------   --------------------------  -------   ----------   ------------------------------\\n';\n\nfor (const c of channels) {\n  report += `${c.ChannelID.padEnd(15)} ${('#' + c.ChannelName).padEnd(26)} ${String(c.TotalMember).padEnd(9)} ${c.CreatedDate.padEnd(12)} ${c.Purpose || 'N/A'}\\n`;\n}\n\nreport += '```\\n\\n';\n\nreport += '\\n⚠️ *Recommendation:*\\n';\nreport += '- Channels with *0 members* or *no defined purpose* should be reviewed for archiving.\\n';\nreport += '- Channels like `#aws-study-group` and `#team-coffee` may benefit from engagement prompts or repurposing.\\n\\n';\n\nreport += `📅 _Report generated on:_ ${new Date().toLocaleDateString('en-GB')}`;\n\n// Output for Slack\nreturn [\n  {\n    json: {\n      text: report\n    }\n  }\n];"
      },
      "typeVersion": 2
    },
    {
      "id": "92353f17-c390-4116-b66d-798605754f4f",
      "name": "发送频道不活跃报告",
      "type": "n8n-nodes-base.slack",
      "position": [
        896,
        32
      ],
      "webhookId": "5f04cdae-bef0-4df2-85a8-05818fef2549",
      "parameters": {
        "text": "={{ $json.text }}",
        "user": {
          "__rl": true,
          "mode": "username",
          "value": "@trung.tran"
        },
        "select": "user",
        "otherOptions": {
          "mrkdwn": true
        }
      },
      "credentials": {
        "slackApi": {
          "id": "3MfZsxrz9SluxmDt",
          "name": "COC Bot"
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "88965563-dfeb-40e4-b0af-19b4d84a5188",
      "name": "每周计划触发器",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -448,
        32
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "weeks",
              "triggerAtDay": [
                1
              ]
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "67dc318e-6c64-4f56-b225-0c061236b127",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1088,
        -112
      ],
      "parameters": {
        "width": 960,
        "height": 416,
        "content": "![](https://wisestackai.s3.ap-southeast-1.amazonaws.com/Screenshot+2025-08-22+at+4.04.52%E2%80%AFPM.png)"
      },
      "typeVersion": 1
    },
    {
      "id": "0e5cb456-17a7-4a9e-be55-ffaa66d795fe",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1600,
        -768
      ],
      "parameters": {
        "width": 1040,
        "height": 2224,
        "content": "# 带聊天机器人和 GPT-4.1 的自动化 Slack 频道审核工作流"
      },
      "typeVersion": 1
    },
    {
      "id": "f788c89e-9c9e-42a9-ab7d-5e9ddd24ea41",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -480,
        224
      ],
      "parameters": {
        "width": 256,
        "height": 144,
        "content": "### 1. ⏰ 每周计划触发器"
      },
      "typeVersion": 1
    },
    {
      "id": "d71481ff-856e-493d-b3e4-fd9a44b515f7",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -224,
        -128
      ],
      "parameters": {
        "height": 128,
        "content": "### 2. 📡 获取多个频道"
      },
      "typeVersion": 1
    },
    {
      "id": "21906417-62bb-4364-8b2f-43e7561134cb",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -48,
        224
      ],
      "parameters": {
        "width": 288,
        "height": 144,
        "content": "### 3. 🕓 获取频道历史记录"
      },
      "typeVersion": 1
    },
    {
      "id": "7e81e9d5-15c9-438c-8010-a8e4a7355958",
      "name": "便签5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        176,
        -160
      ],
      "parameters": {
        "content": "### 4. 🚫 筛选30天内无活动的频道"
      },
      "typeVersion": 1
    },
    {
      "id": "f57c3472-2168-4dcf-98a1-ed60cc2f2f96",
      "name": "便签6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        368,
        208
      ],
      "parameters": {
        "height": 272,
        "content": "### 5. 📦 收集过期频道信息"
      },
      "typeVersion": 1
    },
    {
      "id": "089fb6fe-2711-4cfc-ae9a-34c51f8bf277",
      "name": "便签7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        560,
        -160
      ],
      "parameters": {
        "height": 144,
        "content": "### 6. 📝 处理 Slack 报告"
      },
      "typeVersion": 1
    },
    {
      "id": "f70b2bd0-6db2-423e-beff-9e8083f0db2b",
      "name": "便签8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        816,
        208
      ],
      "parameters": {
        "content": "### 7. 📤 发送频道不活跃报告"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "89b4dd41-9469-44ca-9635-7e9670e3568f",
  "connections": {
    "Get many channels": {
      "main": [
        [
          {
            "node": "Get the history of a channel",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Consume slack report": {
      "main": [
        [
          {
            "node": "Send Channel Inactivity Report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Weekly Schedule Trigger": {
      "main": [
        [
          {
            "node": "Get many channels",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get the history of a channel": {
      "main": [
        [
          {
            "node": "Filter channel with last discussion 30 days ago",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Collect expired channel information": {
      "main": [
        [
          {
            "node": "Consume slack report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter channel with last discussion 30 days ago": {
      "main": [
        [
          {
            "node": "Collect expired channel information",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - AI 摘要总结, 多模态 AI

需要付费吗?

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

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

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

作者
Trung Tran

Trung Tran

@trungtran

Empowering small and medium businesses with smart automation and practical AI, no big tech team required.

外部链接
在 n8n.io 查看

分享此工作流