8
n8n 中文网amn8n.com

监控Zendesk流失风险信号并在Slack中通知CS团队

中级

这是一个Content Creation, Multimodal AI领域的自动化工作流,包含 12 个节点。主要使用 If, Code, Slack, Zendesk, GoogleSheets 等节点。 监控Zendesk流失风险信号,记录到表格,并在Slack中通知团队

前置要求
  • Slack Bot Token 或 Webhook URL
  • Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "PdbwxMitcnvpqIV7",
  "meta": {
    "instanceId": "8443f10082278c46aa5cf3acf8ff0f70061a2c58bce76efac814b16290845177",
    "templateCredsSetupCompleted": true
  },
  "name": "监控 Zendesk 流失风险信号并在 Slack 中通知 CS 团队",
  "tags": [],
  "nodes": [
    {
      "id": "85c1fc94-a3ce-472c-9f08-56f7272d4f66",
      "name": "记录流失风险到表格",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        672,
        1040
      ],
      "parameters": {
        "columns": {
          "value": {},
          "schema": [
            {
              "id": "ticket_id",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "ticket_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "subject",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "subject",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "description",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "description",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "priority",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "priority",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "type",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "type",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "created_at",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "created_at",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "updated_at",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "updated_at",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "channel",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "channel",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "requester_id",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "requester_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "assignee_id",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "assignee_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "organization_id",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "organization_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "group_id",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "group_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "tags",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "tags",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "encoded_id",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "encoded_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "ticket_url",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "ticket_url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "is_public",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "is_public",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "satisfaction_score",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "satisfaction_score",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "custom_status_id",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "custom_status_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "brand_id",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "brand_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "formatted_at",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "formatted_at",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "is_urgent",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "is_urgent",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "has_assignee",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "has_assignee",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "priority_level",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "priority_level",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "ticket_age_hours",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "ticket_age_hours",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "needs_attention",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "needs_attention",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "channel_type",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "channel_type",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "autoMapInputData",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/11ojVmCr69OzkW8nGhkeXm9c3g8nNzqz5G4DFSfJvofQ/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "11ojVmCr69OzkW8nGhkeXm9c3g8nNzqz5G4DFSfJvofQ",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/11ojVmCr69OzkW8nGhkeXm9c3g8nNzqz5G4DFSfJvofQ/edit?usp=drivesdk",
          "cachedResultName": "Churn Risk Ticket"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "kpPEOLCGn963qpoh",
          "name": "automations@techdome.ai"
        }
      },
      "typeVersion": 4
    },
    {
      "id": "2913f3a0-f1ba-470c-89fb-0e8109732d36",
      "name": "发送Slack警报",
      "type": "n8n-nodes-base.slack",
      "position": [
        672,
        1248
      ],
      "webhookId": "4e8f1384-bde5-4e4b-a017-6861695b64dd",
      "parameters": {
        "text": "=🚨 *Churn Risk Alert*\n\n**Ticket ID:** {{ $json.ticket_id }}\n**Rating:** {{ $json.satisfaction_score }} \n**Subject:** {{ $json.subject }} \n**Description:** {{ $json.description }} \n\n**Action Required:** Please reach out to this customer immediately to address their concerns.",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "C09FM9N8UEA",
          "cachedResultName": "zendesk-churn-alerts"
        },
        "otherOptions": {
          "includeLinkToWorkflow": false
        }
      },
      "credentials": {
        "slackApi": {
          "id": "rNqvWj9TfChPVRYY",
          "name": "Slack account"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "3690cb18-cfca-49ad-8583-1a35442ed74d",
      "name": "获取 Zendesk 工单",
      "type": "n8n-nodes-base.zendesk",
      "position": [
        -112,
        1152
      ],
      "parameters": {
        "options": {},
        "operation": "getAll"
      },
      "credentials": {
        "zendeskApi": {
          "id": "BQ61OjTaFfNPQ1bK",
          "name": "Zendesk account-anuj"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "3f4c0ada-de8a-4c76-970d-9d6ec950f71f",
      "name": "格式化工单数据",
      "type": "n8n-nodes-base.code",
      "position": [
        96,
        1152
      ],
      "parameters": {
        "jsCode": "// n8n Code Node - Zendesk Ticket Formatter\n// This code processes Zendesk ticket data and formats it into clean JSON structure\n\n// Function to format individual ticket data\nfunction formatTicketData(ticketData) {\n  return {\n    ticket_id: ticketData.id,\n    subject: ticketData.subject || \"No Subject\",\n    description: ticketData.description || \"No Description\",\n    status: ticketData.status,\n    priority: ticketData.priority,\n    type: ticketData.type || \"general\",\n    created_at: ticketData.created_at,\n    updated_at: ticketData.updated_at,\n    channel: ticketData.via?.channel || \"unknown\",\n    requester_id: ticketData.requester_id,\n    assignee_id: ticketData.assignee_id,\n    organization_id: ticketData.organization_id,\n    group_id: ticketData.group_id,\n    tags: ticketData.tags || [],\n    encoded_id: ticketData.encoded_id,\n    ticket_url: ticketData.url,\n    is_public: ticketData.is_public,\n    satisfaction_score: ticketData.satisfaction_rating?.score || \"not_rated\",\n    custom_status_id: ticketData.custom_status_id,\n    brand_id: ticketData.brand_id,\n    formatted_at: new Date().toISOString(),\n    is_urgent: (ticketData.tags || []).includes('urgent'),\n    has_assignee: ticketData.assignee_id ? true : false\n  };\n}\n\n// Function to get priority level (for sorting/filtering)\nfunction getPriorityLevel(priority) {\n  const levels = {\n    'low': 1,\n    'normal': 2,\n    'high': 3,\n    'urgent': 4\n  };\n  return levels[priority] || 2;\n}\n\n// Function to calculate ticket age in hours\nfunction getTicketAgeHours(createdAt) {\n  const created = new Date(createdAt);\n  const now = new Date();\n  return Math.round((now - created) / (1000 * 60 * 60));\n}\n\n// Loop over input items and format each Zendesk ticket\nfor (const item of $input.all()) {\n  // Get the original ticket data\n  const originalTicket = item.json;\n  \n  // Format the ticket data into clean structure\n  const formattedTicket = formatTicketData(originalTicket);\n  \n  // Add additional computed fields\n  item.json = {\n    ...formattedTicket,\n    priority_level: getPriorityLevel(originalTicket.priority),\n    ticket_age_hours: getTicketAgeHours(originalTicket.created_at),\n    needs_attention: (\n      originalTicket.status === 'open' && \n      ((originalTicket.tags || []).includes('urgent') || \n       getTicketAgeHours(originalTicket.created_at) > 24)\n    ),\n    channel_type: originalTicket.via?.channel === 'web' ? 'self_service' : \n                  originalTicket.via?.channel === 'api' ? 'system_generated' : \n                  originalTicket.via?.channel || 'unknown'\n  };\n}\n\n// Return all processed items\nreturn $input.all();"
      },
      "typeVersion": 2
    },
    {
      "id": "2d7eb3f7-d214-4e7b-b316-8f831e08583a",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -208,
        752
      ],
      "parameters": {
        "width": 267,
        "height": 364,
        "content": "## 📥 工单检索"
      },
      "typeVersion": 1
    },
    {
      "id": "a0d7fdf9-8067-4a7a-ac49-a7fa3509c3ab",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        32,
        1296
      ],
      "parameters": {
        "width": 263,
        "height": 328,
        "content": "## 🔧 数据处理"
      },
      "typeVersion": 1
    },
    {
      "id": "eec3e927-9e60-4bf8-9b6c-d3f9115e1e91",
      "name": "便签5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        224,
        752
      ],
      "parameters": {
        "width": 290,
        "height": 388,
        "content": "## ⚖️ 流失风险过滤器"
      },
      "typeVersion": 1
    },
    {
      "id": "b75fafe4-88de-4683-9524-a14ea0c0edf2",
      "name": "便签6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        624,
        624
      ],
      "parameters": {
        "width": 267,
        "height": 408,
        "content": "## 📋 跟踪与分析"
      },
      "typeVersion": 1
    },
    {
      "id": "f910ff82-e32a-421a-b10f-9aafd2e51a92",
      "name": "便签7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        624,
        1408
      ],
      "parameters": {
        "width": 298,
        "height": 409,
        "content": "## 🚨 即时团队警报"
      },
      "typeVersion": 1
    },
    {
      "id": "5a2dbeb2-b3ce-429f-8291-d4070e26165f",
      "name": "检查负面反馈",
      "type": "n8n-nodes-base.if",
      "position": [
        336,
        1152
      ],
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{ $json.satisfaction_score }}",
              "value2": "bad"
            }
          ]
        },
        "combineOperation": "any"
      },
      "typeVersion": 1
    },
    {
      "id": "ceb7a743-8028-47b1-af90-95eceab7eded",
      "name": "计划触发器",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -352,
        1152
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "expression": "0 0 20 * * 1-5"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "e33a6d2e-cb33-4b52-a9a7-b3ee885387eb",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -560,
        1296
      ],
      "parameters": {
        "width": 263,
        "height": 312,
        "content": "## 🔧 自动化计划触发器"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "96c30166-321c-4be9-bfef-401706c70cdb",
  "connections": {
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Fetch Zendesk Tickets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Ticket Data": {
      "main": [
        [
          {
            "node": "Check Negative Feedback",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Zendesk Tickets": {
      "main": [
        [
          {
            "node": "Format Ticket Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Negative Feedback": {
      "main": [
        [
          {
            "node": "Log Churn Risk to Sheet",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send Slack Alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 内容创作, 多模态 AI

需要付费吗?

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

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

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

作者
Rahul Joshi

Rahul Joshi

@rahul08

Rahul Joshi is a seasoned technology leader specializing in the n8n automation tool and AI-driven workflow automation. With deep expertise in building open-source workflow automation and self-hosted automation platforms, he helps organizations eliminate manual processes through intelligent n8n ai agent automation solutions.

外部链接
在 n8n.io 查看

分享此工作流