8
n8n 中文网amn8n.com

个人 Telegram AI 助手机器人

高级

这是一个Personal Productivity, AI Chatbot领域的自动化工作流,包含 17 个节点。主要使用 If, Switch, Telegram, GmailTool, NotionTool 等节点。 语音与文本助手,集成Telegram、Gemini AI、日历、Gmail和Notion

前置要求
  • Telegram Bot Token
  • Google 账号和 Gmail API 凭证
  • Notion API Key
  • Google Gemini API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "63Dw6h0zoqobTINZ",
  "meta": {
    "instanceId": "0c8ccd6e2b94aafad23c580930e4e83dbe91d3bb2fa78619864f045d32095a87",
    "templateCredsSetupCompleted": true
  },
  "name": "个人 Telegram AI 助手机器人",
  "tags": [],
  "nodes": [
    {
      "id": "79c2aa38-769d-4dd5-bb4a-cf675ea22e2d",
      "name": "Telegram触发器",
      "type": "n8n-nodes-base.telegramTrigger",
      "notes": "Enter your Telegram bot token from BotFather after creating the bot.\n",
      "position": [
        -640,
        0
      ],
      "webhookId": "05154c83-094f-4401-b647-7df5b41d1a04",
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "hbvE8OBwHFyOHQY3",
          "name": "Telegram account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "66a44dc8-8914-4555-9c38-1436ad19307a",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        384,
        16
      ],
      "parameters": {
        "text": "={{ $json.message.text }}{{ $json.content.parts[0].text }}",
        "options": {
          "systemMessage": "=You are a useful assistant to {{ $json.message.from.first_name }}. You can send emails, View and edit Calendar events, created notes in notion and also try to do tasks as assigned by them. "
        },
        "promptType": "define"
      },
      "typeVersion": 2.2
    },
    {
      "id": "736b9880-a4c8-471d-a0e0-58a8b51c6cb5",
      "name": "在 Gmail 中发送消息",
      "type": "n8n-nodes-base.gmailTool",
      "notes": "Connect a Gmail account by opening console.cloud.google.com, enabling the Gmail API for the project, and completing Google account authorization.",
      "position": [
        1040,
        384
      ],
      "webhookId": "399c3a8e-3282-4ff6-8866-4ba568db1441",
      "parameters": {
        "sendTo": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('To', ``, 'string') }}",
        "message": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Message', ``, 'string') }}",
        "options": {
          "appendAttribution": false
        },
        "subject": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Subject', ``, 'string') }}"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "bx2nv5qBrnceBEgb",
          "name": "Gmail account 2"
        }
      },
      "notesInFlow": true,
      "typeVersion": 2.1
    },
    {
      "id": "4cff267f-45dc-466e-869b-e4b4e08dfd91",
      "name": "简单记忆",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        560,
        -176
      ],
      "parameters": {
        "sessionKey": "={{ $json.message.text }}{{ $json.content.parts[0].text }}",
        "sessionIdType": "customKey"
      },
      "typeVersion": 1.3
    },
    {
      "id": "89e93f91-c0aa-438d-87bd-5a1f525c36f5",
      "name": "Google Gemini聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "notes": "Enter the Google Gemini API key to enable Gemini model.",
      "position": [
        400,
        -176
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "googlePalmApi": {
          "id": "qLwVRPuYTlFlr43H",
          "name": "Google Gemini(PaLM) API"
        }
      },
      "notesInFlow": true,
      "typeVersion": 1
    },
    {
      "id": "ecb246b8-653d-46fb-817c-f123e22f871f",
      "name": "发送文本消息",
      "type": "n8n-nodes-base.telegram",
      "notes": "Sends the bot’s response after the workflow finishes executing.",
      "position": [
        1072,
        16
      ],
      "webhookId": "6bdcb401-3021-45ef-81c7-b716b2fd04b7",
      "parameters": {
        "text": "={{ $json.output }}",
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "hbvE8OBwHFyOHQY3",
          "name": "Telegram account"
        }
      },
      "notesInFlow": true,
      "typeVersion": 1.2
    },
    {
      "id": "4948f012-fb76-49d0-85fd-0327d398b45f",
      "name": "检查是否为音频文件",
      "type": "n8n-nodes-base.if",
      "notes": "Determines if the incoming message is an audio file or a text message, then routes it accordingly.",
      "position": [
        -208,
        0
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "or",
          "conditions": [
            {
              "id": "281d35b3-486b-41e2-9b29-8b51de139dd6",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.message.voice.file_id }}",
              "rightValue": "={{ $json.message.chat.id }}"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "3461eb67-c0b2-4173-8b2e-de919b14f8c4",
      "name": "转录录音",
      "type": "@n8n/n8n-nodes-langchain.googleGemini",
      "notes": "This node transcribes audio to text via Google Gemini; provide the Gemini credentials to establish the connection.",
      "position": [
        144,
        -160
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "models/gemini-2.5-flash",
          "cachedResultName": "models/gemini-2.5-flash"
        },
        "options": {},
        "resource": "audio",
        "inputType": "binary"
      },
      "credentials": {
        "googlePalmApi": {
          "id": "qLwVRPuYTlFlr43H",
          "name": "Google Gemini(PaLM) API"
        }
      },
      "notesInFlow": true,
      "typeVersion": 1
    },
    {
      "id": "189f07e3-6d2f-4b33-bd69-ee8c2c9d9916",
      "name": "获取文件",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -16,
        -160
      ],
      "webhookId": "7e103121-9656-4fc1-8c03-7cbe42ef7583",
      "parameters": {
        "fileId": "={{ $json.message.voice.file_id }}",
        "resource": "file",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "hbvE8OBwHFyOHQY3",
          "name": "Telegram account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "3bb3d890-849d-4c42-8b84-636971098567",
      "name": "在 Google Calendar 中创建活动",
      "type": "n8n-nodes-base.googleCalendarTool",
      "notes": "Connect Google Calendar to this node. This node enables the Create Event action in Google Calendar.",
      "position": [
        720,
        384
      ],
      "parameters": {
        "end": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('End', `start time and end time for google calendar event.`, 'string') }}",
        "start": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Start', ``, 'string') }}",
        "calendar": {
          "__rl": true,
          "mode": "list",
          "value": "pav200113@gmail.com",
          "cachedResultName": "pav200113@gmail.com"
        },
        "descriptionType": "manual",
        "toolDescription": "Create an event in Google Calendar",
        "additionalFields": {}
      },
      "credentials": {
        "googleCalendarOAuth2Api": {
          "id": "gzXfrCKDpiANbSpl",
          "name": "Google Calendar account 2"
        }
      },
      "notesInFlow": true,
      "typeVersion": 1.3
    },
    {
      "id": "fd1c0213-c0b1-41c4-9274-43cd63cb1193",
      "name": "在 Google Calendar 中读取活动",
      "type": "n8n-nodes-base.googleCalendarTool",
      "notes": "Connect Google Calendar to this node. This node enables the Read Event action in Google Calendar.",
      "position": [
        560,
        384
      ],
      "parameters": {
        "options": {},
        "timeMax": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Before', ``, 'string') }}",
        "timeMin": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('After', ``, 'string') }}",
        "calendar": {
          "__rl": true,
          "mode": "list",
          "value": "pav200113@gmail.com",
          "cachedResultName": "pav200113@gmail.com"
        },
        "operation": "getAll",
        "descriptionType": "manual",
        "toolDescription": "Get events from google calendar when request. Consider sending all the events for the specific day stated by user."
      },
      "credentials": {
        "googleCalendarOAuth2Api": {
          "id": "gzXfrCKDpiANbSpl",
          "name": "Google Calendar account 2"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "214c9e52-968a-4933-839e-946cbfcd5f6f",
      "name": "在 Notion 中创建笔记",
      "type": "n8n-nodes-base.notionTool",
      "notes": "Create a Notion integration and paste its API key into the Notion credentials, then provide the public page URL where the bot should post messages.",
      "position": [
        880,
        384
      ],
      "parameters": {
        "title": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Title', `Notes by Paul Created by Liz AI`, 'string') }}",
        "pageId": {
          "__rl": true,
          "mode": "url",
          "value": "https://www.notion.so/N8N-AI-Agent-Notes-26f11b7ddc0680ae8913d9c1ea7faff4?source=copy_link"
        },
        "blockUi": {
          "blockValues": [
            {
              "type": "bulleted_list_item",
              "textContent": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('blockValues0_Text', ``, 'string') }}"
            },
            {
              "url": "={{ $fromAI('blockValues1_Image_URL', ``, 'string') }}",
              "type": "image"
            }
          ]
        },
        "options": {}
      },
      "credentials": {
        "notionApi": {
          "id": "HcojMo7PRRvD68sw",
          "name": "Notion account 2"
        }
      },
      "notesInFlow": true,
      "typeVersion": 2.2
    },
    {
      "id": "cb8c4cbf-d6df-4e03-b84a-a3fea6331f39",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -672,
        -192
      ],
      "parameters": {
        "color": 2,
        "width": 592,
        "height": 368,
        "content": "## Telegram 触发器与检查"
      },
      "typeVersion": 1
    },
    {
      "id": "bf1fe6ec-79a3-4e94-862c-3c5427f86014",
      "name": "账户检查",
      "type": "n8n-nodes-base.switch",
      "notes": "Provide the message ID from your Telegram account in the parameter value field to authenticate your chat.\n",
      "position": [
        -416,
        0
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "773564ea-faf4-4a3a-982c-7c3ee092547c",
                    "operator": {
                      "type": "number",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.message.chat.id }}",
                    "rightValue": null
                  }
                ]
              }
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "0b38ba6b-85ec-4de1-bacb-9d7381fc5398",
      "name": "便签 1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -64,
        -288
      ],
      "parameters": {
        "color": 3,
        "width": 384,
        "height": 304,
        "content": "## 音频处理"
      },
      "typeVersion": 1
    },
    {
      "id": "b30e6ccd-eebe-4972-9105-f61ce4f64a78",
      "name": "便签 2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        336,
        -352
      ],
      "parameters": {
        "width": 368,
        "height": 336,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "eb6027ec-0990-433e-aff6-2cfd184e9f6c",
      "name": "便签 3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        288,
        256
      ],
      "parameters": {
        "color": 4,
        "width": 896,
        "height": 288,
        "content": ""
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "timezone": "Asia/Kolkata",
    "callerPolicy": "workflowsFromSameOwner",
    "errorWorkflow": "Q3zRHMkTDIS89L8B",
    "executionOrder": "v1"
  },
  "versionId": "61be5764-628d-4b58-bbd8-783962aece29",
  "connections": {
    "AI Agent": {
      "main": [
        [
          {
            "node": "Send a text message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get a file": {
      "main": [
        [
          {
            "node": "Transcribe a recording",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Account Check": {
      "main": [
        [
          {
            "node": "Check If Audio file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Account Check",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check If Audio file": {
      "main": [
        [
          {
            "node": "Get a file",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create notes in Notion": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Transcribe a recording": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send a message in Gmail": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Read event in Google Calendar": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Create an event in Google Calendar": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 个人效率, AI 聊天机器人

需要付费吗?

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

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

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

外部链接
在 n8n.io 查看

分享此工作流