8
n8n 中文网amn8n.com

AI个人助手Telegram机器人

中级

这是一个AI Chatbot, Multimodal AI领域的自动化工作流,包含 11 个节点。主要使用 Telegram, GmailTool, Agent, TelegramTrigger, GoogleSheetsTool 等节点。 使用GPT-4o-mini和Google服务通过Telegram机器人管理日程和联系人

前置要求
  • Telegram Bot Token
  • Google 账号和 Gmail API 凭证
  • Google Sheets API 凭证
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "templateId": "AI_Personal_Assistant_Telegram_Bot"
  },
  "name": "AI个人助手 Telegram机器人",
  "tags": [
    "AI",
    "Personal Assistant",
    "Telegram",
    "Calendar",
    "Email",
    "Productivity"
  ],
  "nodes": [
    {
      "id": "e4981de7-db9b-455a-9c42-f3b435955c92",
      "name": "Telegram 触发器",
      "type": "n8n-nodes-base.telegramTrigger",
      "notes": "Receives messages from your Telegram bot. Replace credentials with your bot token from @BotFather",
      "position": [
        -16,
        -16
      ],
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "fa1352d4-0a3b-4871-9c5c-380d2f1fd1d5",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "notes": "Main AI agent using OpenAI. Customize the system message for your needs.",
      "position": [
        224,
        0
      ],
      "parameters": {
        "text": "={{ $json.message.text }}",
        "options": {
          "systemMessage": "You are a helpful personal assistant. When sending emails, always find the recipient's email using the 'Get Contacts' tool first.\n\nCurrent date and time: {{$now}}\n\nDaily Schedule Instructions:\n- Check Google Calendar for today's events (12:00 AM to 11:59 PM)\n- Format events with: title, start/end time, location, description\n- If no events: 'You have a free day! No events on your calendar for today.'\n- Email the summary with subject: 'Your Schedule for Today - [Date]'\n- Sign emails with 'Best Regards,'\n\nReplace 'USER_NAME' with your preferred name in the constraints below:\n\n<constraint>\nAddress the user as USER_NAME in all interactions.\n</constraint>"
        },
        "promptType": "define"
      },
      "typeVersion": 1.7
    },
    {
      "id": "152c29ec-c6be-4fd8-a01a-578ef0aa8d10",
      "name": "Telegram 响应",
      "type": "n8n-nodes-base.telegram",
      "notes": "Sends AI agent responses back to Telegram chat",
      "position": [
        592,
        0
      ],
      "parameters": {
        "text": "={{ $json.output }}",
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "9e6fa398-829a-47fd-95c2-81284e507c51",
      "name": "维基百科工具",
      "type": "@n8n/n8n-nodes-langchain.toolWikipedia",
      "notes": "Provides Wikipedia search capabilities to the AI agent",
      "position": [
        -208,
        288
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "66b8fea2-0ec0-423a-ab61-dd8fd8a7e034",
      "name": "网络搜索 (SerpAPI)",
      "type": "@n8n/n8n-nodes-langchain.toolSerpApi",
      "notes": "Enables web search functionality. Requires SerpAPI account and API key.",
      "position": [
        224,
        288
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "b5ee31ee-8c99-4362-aa1f-3bc2bf1fc9a4",
      "name": "OpenAI 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "notes": "AI language model. Change to gpt-4 or other models as needed. Requires OpenAI API key.",
      "position": [
        -304,
        288
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "gpt-4o-mini"
        },
        "options": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "f05203af-2ed7-46a7-8fd8-d3210e4e5a3c",
      "name": "对话记忆",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "notes": "Maintains conversation context. Adjust contextWindowLength as needed (default: 10 messages)",
      "position": [
        -80,
        288
      ],
      "parameters": {
        "sessionKey": "={{ $('Telegram Trigger').item.json.message.from.id }}",
        "sessionIdType": "customKey",
        "contextWindowLength": 10
      },
      "typeVersion": 1.3
    },
    {
      "id": "7ac0be2e-ad24-4990-bf5f-6a70d7f53698",
      "name": "Google日历",
      "type": "n8n-nodes-base.googleCalendarTool",
      "notes": "Manages calendar events. Replace YOUR_EMAIL@gmail.com with your calendar ID. Requires Google Calendar OAuth2 setup.",
      "position": [
        128,
        288
      ],
      "parameters": {
        "end": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('End', ``, 'string') }}",
        "start": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Start', ``, 'string') }}",
        "calendar": {
          "__rl": true,
          "mode": "id",
          "value": "YOUR_EMAIL@gmail.com"
        },
        "additionalFields": {
          "summary": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Summary', ``, 'string') }}",
          "description": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Description', ``, 'string') }}"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "0e349248-4509-41ab-a545-e2c9f0149ed6",
      "name": "Gmail工具",
      "type": "n8n-nodes-base.gmailTool",
      "notes": "Sends emails via Gmail. Requires Gmail OAuth2 setup with send permissions.",
      "position": [
        32,
        288
      ],
      "parameters": {
        "sendTo": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('To', ``, 'string') }}",
        "message": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Message', ``, 'string') }}",
        "options": {
          "senderName": "{{ $('Telegram Trigger').item.json.message.from.first_name }}",
          "appendAttribution": false
        },
        "subject": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Subject', ``, 'string') }}",
        "emailType": "text"
      },
      "typeVersion": 2.1
    },
    {
      "id": "14516c92-5f0c-4b5f-b055-b113edb3a36a",
      "name": "获取联系人",
      "type": "n8n-nodes-base.googleSheetsTool",
      "notes": "Accesses contact database in Google Sheets. Replace YOUR_GOOGLE_SHEET_ID with your sheet ID. Requires Google Sheets OAuth2 setup.",
      "position": [
        544,
        240
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_GOOGLE_SHEET_ID",
          "cachedResultName": "Contacts Sheet"
        },
        "descriptionType": "manual",
        "toolDescription": "Use this to get contact information. Read, update and write data to Google Sheets"
      },
      "typeVersion": 4.5
    },
    {
      "id": "a4d12e77-9beb-4411-897c-77c33784022e",
      "name": "获取日历事件",
      "type": "n8n-nodes-base.googleCalendarTool",
      "notes": "Retrieves calendar events for daily schedule emails. Replace YOUR_EMAIL@gmail.com with your calendar ID.",
      "position": [
        672,
        224
      ],
      "parameters": {
        "options": {},
        "calendar": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_EMAIL@gmail.com",
          "cachedResultName": "YOUR_EMAIL@gmail.com"
        },
        "operation": "getAll"
      },
      "typeVersion": 1.3
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "timezone": "America/Chicago",
    "callerPolicy": "workflowsFromSameOwner",
    "executionOrder": "v1"
  },
  "connections": {
    "AI Agent": {
      "main": [
        [
          {
            "node": "Telegram Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gmail Tool": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Get Contacts": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Wikipedia Tool": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Google Calendar": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Conversation Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Get Calendar Events": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Web Search (SerpAPI)": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - AI 聊天机器人, 多模态 AI

需要付费吗?

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

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

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

作者
Ronnie Craig

Ronnie Craig

@ronnie-craig-2025

Hi, I’m Ronnie! I scaled an eCommerce biz to $14K/month in under a year, grew a YouTube channel to 1K subs in 30 days, booked 28 daycare appointments in 6 days, and built automations for nurses to track clients. I help you create content, repurpose high-performing posts, schedule with ease, monitor trends, and automate marketing—so you stay visible and consistent without burning out.

外部链接
在 n8n.io 查看

分享此工作流