Grok Bot软件写代码交付AI 评分 · 待评分AI 辅助编辑·未发现明显提示词注入风险n8n.io

Telegram 多工具个人助理:Grok-4 + 日历/邮件/记忆

在 Telegram 聊天中触发 → n8n 路由文本或语音 → 加载 Airtable 记忆 → Grok-4 Agent 调用工具 → 回复 Telegram

有一点经验步骤流程提示词
给谁
希望在 Telegram 里用自然语言管理日程、查询邮件和记忆的个人用户
你会得到
通过 Telegram 与 AI 助手对话,自动保存记忆、调用日历/Gmail/Notion/搜索并返回结果
你需要
n8n · telegram · grok-4 · airtable · google-calendar · gmail · notion · serpapi

硬约束

需要 n8n 实例(自托管或云版)、Telegram Bot token(@BotFather)、xAI Grok API key、OpenAI API key、Airtable base/table、Google Calendar/Gmail OAuth、Notion integration token、SerpAPI key。模板 workflow.json 可直接导入 n8n。

他们做了什么

作者 vladzima 在 n8n 上发布了一个官方模板,构建了一个以 Telegram 为入口的个人 AI 助理 workflow。该 workflow 通过 Telegram Trigger 接收文本或语音消息,经 If 节点路由:文本直接进入 Agent,语音则经 Telegram 文件下载和 OpenAI 转录后进入。同时并行从 Airtable 加载用户历史记忆,经 Aggregate 打包后与当前输入 Merge。AI Agent 使用 xAI Grok-4 作为推理模型,配备 Simple Memory(30 轮短期记忆)和多个工具(SerpAPI 搜索、Google Calendar CRUD、Gmail 查询、Notion 数据库查询、Airtable Save Memory)。Agent 的系统提示词要求它在每次对话中判断是否需要保存用户新信息,并静默调用 Save Memory 工具存入 Airtable,不告知用户。最终回复通过 Telegram 发回。

效果如何

模板在 n8n.io 上发布,展示为可导入的 workflow 结构(author_report)。来源未提供第三方独立验证或性能基准。典型使用场景包括:语音创建日程、查询近期会议、总结邮件、回忆阅读清单、网页搜索等。

值得知道

本站未实际导入运行该 workflow(reproduction=not_tested)。关键限制:1) 需要 8 种外部 API 凭证,配置门槛较高;2) Airtable 的 base/table ID 和 filterByFormula 需用户自行替换;3) Google Calendar 和 Notion 的 ID 字段在模板中为空,需手动选择;4) 工具调用延迟会叠加到 Telegram 响应时间;5) OpenAI 转录对音频格式和长度有限制;6) 记忆量增长后需定期归档或调整 Aggregate 窗口;7) 敏感信息可能存入 Airtable,需限制 base 访问权限;8) 系统提示词中的姓名/性别占位符需用户替换,否则 Agent 自我认知不完整。

