8
n8n 中文网amn8n.com

使用 Slack 和 Linear 的客户支持渠道和工单系统

高级

这是一个Support, AI领域的自动化工作流,包含 19 个节点。主要使用 If, Set, Merge, Slack, Linear 等节点,结合人工智能技术实现智能自动化。 使用 Slack 和 Linear 的客户支持渠道和工单系统

前置要求
  • Slack Bot Token 或 Webhook URL
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "26ba763460b97c249b82942b23b6384876dfeb9327513332e743c5f6219c2b8e"
  },
  "nodes": [
    {
      "id": "2b3112a9-046e-4aae-8fcc-95bddf3bb02e",
      "name": "Slack",
      "type": "n8n-nodes-base.slack",
      "position": [
        828,
        327
      ],
      "parameters": {
        "limit": 10,
        "query": "in:#n8n-tickets has::ticket:",
        "options": {},
        "operation": "search"
      },
      "credentials": {
        "slackApi": {
          "id": "VfK3js0YdqBdQLGP",
          "name": "Slack account"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "65fd6821-4d19-436c-81d9-9bdb0f5efddd",
      "name": "OpenAI 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1920,
        480
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "8gccIjcuf3gvaoEr",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "85125704-7363-40de-af84-f267f8c7e919",
      "name": "多表:您可以连接多个表以实现有组织的数据结构",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        2100,
        480
      ],
      "parameters": {
        "jsonSchema": "{\n  \"type\": \"object\",\n  \"properties\": {\n    \"title\": { \"type\": \"string\" },\n    \"summary\": { \"type\": \"string\" },\n    \"ideas\": {\n      \"type\": \"array\",\n      \"items\": { \"type\": \"string\" }\n    },\n    \"priority\": { \"type\": \"string\" }\n  }\n}"
      },
      "typeVersion": 1.1
    },
    {
      "id": "eda8851a-1929-4f2f-9149-627c0fe62fbc",
      "name": "计划触发器",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        628,
        327
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "minutes"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "ad0d56b5-5caf-4fc0-bdbb-4e6207e4eb03",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        580,
        112.87898199907983
      ],
      "parameters": {
        "color": 7,
        "width": 432.4578914269739,
        "height": 427.09547550768553,
        "content": "## 1. 在 Slack 中查询消息"
      },
      "typeVersion": 1
    },
    {
      "id": "d4ebe5b3-6d9a-4547-8af8-0985206c4ca4",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1040,
        180.44851541532478
      ],
      "parameters": {
        "color": 7,
        "width": 711.6907825442045,
        "height": 632.7258798316449,
        "content": "## 2. 决定是否需要创建新工单"
      },
      "typeVersion": 1
    },
    {
      "id": "b2920271-6698-47a4-8cac-ea4cec7b47d6",
      "name": "获取值",
      "type": "n8n-nodes-base.set",
      "position": [
        1100,
        360
      ],
      "parameters": {
        "mode": "raw",
        "options": {},
        "jsonOutput": "={\n  \"id\": \"#{{ $json.permalink.split('/').last() }}\",\n  \"type\": \"{{ $json.type }}\",\n  \"title\": \"__NOT_SET__\",\n  \"channel\": \"{{ $json.channel.name }}\",\n  \"user\": \"{{ $json.username }} ({{ $json.user }})\",\n  \"ts\": \"{{ $json.ts }}\",\n  \"permalink\": \"{{ $json.permalink }}\",\n  \"message\": \"{{ $json.text.replaceAll('\"','\\\\\"').replaceAll('\\n', '\\\\n') }}\"\n}"
      },
      "typeVersion": 3.3
    },
    {
      "id": "c4a4db2a-5d1c-4726-8c98-aef57fdcfaa6",
      "name": "创建新工单?",
      "type": "n8n-nodes-base.if",
      "position": [
        1600,
        360
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "c11109b6-ee45-4b52-adc3-4be5fe420202",
              "operator": {
                "type": "boolean",
                "operation": "false",
                "singleValue": true
              },
              "leftValue": "={{ Boolean(($json.hashes ?? []).includes($json.id)) }}",
              "rightValue": "=false"
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "46acb0de-1df1-4116-8aaf-704ec6644d7c",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1780,
        80
      ],
      "parameters": {
        "color": 7,
        "width": 530.6864600881105,
        "height": 578.3950618708791,
        "content": "## 3. 使用 AI 生成工单内容"
      },
      "typeVersion": 1
    },
    {
      "id": "503d4ae7-9d5b-4dab-94a2-da28bc0e49da",
      "name": "便签6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        200,
        120
      ],
      "parameters": {
        "width": 359.6648027457353,
        "height": 400.4748439127683,
        "content": "## 试试看!"
      },
      "typeVersion": 1
    },
    {
      "id": "11e423a4-36b6-4ecd-8bf7-58a7d4a1aa9a",
      "name": "获取现有问题",
      "type": "n8n-nodes-base.linear",
      "position": [
        1260,
        360
      ],
      "parameters": {
        "operation": "getAll"
      },
      "credentials": {
        "linearApi": {
          "id": "Nn0F7T9FtvRUtEbe",
          "name": "Linear account"
        }
      },
      "typeVersion": 1,
      "alwaysOutputData": true
    },
    {
      "id": "413fde96-346a-468e-80b7-d465bd8add14",
      "name": "使用 ChatGPT 生成工单",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        1920,
        320
      ],
      "parameters": {
        "text": "=The \"user issue\" is enclosed by 3 backticks:\n```\n{{ $('Get Values').item.json.message }}\n```\nYou will complete the following 4 tasks:\n1. Generate a title intended for a support ticket based on the user issue only. Be descriptive but use no more than 10 words.\n2. Summarise the user issue only by identifying the key expectations and steps that were taken to reach the conclusion.\n3. Offer at most 3 suggestions to debug or resolve the user issue only. ignore the previous issues for this task.\n4. Identify the urgency of the user issue only and denote the priority as one of \"low\", \"medium\", \"high\" or \"urgent\". If you cannot determine the urgency of the issue, then assign the \"low\" priority. Also consider that requests which require action either today or tomorrow should be prioritised as \"high\".",
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.4
    },
    {
      "id": "66aecf53-6e8a-4ee8-88c3-be6b7d8d0527",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2340,
        206
      ],
      "parameters": {
        "color": 7,
        "width": 374.7406065828194,
        "height": 352.3865785298774,
        "content": "## 4. 在 Linear 中创建新工单"
      },
      "typeVersion": 1
    },
    {
      "id": "f7898b7b-f60a-4315-a870-8c8ec4ad848f",
      "name": "创建工单",
      "type": "n8n-nodes-base.linear",
      "position": [
        2480,
        380
      ],
      "parameters": {
        "title": "={{ $json.output.title }}",
        "teamId": "1c721608-321d-4132-ac32-6e92d04bb487",
        "additionalFields": {
          "stateId": "92962324-3d1f-4cf8-993b-0c982cc95245",
          "priorityId": "={{ { 'urgent': 1, 'high': 2, 'medium': 3, 'low': 4 }[$json.output.priority.toLowerCase()] ?? 0 }}",
          "description": "=## {{ $json.output.summary }}\n\n### Suggestions\n{{ $json.output.ideas.map(idea => '* ' + idea).join('\\n') }}\n\n## Original Message\n{{ $('Get Values').item.json[\"user\"] }} asks:\n> {{ $('Get Values').item.json[\"message\"] }}\n\n### Metadata\nchannel: {{ $('Get Values').item.json.channel }}\nts: {{ $('Get Values').item.json.ts }}\npermalink: {{ $('Get Values').item.json.permalink }}\nhash: {{ $('Get Values').item.json.id }}\n"
        }
      },
      "credentials": {
        "linearApi": {
          "id": "Nn0F7T9FtvRUtEbe",
          "name": "Linear account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "0b706c12-6ce0-41af-ad4b-9d98d7d03a41",
      "name": "合并",
      "type": "n8n-nodes-base.merge",
      "position": [
        1440,
        360
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "combinationMode": "multiplex"
      },
      "typeVersion": 2.1
    },
    {
      "id": "d5b30127-f237-459d-860a-2589e3b54fb8",
      "name": "仅获取哈希值",
      "type": "n8n-nodes-base.set",
      "position": [
        1260,
        640
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "9b0e8527-ea17-4b1e-ba62-287111f4b37e",
              "name": "hashes",
              "type": "array",
              "value": "={{ $json.descriptions.map(desc => desc.match(/hash\\:\\s([\\w#]+)/i)[1]) }}"
            }
          ]
        }
      },
      "typeVersion": 3.3
    },
    {
      "id": "9de103e1-b6a4-4454-b1b9-73eff730fcb6",
      "name": "收集描述",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        1260,
        500
      ],
      "parameters": {
        "options": {},
        "fieldsToAggregate": {
          "fieldToAggregate": [
            {
              "renameField": true,
              "outputFieldName": "descriptions",
              "fieldToAggregate": "description"
            }
          ]
        }
      },
      "typeVersion": 1,
      "alwaysOutputData": true
    },
    {
      "id": "af34916f-7888-4d41-aee6-752b78e88c0c",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        780,
        300
      ],
      "parameters": {
        "width": 204.96868508214473,
        "height": 296.735132421306,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "58ab44f7-5fe5-4804-8bf1-36f351d86528",
      "name": "便签5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2440,
        360
      ],
      "parameters": {
        "width": 183.49787916474958,
        "height": 296.735132421306,
        "content": ""
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "Merge": {
      "main": [
        [
          {
            "node": "Create New Ticket?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Slack": {
      "main": [
        [
          {
            "node": "Get Values",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Values": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          },
          {
            "node": "Get Existing Issues",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Hashes Only": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Slack",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Generate Ticket Using ChatGPT",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Create New Ticket?": {
      "main": [
        [
          {
            "node": "Generate Ticket Using ChatGPT",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Existing Issues": {
      "main": [
        [
          {
            "node": "Collect Descriptions",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Collect Descriptions": {
      "main": [
        [
          {
            "node": "Get Hashes Only",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Generate Ticket Using ChatGPT",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Generate Ticket Using ChatGPT": {
      "main": [
        [
          {
            "node": "Create Ticket",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 客户支持, 人工智能

需要付费吗?

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

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

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

分享此工作流