8
n8n 中文网amn8n.com

Intercom聊天机器人与Discord线程报告

高级

这是一个Support, AI领域的自动化工作流,包含 51 个节点。主要使用 If, Set, Merge, Filter, Switch 等节点,结合人工智能技术实现智能自动化。 使用Intercom中的GPT-4o聊天机器人和Discord线程报告实现支持自动化

前置要求
  • HTTP Webhook 端点(n8n 会自动生成)
  • 可能需要目标 API 的认证凭证
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "5b00a3a87fa2b25a0d485323c4fc178cb0e81c0dc65d389bc4d121cf3b84fae9",
    "templateCredsSetupCompleted": true
  },
  "name": "Intercom聊天机器人与Discord线程报告",
  "tags": [],
  "nodes": [
    {
      "id": "27882742-2056-45fc-84c9-5385e96ca71a",
      "name": "分离输出",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        880,
        1820
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "e54f054f-fb50-4d70-b2cd-3b827d054ae5",
      "name": "聚合",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        2240,
        1920
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "a07cb629-a0ed-456b-8726-48a39feea659",
      "name": "如果2",
      "type": "n8n-nodes-base.if",
      "position": [
        4300,
        1820
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "f504941e-c049-4ac4-8110-d3731c6665c6",
      "name": "分支",
      "type": "n8n-nodes-base.switch",
      "position": [
        3340,
        1820
      ],
      "parameters": {},
      "typeVersion": 3.2,
      "alwaysOutputData": false
    },
    {
      "id": "a85a63c7-a730-4d63-ab4d-ea70af8a339c",
      "name": "Intercom Webhook触发器",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -1380,
        1560
      ],
      "webhookId": "38222286-6491-4d6a-91e0-19075fd2db90",
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "1cb63ba4-01b6-4fa7-8571-715467242cd0",
      "name": "是否为新对话",
      "type": "n8n-nodes-base.if",
      "position": [
        -280,
        1560
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "4589ea72-6bb5-48e1-a042-ea74b5d371fc",
      "name": "[Intercom] 获取对话",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        320,
        1820
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "34488412-395c-4aaf-848e-a6fa06de1f22",
      "name": "[Discord] 创建线程",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        320,
        1300
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "8ac88706-8a57-4475-b8be-2e906fe92c80",
      "name": "[Discord] 在线程中输入首条消息",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        540,
        1300
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "bc1ecb78-0e64-4c9f-92f1-008f64fbcf39",
      "name": "[Intercom] 将线程ID存储为\"备注\"",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1200,
        1300
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "e2fdc2fb-1cfb-4dc2-af2d-c81eb152fb23",
      "name": "隔离\"备注\"以获取存储的线程ID",
      "type": "n8n-nodes-base.filter",
      "position": [
        1540,
        1720
      ],
      "parameters": {},
      "typeVersion": 2.2,
      "alwaysOutputData": true
    },
    {
      "id": "31511561-85e0-4b21-b96c-9a89afd78239",
      "name": "隔离所有文本消息内容",
      "type": "n8n-nodes-base.filter",
      "position": [
        1540,
        1920
      ],
      "parameters": {},
      "typeVersion": 2.2,
      "alwaysOutputData": true
    },
    {
      "id": "48bf5526-ba4b-488f-a2a6-db518d821662",
      "name": "对话 -> JSON",
      "type": "n8n-nodes-base.set",
      "position": [
        1880,
        1920
      ],
      "parameters": {},
      "typeVersion": 3.4,
      "alwaysOutputData": false
    },
    {
      "id": "86b39b61-ce37-4181-a203-d21d88f86e15",
      "name": "对话信息 -> JSON",
      "type": "n8n-nodes-base.set",
      "position": [
        2240,
        1720
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "ca2ab211-d96f-4915-89bb-c29e4db09fe7",
      "name": "机器人停用时跳过",
      "type": "n8n-nodes-base.filter",
      "position": [
        4920,
        1540
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "ce8dc8fe-47c1-429e-bcbc-8cda3b854dbc",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        5840,
        1540
      ],
      "parameters": {},
      "typeVersion": 1.7
    },
    {
      "id": "72a6cdc8-e6ce-450b-93ae-8b9ba1713cd4",
      "name": "OpenAI 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        5700,
        1740
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "8e6c308a-01e8-432d-b9e2-011b28df2968",
      "name": "数据排序(因为这里合并了两个不同的流程)",
      "type": "n8n-nodes-base.set",
      "position": [
        5260,
        1300
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "c2a88039-cfb2-42ec-a71b-160f3c9b47c5",
      "name": "为智能代理使用准备数据",
      "type": "n8n-nodes-base.set",
      "position": [
        5560,
        1540
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "ece196cb-c8c6-483f-9b1d-fb3cdf615dae",
      "name": "简单记忆",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        5880,
        1740
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "ae5a4244-3f26-42b0-96f7-9b84cb9cfe8a",
      "name": "[Discord] 回复",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        6640,
        1720
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "b19aee7a-6819-43cf-9036-7c4fc0431f36",
      "name": "[Intercom] 回复",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        6640,
        1540
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "54b0c9ff-d7eb-496e-b219-0d800c58f044",
      "name": "[Discord] 通知机器人重新激活",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        4600,
        1720
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "d719b8a4-fa3e-4426-8855-d6029f6c6896",
      "name": "[Discord] 通知机器人停用",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        4600,
        1920
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "efb01578-3535-425b-a80f-5187621daa48",
      "name": "[Discord] 用户消息",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        4300,
        1540
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "26068e58-f963-4f79-847e-fe5c6c62a78b",
      "name": "[Discord] 人工管理员回复",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        4300,
        2100
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "617518b4-3cc9-4415-9c0f-9956a4d421cd",
      "name": "令牌和ID",
      "type": "n8n-nodes-base.set",
      "position": [
        -740,
        1560
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "33f0e84d-6a4f-4cd7-8221-f594f5446e92",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        180,
        700
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "c1a2ba74-7af2-4229-879c-926a3b7b175b",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3980,
        780
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "b7e3b461-5832-4011-9d62-1851c9a10523",
      "name": "便签 6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        200,
        1660
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "fc64f39b-3dfe-4a20-b6a0-2ae4e34deb39",
      "name": "便签 9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -880,
        1380
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "0353bacf-5267-4481-ba68-eebe252ca28e",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        220,
        1040
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "6a778a95-6a73-46f3-b1a3-b5109e97f071",
      "name": "便利贴5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -460,
        1380
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "b5990327-09b6-42ff-91b9-b35f304c47f9",
      "name": "事件为\"机器人回复\"时防止运行",
      "type": "n8n-nodes-base.filter",
      "position": [
        -1060,
        1560
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "92678483-bfcd-4874-b521-e75d01d2b6c5",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1060,
        1040
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "f43a2452-13d7-4b1f-8d10-e3ccd8626c42",
      "name": "便签 7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        180,
        1560
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "376f2189-1ca7-457b-a117-bddbd2512fca",
      "name": "便签8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        200,
        820
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "c8a764e1-1c15-40d0-a80a-ff26eb362de9",
      "name": "便签10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1040,
        820
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "6a42f2cf-e3b2-4f6d-9212-dde834c06da8",
      "name": "便签12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2640,
        1100
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "7fbfcc62-fb74-4e82-a9c4-1f06705e4ce7",
      "name": "便签13",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1300,
        1620
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "423a161e-193f-4ca1-8d6c-61ff10e98782",
      "name": "新对话准备数据",
      "type": "n8n-nodes-base.set",
      "position": [
        2800,
        1300
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "936454e0-8622-4520-8f48-85f6e553828f",
      "name": "对话准备数据",
      "type": "n8n-nodes-base.merge",
      "position": [
        2800,
        1820
      ],
      "parameters": {},
      "typeVersion": 3,
      "alwaysOutputData": true
    },
    {
      "id": "0d1f22b6-5b34-4216-a087-81ce9aceae34",
      "name": "便签14",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3180,
        1160
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "0c26fb7b-a52d-4fc4-a8ab-9c65d814f68c",
      "name": "便签15",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3240,
        1560
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "a3e9e8c2-68e5-41ff-961e-38ed7e9613dd",
      "name": "便签16",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3940,
        1300
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "0344c58d-f5d8-4f1b-8a1f-8922333dd65a",
      "name": "便签11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        6500,
        1280
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "fd35065f-1b26-445d-a9d0-48343e3ef092",
      "name": "便签17",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        6500,
        1700
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "efa1cb98-3758-4cb2-8459-a3e0fcb7b75f",
      "name": "便签18",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        5160,
        1160
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "132ef22f-aae3-43de-b662-de3e5795153f",
      "name": "便签19",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        6460,
        1160
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "5525966d-ab1b-4995-bcf1-2eab2e2e4717",
      "name": "便签20",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1520,
        1380
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "4ad06867-b31d-44f8-abc2-57b2aa4469a8",
      "name": "便签21",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        220,
        1780
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "",
  "connections": {
    "If2": {
      "main": [
        [
          {
            "node": "[Discord] Notify bot re-activation notification",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "[Discord] Notify bot de-activation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "[Discord] User message",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "If2",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "[Discord] Human admin reply ",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "[Intercom] Reply",
            "type": "main",
            "index": 0
          },
          {
            "node": "[Discord] Reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate": {
      "main": [
        [
          {
            "node": "conversation prepared data",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Split Out": {
      "main": [
        [
          {
            "node": "Isolating all textual messages contents",
            "type": "main",
            "index": 0
          },
          {
            "node": "Isolating the 'note' to get the thread ID stored",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Tokens and Ids": {
      "main": [
        [
          {
            "node": "Whether it is a new conversation or not",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "conversation -> JSON": {
      "main": [
        [
          {
            "node": "Aggregate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "[Discord] User message": {
      "main": [
        [
          {
            "node": "not going through if bot deactivated",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "[Discord] Create Thread": {
      "main": [
        [
          {
            "node": "[Discord] Type first message into the thread",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Intercom Webhook Trigger": {
      "main": [
        [
          {
            "node": "Prevents from running when event is 'bot reply'",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "conversation info -> JSON": {
      "main": [
        [
          {
            "node": "conversation prepared data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "conversation prepared data": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "[Intercom] GET conversation": {
      "main": [
        [
          {
            "node": "Split Out",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "new conversation prepared data": {
      "main": [
        [
          {
            "node": "sorting data (cuz we join 2 different flows here)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "preparing data for Agentic use": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "not going through if bot deactivated": {
      "main": [
        [
          {
            "node": "preparing data for Agentic use",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Isolating all textual messages contents": {
      "main": [
        [
          {
            "node": "conversation -> JSON",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Whether it is a new conversation or not": {
      "main": [
        [
          {
            "node": "[Discord] Create Thread",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "[Intercom] GET conversation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "[Intercom] Store the thread ID as a 'note'": {
      "main": [
        [
          {
            "node": "new conversation prepared data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "[Discord] Type first message into the thread": {
      "main": [
        [
          {
            "node": "[Intercom] Store the thread ID as a 'note'",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prevents from running when event is 'bot reply'": {
      "main": [
        [
          {
            "node": "Tokens and Ids",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Isolating the 'note' to get the thread ID stored": {
      "main": [
        [
          {
            "node": "conversation info -> JSON",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "sorting data (cuz we join 2 different flows here)": {
      "main": [
        [
          {
            "node": "preparing data for Agentic use",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

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

需要付费吗?

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

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

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

作者
Niten Musa

Niten Musa

@nitenmusa

Just like every business has its own processes, every business will have its own AI agents — I sell and teach that transition From France 🇫🇷 — Discipline, Humility, Benevolence

外部链接
在 n8n.io 查看

分享此工作流