步骤

  1. 配置 Telegram 触发与消息路由

    在 n8n 中导入模板后,先配置 Telegram Trigger 节点:使用 @BotFather 创建 bot 并获取 token,填入 telegramApi 凭证;在 additionalFields.chatIds 填入你的 Telegram user ID;设置 download = true 以支持语音消息。配置 Text vs Voice Router(If 节点):条件检查 $json.message.text 是否存在——存在则走文本路径,不存在(语音消息)则走语音分支。同时,该节点会并行触发 Get memories 获取历史记忆。

  2. 配置语音转录分支(可选)

    若用户发送语音消息,路由到 Get a file 节点下载语音文件(fileId = $json.message.voice.file_id),然后进入 Transcribe a recording 节点(OpenAI audio transcribe 操作),将语音转为文本后汇入 Merge 节点。文本消息则直接进入 Merge。

  3. 配置记忆系统

    长期记忆:在 Airtable 创建 base/table,字段为 Memory、User、Created(Created 自动管理)。在 Get memories 节点配置 base/table ID 和 filterByFormula(如 {User} = 'your_name');Aggregate 节点将 Memory 和 Created 字段打包为 Memories 数组;Merge 节点将当前输入与 Memories 合并后送入 Agent。短期记忆:Simple Memory 节点设置 sessionKey = {{ $('If').item.json.message.chat.id }},contextWindowLength = 30(可调)。Save Memory 工具节点配置同一 base/table,User 字段写死或映射,Memory 字段使用 $fromAI('Memory')。

  4. 连接工具与凭证

    为以下工具分别创建并连接凭证:xAI Grok Chat Model(模型选 grok-4-0709,凭证 xAiApi);Search Web with SerpAPI(serpApi);Google Calendar 工具组(googleCalendarOAuth2Api):Get many events / Create / Update / Delete;Gmail 工具组(gmailOAuth2):Get many messages / Get a message;Notion 工具(notionApi):Get a database,需填写 databaseId;Save Memory(airtableTokenApi)。所有工具通过 ai_tool 连线接入 AI Agent。

  5. 配置 AI Agent 系统提示词与输入

    AI Agent 节点选择 promptType = define。Text input 填入表达式:={{ $json.text }}{{ $json.message.text }}(合并转录文本与原始文本)。System Message 填入以下提示词(需替换 ____ 为你的信息):

    运行提示词 · 来源原文。AI Agent 节点的 System Message 字段

    =# ROLE  
    You are a friendly AI assistant.  
    You are talking to ____. Your name is ____, your gender is ____.
    
    # RULES  
    When the user sends a new message, determine whether it contains information that should be saved in memory. Keep in mind that almost everything needs to be saved, as every detail is important to the user. Call the **Save Memory** tool to save the information. DO NOT inform the user that the information has been saved. Just continue to answer the question or perform the next tasks.  
    Do not use emojis, only in cases where it is truly appropriate.
    
    # Tools  
    ## Save Memory  
    Use this tool to save information about the user. Extract and briefly summarize the details from the user's message and pass them to this tool.  
    ## SerpAPI  
    Use this tool if you need to find something on the Internet.  
    ## Google Calendar  
    These are several tools to be used if the user requests something related to the calendar and schedule.  
    ## Gmail  
    These are several tools to be used if the user requests something related to email and messages.  
    ## Notion  
    These are several tools to be used if the user requests something related to Notion, Neurocracy, or reading lists.
    
    # Memory  
    Below are the latest significant memories collected about the user, including the date and time they were created.  
    !! IMPORTANT!  
    Think through your responses and consider the user's preferences!  
    Also, keep in mind the date and time when the memory was saved to always have the most up-to-date information.
    
    {{ $json.Memories.toJsonString() }}
  6. 配置 Telegram 回复并测试

    Send a text message 节点设置 chatId = {{ $('Telegram Trigger').item.json.message.chat.id }},text = {{ $json.output }},appendAttribution = false。保存并激活 workflow。在 Telegram 向 bot 发送文本或语音消息,验证:文本消息直接得到回复;语音消息被转录后得到回复;涉及日历/邮件/搜索/Notion 的查询触发对应工具;个人事实被静默存入 Airtable。

可复制提示词

搭建指导 · 本站建议版本。交给搭建助手,先确认输入和权限

这一段是提示词,页面不会在这里插入广告。

你是一个 n8n 模板搭建助手。用户想复现「Telegram 多工具个人助理」模板。请先确认用户是否已具备以下凭证和权限:n8n 实例、Telegram bot token 与 user ID、xAI Grok API key、OpenAI API key、Airtable base/table、Google OAuth(Calendar + Gmail)、Notion integration token、SerpAPI key。若缺少,请给出获取指引。然后按步骤指导导入 workflow.json、配置各节点凭证、替换系统提示词中的占位符,并建议先用文本消息测试,再用语音和工具调用测试。

系统提示词中的 ____ 需替换为实际用户信息;Airtable filterByFormula 和 User 字段需匹配你的账户;Google Calendar 和 Notion 的 ID 需从对应平台获取。

来源

Multi-tool personal assistant with Telegram, Grok-4, Gmail, Calendar & Memory · vladzima · n8n.io · 2025-08-15

留言与反馈

试过这个方法吗?分享效果、遇到的问题或改进建议。留言审核后公开,请勿填写敏感信息。

正在加载…

    相关用例