8
n8n 中文网amn8n.com

使用Linear和Slack进行支持问题的情感分析跟踪

高级

这是一个Support, AI领域的自动化工作流,包含 19 个节点。主要使用 Set, Slack, Switch, Graphql, Airtable 等节点,结合人工智能技术实现智能自动化。 使用Linear和Slack进行支持问题的情感分析跟踪

前置要求
  • Slack Bot Token 或 Webhook URL
  • Airtable API Key
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "nodes": [
    {
      "id": "82fd6023-2cc3-416e-83b7-fda24d07d77a",
      "name": "问题添加到列表",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        40,
        -100
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "data.issues.nodes"
      },
      "typeVersion": 1
    },
    {
      "id": "9cc77786-e14f-47c6-a3cf-60c2830612e6",
      "name": "OpenAI 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        360,
        80
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "8gccIjcuf3gvaoEr",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "821d4a60-81a4-4915-9c13-3d978cc0114b",
      "name": "合并情感分析",
      "type": "n8n-nodes-base.set",
      "position": [
        700,
        -80
      ],
      "parameters": {
        "mode": "raw",
        "options": {},
        "jsonOutput": "={{\n{\n  ...$('Issues to List').item.json,\n  ...$json.output\n}\n}}"
      },
      "typeVersion": 3.4
    },
    {
      "id": "fe6560f6-2e1b-4442-a2af-bd5a1623f213",
      "name": "问题评论情感分析",
      "type": "@n8n/n8n-nodes-langchain.informationExtractor",
      "position": [
        360,
        -80
      ],
      "parameters": {
        "text": "={{\n$json.comments.nodes.map(node => [\n  `${node.user.displayName} commented on ${node.createdAt}:`,\n   node.body\n].join('\\n')).join('---\\n')\n}}",
        "options": {},
        "attributes": {
          "attributes": [
            {
              "name": "sentiment",
              "required": true,
              "description": "One of positive, negative or neutral"
            },
            {
              "name": "sentimentSummary",
              "description": "Describe the sentiment of the conversation"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "4fd0345d-e5bf-426d-8403-e2217e19bbea",
      "name": "问题副本",
      "type": "n8n-nodes-base.set",
      "position": [
        1200,
        -60
      ],
      "parameters": {
        "mode": "raw",
        "options": {},
        "jsonOutput": "={{ $json }}"
      },
      "typeVersion": 3.4
    },
    {
      "id": "6d103d67-451e-4780-8f52-f4dba4b42860",
      "name": "对于每个问题...",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        1020,
        -60
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "032702d9-27d8-4735-b978-20b55bc1a74f",
      "name": "获取现有情感",
      "type": "n8n-nodes-base.airtable",
      "position": [
        1380,
        -60
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "list",
          "value": "appViDaeaFw4qv9La",
          "cachedResultUrl": "https://airtable.com/appViDaeaFw4qv9La",
          "cachedResultName": "Sentiment Analysis over Issue Comments"
        },
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "tblhO0sfRhKP6ibS8",
          "cachedResultUrl": "https://airtable.com/appViDaeaFw4qv9La/tblhO0sfRhKP6ibS8",
          "cachedResultName": "Table 1"
        },
        "options": {
          "fields": [
            "Issue ID",
            "Current Sentiment"
          ]
        },
        "operation": "search",
        "filterByFormula": "={Issue ID} = '{{ $json.identifier || 'XYZ' }}'"
      },
      "credentials": {
        "airtableTokenApi": {
          "id": "Und0frCQ6SNVX3VV",
          "name": "Airtable Personal Access Token account"
        }
      },
      "typeVersion": 2.1,
      "alwaysOutputData": true
    },
    {
      "id": "f2ded6fa-8b0f-4a34-868c-13c19f725c98",
      "name": "更新行",
      "type": "n8n-nodes-base.airtable",
      "position": [
        1560,
        -60
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "list",
          "value": "appViDaeaFw4qv9La",
          "cachedResultUrl": "https://airtable.com/appViDaeaFw4qv9La",
          "cachedResultName": "Sentiment Analysis over Issue Comments"
        },
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "tblhO0sfRhKP6ibS8",
          "cachedResultUrl": "https://airtable.com/appViDaeaFw4qv9La/tblhO0sfRhKP6ibS8",
          "cachedResultName": "Table 1"
        },
        "columns": {
          "value": {
            "Summary": "={{ $('Copy of Issue').item.json.sentimentSummary || '' }}",
            "Assigned": "={{ $('Copy of Issue').item.json.assignee.name }}",
            "Issue ID": "={{ $('Copy of Issue').item.json.identifier }}",
            "Issue Title": "={{ $('Copy of Issue').item.json.title }}",
            "Issue Created": "={{ $('Copy of Issue').item.json.createdAt }}",
            "Issue Updated": "={{ $('Copy of Issue').item.json.updatedAt }}",
            "Current Sentiment": "={{ $('Copy of Issue').item.json.sentiment.toSentenceCase() }}",
            "Previous Sentiment": "={{ !$json.isEmpty() ? $json['Current Sentiment'] : 'N/A' }}"
          },
          "schema": [
            {
              "id": "id",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "id",
              "defaultMatch": true
            },
            {
              "id": "Issue ID",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Issue ID",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Previous Sentiment",
              "type": "options",
              "display": true,
              "options": [
                {
                  "name": "Positive",
                  "value": "Positive"
                },
                {
                  "name": "Negative",
                  "value": "Negative"
                },
                {
                  "name": "Neutral",
                  "value": "Neutral"
                },
                {
                  "name": "N/A",
                  "value": "N/A"
                }
              ],
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Previous Sentiment",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Current Sentiment",
              "type": "options",
              "display": true,
              "options": [
                {
                  "name": "Positive",
                  "value": "Positive"
                },
                {
                  "name": "Negative",
                  "value": "Negative"
                },
                {
                  "name": "Neutral",
                  "value": "Neutral"
                },
                {
                  "name": "N/A",
                  "value": "N/A"
                }
              ],
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Current Sentiment",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Summary",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Summary",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Issue Title",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Issue Title",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Issue Created",
              "type": "dateTime",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Issue Created",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Issue Updated",
              "type": "dateTime",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Issue Updated",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Assigned",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Assigned",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Created",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "Created",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Last Modified",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "Last Modified",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Issue ID"
          ]
        },
        "options": {},
        "operation": "upsert"
      },
      "credentials": {
        "airtableTokenApi": {
          "id": "Und0frCQ6SNVX3VV",
          "name": "Airtable Personal Access Token account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "e6fb0b8f-2469-4b66-b9e2-f4f3c0a613af",
      "name": "Airtable 触发器",
      "type": "n8n-nodes-base.airtableTrigger",
      "position": [
        1900,
        -40
      ],
      "parameters": {
        "baseId": {
          "__rl": true,
          "mode": "id",
          "value": "appViDaeaFw4qv9La"
        },
        "tableId": {
          "__rl": true,
          "mode": "id",
          "value": "tblhO0sfRhKP6ibS8"
        },
        "pollTimes": {
          "item": [
            {
              "mode": "everyHour"
            }
          ]
        },
        "triggerField": "Current Sentiment",
        "authentication": "airtableTokenApi",
        "additionalFields": {}
      },
      "credentials": {
        "airtableTokenApi": {
          "id": "Und0frCQ6SNVX3VV",
          "name": "Airtable Personal Access Token account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "669762c4-860b-43ad-b677-72d4564e1c29",
      "name": "情感转变",
      "type": "n8n-nodes-base.switch",
      "position": [
        2080,
        -40
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "NON-NEGATIVE to NEGATIVE",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "boolean",
                      "operation": "true",
                      "singleValue": true
                    },
                    "leftValue": "={{ $json.fields[\"Previous Sentiment\"] !== 'Negative' && $json.fields[\"Current Sentiment\"] === 'Negative' }}",
                    "rightValue": ""
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {
          "fallbackOutput": "none"
        }
      },
      "typeVersion": 3.2
    },
    {
      "id": "2fbcfbea-3989-459b-8ca7-b65c130a479b",
      "name": "获取活跃 Linear 问题",
      "type": "n8n-nodes-base.graphql",
      "position": [
        -140,
        -100
      ],
      "parameters": {
        "query": "=query (\n  $filter: IssueFilter\n) {\n  issues(\n    filter: $filter\n  ) {\n    nodes {\n      id\n      identifier\n      title\n      description\n      url\n      createdAt\n      updatedAt\n      assignee {\n        name\n      }\n      comments {\n        nodes {\n          id\n          createdAt\n          user {\n            displayName\n          }\n          body\n        }\n      }\n    }\n  }\n}",
        "endpoint": "https://api.linear.app/graphql",
        "variables": "={{\n{\n  \"filter\": {\n    updatedAt: { gte: $now.minus(30, 'minutes').toISO() }\n  }\n}\n}}",
        "requestFormat": "json",
        "authentication": "headerAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "XME2Ubkuy9hpPEM5",
          "name": "Linear.app (heightio)"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "aaf1c25e-c398-4715-88bf-bd98daafc10f",
      "name": "由 Github 模型提供支持",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -340,
        -100
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "minutes",
              "minutesInterval": 30
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "b3e2df39-90ce-4ebf-aa68-05499965ec30",
      "name": "去重通知",
      "type": "n8n-nodes-base.removeDuplicates",
      "position": [
        2280,
        -40
      ],
      "parameters": {
        "options": {},
        "operation": "removeItemsSeenInPreviousExecutions",
        "dedupeValue": "={{ $json.fields[\"Issue ID\"] }}:{{ $json.fields['Last Modified'] }}"
      },
      "typeVersion": 2
    },
    {
      "id": "2a116475-32cd-4c9d-bfc1-3bd494f79a49",
      "name": "报告问题负面转变",
      "type": "n8n-nodes-base.slack",
      "position": [
        2480,
        -40
      ],
      "webhookId": "612f1001-3fcc-480b-a835-05f9e2d56a5f",
      "parameters": {
        "text": "={{ $('Deduplicate Notifications').all().length }} Issues have transitions to Negative Sentiment",
        "select": "channel",
        "blocksUi": "={{\n{\n  \"blocks\": [\n    {\n      \"type\": \"section\",\n      \"text\": {\n          \"type\": \"mrkdwn\",\n          \"text\": \":rotating_light: The following Issues transitioned to Negative Sentiment\"\n      }\n    },\n    {\n        \"type\": \"divider\"\n    },\n    ...($('Deduplicate Notifications').all().map(item => (\n      {\n        \"type\": \"section\",\n        \"text\": {\n            \"type\": \"mrkdwn\",\n            \"text\": `*<https://linear.app/myOrg/issue/${$json.fields['Issue ID']}|${$json.fields['Issue ID']} ${$json.fields['Issue Title']}>*\\n${$json.fields.Summary}`\n        }\n      }\n    )))\n  ]\n}\n}}",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "C0749JVFERK",
          "cachedResultName": "n8n-tickets"
        },
        "messageType": "block",
        "otherOptions": {}
      },
      "credentials": {
        "slackApi": {
          "id": "VfK3js0YdqBdQLGP",
          "name": "Slack account"
        }
      },
      "executeOnce": true,
      "typeVersion": 2.3
    },
    {
      "id": "1f3d30b6-de31-45a8-a872-554c339f112f",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -420,
        -320
      ],
      "parameters": {
        "color": 7,
        "width": 660,
        "height": 440,
        "content": "## 1. 持续监控活跃 Linear 问题"
      },
      "typeVersion": 1
    },
    {
      "id": "9024512d-5cb9-4e9f-b6e1-495d1a32118a",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        260,
        -320
      ],
      "parameters": {
        "color": 7,
        "width": 640,
        "height": 560,
        "content": "## 2. 当前问题活动的情感分析"
      },
      "typeVersion": 1
    },
    {
      "id": "233ebd6d-38cb-4f2d-84b5-29c97d30d77b",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        920,
        -320
      ],
      "parameters": {
        "color": 7,
        "width": 840,
        "height": 560,
        "content": "## 3. 在 Airtable 中捕获并跟踪结果"
      },
      "typeVersion": 1
    },
    {
      "id": "a2229225-b580-43cb-b234-4f69cb5924fd",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1800,
        -320
      ],
      "parameters": {
        "color": 7,
        "width": 920,
        "height": 560,
        "content": "## 4. 情感转为负面时接收通知"
      },
      "typeVersion": 1
    },
    {
      "id": "6f26769e-ec5d-46d0-ae0a-34148b24e6a2",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -940,
        -720
      ],
      "parameters": {
        "width": 480,
        "height": 840,
        "content": "## 立即试用!"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "Update Row": {
      "main": [
        [
          {
            "node": "For Each Issue...",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Copy of Issue": {
      "main": [
        [
          {
            "node": "Get Existing Sentiment",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Issues to List": {
      "main": [
        [
          {
            "node": "Sentiment over Issue Comments",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Airtable Trigger": {
      "main": [
        [
          {
            "node": "Sentiment Transition",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Fetch Active Linear Issues",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "For Each Issue...": {
      "main": [
        [],
        [
          {
            "node": "Copy of Issue",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Sentiment over Issue Comments",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Sentiment Transition": {
      "main": [
        [
          {
            "node": "Deduplicate Notifications",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Existing Sentiment": {
      "main": [
        [
          {
            "node": "Update Row",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Deduplicate Notifications": {
      "main": [
        [
          {
            "node": "Report Issue Negative Transition",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Combine Sentiment Analysis": {
      "main": [
        [
          {
            "node": "For Each Issue...",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Active Linear Issues": {
      "main": [
        [
          {
            "node": "Issues to List",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sentiment over Issue Comments": {
      "main": [
        [
          {
            "node": "Combine Sentiment Analysis",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

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

需要付费吗?

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

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

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

分享此工作流