在Telegram上与GPT-5聊天:AI驱动的对话机器人

中级

这是一个AI Chatbot、Multimodal AI领域的自动化工作流,包含 14 个节点。主要使用 Telegram、AimlApi、GoogleSheets、TelegramTrigger 等节点。 在Telegram上与GPT-5聊天:AI驱动的对话机器人

前置要求
  • Telegram Bot Token
  • Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "355b2d103ad4834400263e78c73e64bbdb709c896780479c01a9ab9ccd7df6cf",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "368c3442-b61b-4e35-9de0-f7ef3f52aa0f",
      "name": "📩 接收 Telegram 消息",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        1072,
        1968
      ],
      "webhookId": "3ceea664-fd53-4141-8bc6-4fdaca0a661d",
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "cFC7gGbzU7PQGk6J",
          "name": "Telegram account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "fe8f2304-f2f6-45d5-8f26-3e07f59f2122",
      "name": "便签 — 概述",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1168,
        304
      ],
      "parameters": {
        "color": 5,
        "width": 560,
        "height": 496,
        "content": "# 💬 AI 聊天机器人 — Telegram + AIMLAPI(通过 n8n)"
      },
      "typeVersion": 1
    },
    {
      "id": "1d3c2472-92fe-4d4e-b157-81de61882d0b",
      "name": "便签 — 自定义",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1168,
        816
      ],
      "parameters": {
        "color": 5,
        "width": 560,
        "height": 560,
        "content": "## ⚙️ 自定义"
      },
      "typeVersion": 1
    },
    {
      "id": "fc3443dd-7c1d-478f-846b-e20b2d480898",
      "name": "便签 — 设置指南",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1744,
        448
      ],
      "parameters": {
        "color": 5,
        "width": 560,
        "height": 544,
        "content": "# 🛠 设置指南"
      },
      "typeVersion": 1
    },
    {
      "id": "cdd88b85-4766-4e2c-9e5f-7b409963c443",
      "name": "便签 — 日志记录与测试",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1744,
        1008
      ],
      "parameters": {
        "color": 5,
        "width": 560,
        "height": 432,
        "content": "## 📁 可选数据记录"
      },
      "typeVersion": 1
    },
    {
      "id": "f6b40a2d-c83a-47aa-9046-23cdc601ef73",
      "name": "📝 记录成功生成",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2784,
        1968
      ],
      "parameters": {
        "columns": {
          "value": {
            "date": "={{ new Date().toISOString().split('T')[0] }}",
            "query": "={{ $('📩 Receive Telegram Message').item.json.message.text }}",
            "result": "={{ $('🧠 Process with GPT‑5').item.json.content }}",
            "user_id": "={{ $json.result.from.id }}"
          },
          "schema": [
            {
              "id": "user_id",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "user_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "query",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "query",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "result",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "result",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 2060422727,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/19rsFwln4KMpGjOzxOdz7OC_-kRH8_qD4Agx5lXlDD9k/edit#gid=2060422727",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "19rsFwln4KMpGjOzxOdz7OC_-kRH8_qD4Agx5lXlDD9k",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/19rsFwln4KMpGjOzxOdz7OC_-kRH8_qD4Agx5lXlDD9k/edit?usp=drivesdk",
          "cachedResultName": "AI bot usage statistic"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "OaJ0A7gqb1dgxqB8",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "a00ee4eb-0c89-48a2-87c1-000197b71a55",
      "name": "便签 — 接收消息",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        944,
        1552
      ],
      "parameters": {
        "color": 3,
        "width": 384,
        "height": 608,
        "content": "# 📥 步骤 1 — 接收 Telegram 消息"
      },
      "typeVersion": 1
    },
    {
      "id": "375019d6-a2c0-438c-950c-376603599dc5",
      "name": "便签 — GPT‑5 处理",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1744,
        1552
      ],
      "parameters": {
        "width": 384,
        "height": 608,
        "content": "# 🧠 步骤 2 — 使用 GPT‑5 处理"
      },
      "typeVersion": 1
    },
    {
      "id": "e58d2186-f12e-43a4-9b7c-a644d27e64fa",
      "name": "便签 — 发送回复",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2144,
        1552
      ],
      "parameters": {
        "color": 4,
        "width": 384,
        "height": 608,
        "content": "# 📤 步骤 3 — 发送回复到 Telegram"
      },
      "typeVersion": 1
    },
    {
      "id": "06a31bfb-15af-40fe-b468-057cf985180f",
      "name": "便签 — 日志记录",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2640,
        1552
      ],
      "parameters": {
        "color": 5,
        "width": 384,
        "height": 608,
        "content": "# 📝 步骤 4 — 记录交互(可选)"
      },
      "typeVersion": 1
    },
    {
      "id": "333a49e9-e553-4f95-87b9-d89548db6114",
      "name": "🧠 使用 GPT‑5 处理",
      "type": "n8n-nodes-aimlapi.aimlApi",
      "position": [
        1888,
        1968
      ],
      "parameters": {
        "model": "openai/gpt-5-chat-latest",
        "prompt": "={{ $('📩 Receive Telegram Message').item.json.message.text }}",
        "options": {},
        "requestOptions": {}
      },
      "credentials": {
        "aimlApi": {
          "id": "EXXHjMACiSMAhuC8",
          "name": "AI/ML account"
        }
      },
      "retryOnFail": false,
      "typeVersion": 1,
      "alwaysOutputData": false
    },
    {
      "id": "960ea33b-3c1a-4ad1-a330-18aab8bc030a",
      "name": "📤 发送回复到 Telegram",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2288,
        1968
      ],
      "webhookId": "4a46da0a-9a91-4f31-802a-f0ce89516aa7",
      "parameters": {
        "text": "={{ $json.content }}",
        "chatId": "={{ $('📩 Receive Telegram Message').item.json.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false,
          "reply_to_message_id": "={{ $('📩 Receive Telegram Message').item.json.message.message_id }}"
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "cFC7gGbzU7PQGk6J",
          "name": "Telegram account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "7cc29371-2e04-440c-baea-4f7a716a5acf",
      "name": "便签 — 接收消息1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1344,
        1552
      ],
      "parameters": {
        "color": 3,
        "width": 384,
        "height": 608,
        "content": "# 💬 步骤 1.5 — 在 Telegram 中模拟输入"
      },
      "typeVersion": 1
    },
    {
      "id": "3e50eeda-e420-48fe-b136-1191d679f422",
      "name": "💬 在 Telegram 中模拟输入",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1488,
        1968
      ],
      "webhookId": "d275c6c6-00c3-4ccd-9e29-48c99574d7b2",
      "parameters": {
        "chatId": "={{ $json.message.chat.id }}",
        "operation": "sendChatAction"
      },
      "credentials": {
        "telegramApi": {
          "id": "cFC7gGbzU7PQGk6J",
          "name": "Telegram account"
        }
      },
      "typeVersion": 1.2
    }
  ],
  "pinData": {},
  "connections": {
    "🧠 Process with GPT‑5": {
      "main": [
        [
          {
            "node": "📤 Send Response to Telegram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "📩 Receive Telegram Message": {
      "main": [
        [
          {
            "node": "💬 Simulate Typing in Telegram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "📤 Send Response to Telegram": {
      "main": [
        [
          {
            "node": "📝 Log Successful Generation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "💬 Simulate Typing in Telegram": {
      "main": [
        [
          {
            "node": "🧠 Process with GPT‑5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

这是一个中级难度的工作流,适用于AI Chatbot、Multimodal AI等场景。适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

需要付费吗?

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

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

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

作者
外部链接
在 n8n.io 上查看 →

分享此工作流