ChatGPTSalesRevenue growthAI score · PendingAI-assisted edit · no obvious prompt-injection riskn8n.io

Telegram All-in-One AI Assistant: Voice, Photo, Memory & Notes

Telegram message → n8n routing → GPT-4o-mini analysis → Baserow long-term memory/notes storage → Telegram reply

ExperiencedStepsWorkflowPrompt
Who
Automation builders who need a multimodal Telegram AI assistant with long-term memory and note-taking capabilities
You get
A Telegram bot that handles voice, photo, and text messages, extracts information into a Baserow database, and recalls memories to generate personalized responses in ongoing conversations
You need
n8n · telegram

Constraints

Prerequisites: n8n instance (self-hosted or cloud), Telegram Bot Token (from BotFather), OpenAI API Key, PostgreSQL database (for chat memory buffering), Baserow account and API Token. Costs: OpenAI API usage-based billing (transcription, image analysis, chat completions); Baserow has a free tier. Source does not provide specific cost estimates.

What they did

Author xxbean-sproutxx published a workflow template on the n8n template gallery, configuring a Telegram bot as a multimodal AI personal assistant. The workflow receives Telegram messages via Webhook, routes them by voice/text/photo using a Switch node, transcribes voice via OpenAI Whisper, analyzes photos via GPT-4o-mini image analysis, extracts text directly, and feeds all content into an AI Tools Agent. The Agent uses GPT-4o-mini with PostgreSQL short-term chat memory and Baserow long-term memory/notes, generating personalized replies returned through Telegram.

How it went

The source reports this template handles voice, photo (with captions), and text inputs, automatically saves memories and notes, and generates contextually relevant replies based on historical information (author_report). The template has 27,000 views on n8n.io. This site has not tested actual runtime performance.

Worth knowing

1. User validation is hardcoded in the Validation node (first_name/last_name/id)—replace with your actual Telegram info or unauthorized users will receive "Unable to process your message". 2. Baserow tool node databaseId(122)/tableId(639,640)/fieldId(6022,6024,6025,6027) are template example values and must be replaced with your actual Baserow instance IDs. 3. The AI Agent systemMessage hardcodes timezone America/Chicago—adjust to your deployment location. 4. The template includes placeholder references to optional additional tools (Contacts, Calendar, Web Search, Qdrant Vector Retrieval) but provides no specific configuration; extend manually. 5. Voice processing chain: Get Audio File → Transcribe Recording (OpenAI audio transcribe). Photo processing chain: Get Image → Extract from File to Base64 → Convert to Image File → Analyze Image (OpenAI image analyze).

n8n workflow template

Structure checked · Not run-tested

Use “Import from File” in n8n, or copy the JSON and paste it into the editor. Connect your own accounts, then try test data. The template is inactive by default.

Setup and test checklist

Credentials to connect

  • gpt-4o-mini node: connect OpenAI API credentials.
  • Telegram Response node: connect Telegram API credentials.
  • Get Audio File node: connect Telegram API credentials.
  • Analyze Image node: connect OpenAI API credentials.
  • Transcribe Recording node: connect OpenAI API credentials.
  • Get Image node: connect Telegram API credentials.
  • Postgres Chat Memory node: connect Postgres credentials.
  • Save Note Tool node: connect baserowApi credentials.
  • Save Memory node: connect baserowApi credentials.
  • Error message node: connect Telegram API credentials.
  • Baserow Retrieve Memories node: connect baserowApi credentials.
  • Baserow Retrieve Notes node: connect baserowApi credentials.

Configuration to replace

  • Source template is n8n public workflow #2986 (~48 nodes). Keep inactive after import; verify triggers, expressions and external API endpoints.
  • Sticky-note guidance is informational; replace placeholders with your own accounts, sheet schemas or channel IDs.

Test input and expected output

  • Manually run the main path once in a test workspace and confirm credentialed nodes authenticate without errors.
  • Drive one synthetic/redacted sample through and check output fields and downstream writes before enabling in production.

Template changes

  • Author credential bindings, webhookId and execution data are removed; the workflow is inactive. Nodes, connections and original prompts are preserved. Not run-tested in n8n.
  • No business-logic edits; verify keys, quotas and privacy compliance before use.

Template retrieved: 2026-10-24

Steps

  1. Configure Telegram Bot and Webhook

    Create a bot via @BotFather in Telegram and obtain the Bot Token. Configure the Telegram credential (telegramApi) in n8n and set up the Webhook to receive messages. The validation nodes (Validation + Check User & Chat ID) must be filled with your actual Telegram name and Chat ID to ensure only authorized users can trigger the workflow.

  2. Configure Baserow Database and Credentials

    In Baserow, create a Workspace named "Memories and Notes" with two tables: Memory Table (fields: Memory-long text, Date Added-US date with time) and Notes Table (duplicate Memory Table, rename fields to Notes and Date Added). Configure the Baserow credential (baserowApi) in n8n and record your databaseId and tableId values.

  3. Import Workflow and Connect Core Nodes

    Import the workflow JSON from the n8n template gallery (template ID 2986). Verify core node connections: Webhook (Listen for Telegram Events) → Switch (Message Router) → three branches (voice/text/image) → each preprocessed and fed into AI Tools Agent. AI Tools Agent connects to gpt-4o-mini (language model), Postgres Chat Memory (short-term memory), Window Memory (simple memory), Save Memory / Save Note Tool (Baserow tools).

  4. Configure AI Agent Prompt

    In the AI Tools Agent node's Options → System Message, enter the following system prompt (defining AI role, memory/note management rules, user info references, current time, etc.). This prompt determines when the AI automatically saves memories/notes, how it references historical information, and how it addresses the user.

    Execution prompt · Source text。AI Tools Agent node Options → System Message field

    =## ROLE  
    You are a friendly, attentive, and helpful AI assistant. Your primary goal is to assist the user while maintaining a personalized and engaging interaction. When possible, address the user by their first name to create a warmer, more personal experience.
    
    ---
    
    ## KEY TOOLS: MEMORY & NOTE MANAGEMENT
    
    These are the core features of this workflow. **You do not need permission to save notes and memories; it’s your decision based on the conversation.**
    
    ### Memory Management  
    - **When to Use:**  
      Evaluate each incoming message for noteworthy or personal information (e.g., preferences, habits, goals, important events, etc.).  
    - **Action:**  
      If the message contains such details, autonomously use the **Save Memory** Baserow tool to store a clear, concise summary.  
    - **Response:**  
      Always provide a meaningful reply that naturally acknowledges the input without revealing that a memory was saved.
    
    ### Note Management  
    - **When to Use:**  
      If the user shares specific instructions, reminders, or standalone pieces of information meant to be retained, use the **Save Note** Baserow tool.  
    - **Action:**  
      Save these as concise notes without asking for permission.  
    - **Response:**  
      Your reply should integrate the note context naturally, ensuring that the note’s purpose is honored without overemphasizing the saving action.
    
    ---
    
    ## GENERAL RULES
    
    1. **Context Awareness:**  
       - Use stored memories and notes to craft contextually relevant and personalized responses.  
       - Always consider the date and time when a memory or note was collected to ensure your responses are up-to-date.
    
    2. **User-Centric Responses:**  
       - Tailor your responses based on the user's preferences and past interactions.  
       - If the user’s first name is provided in the user info section, address them by name when it feels natural and appropriate.  
       - Be proactive in recalling relevant details from memory or notes without overwhelming the conversation.
    
    3. **Privacy and Sensitivity:**  
       - Handle all user data with care. Do not share or expose stored information unless it directly enhances the interaction.  
       - Never store passwords or usernames.
    
    4. **Fallback Responses:**  
       - If no specific task or question arises (e.g., when only saving information), respond in a way that keeps the conversation flowing naturally:  
         - “Thanks for sharing that, [First Name]! Is there anything else I can help you with today?”  
       - DO NOT tell jokes as a fallback response.
    
    5. **Additional Tools:**  
       - The remaining tools (Contacts, Calendar, Web Search, Qdrant Vector Retrieval) are available as extra features. They can be used when relevant but are secondary to the core Memory and Note management functionalities.
    
    ---
    
    ## USER INFO
    
    - **First Name**: {{ $('Listen for Telegram Events').item.json.body.message.from.first_name }}
    - **Age**: (if provided)  
    - **Location**: (if provided)  
    - **Job/Profession**: (if provided)
    
    Utilize this information to personalize your responses. For example, if the user's first name is available, begin responses with “Hi [First Name], …”
    
    ---
    
    ## REMAINING TOOLS
    
    ### <More Tools>
    - <if you add more tools, add them here and add descriptions>
    
    ---
    
    ## MEMORIES  
    
    ### Recent Noteworthy Memories  
    Here are the most recent memories collected from the user, including their date and time of collection:  
    
    **{{  
      $json.data.map(item => item.Memory).join('\n')  
    }}**
    
    **Guidelines:**  
    - Prioritize recent memories while considering older ones if still relevant.  
    - Cross-reference memories for consistency (e.g., if conflicting details are present, clarify as needed).
    
    ---
    
    ## NOTES  
    
    ### Recent Notes Collected from User:  
    Here are the most recent notes collected from the user:  
    
    **{{  
      $json.data.map(item => item.Notes).join('\n')  
    }}**
    
    **Guidelines:**  
    - Use notes for specific instructions or reminders.  
    - Keep note content distinct from general memory content.
    
    ---
    
    ## ADDITIONAL INSTRUCTIONS  
    
    - Think critically before responding to ensure your answers are thoughtful and accurate.  
    - Strive to build trust with the user by being consistent, reliable, and personable.  
    - Avoid robotic or overly formal language; aim for a conversational tone that is both friendly and helpful.
    
    ## CURRENT DATE
    
     - {{ $now.setZone('America/Chicago').toISO() }} (Set Timezone Accordingly)

    Execution prompt · Source text。AI Tools Agent node Text input field (dynamically selects text/voice transcription/image analysis result)

    ={{
      (() => {
        try {
          return $('Edit Fields').item.json.text;
        } catch (e) {
          return undefined;
        }
      })() ||
      (() => {
        try {
          return $('Edit Fields1').item.json.text;
        } catch (e) {
          return undefined;
        }
      })() ||
      (() => {
        try {
          return $('Transcribe Recording').item.json.text;
        } catch (e) {
          return undefined;
        }
      })() ||
      'default value' // optional default if all are undefined
    }}
  5. Configure Baserow Table Schema (Per Template Requirements)

    Create the table structure exactly as specified in the template sticky notes. The field types and date formats for Memory Table and Notes Table must match the template, or the AI Agent's $fromAI tool calls may fail.

    Setup guidance · Source text。Baserow admin panel manual configuration; corresponds to node Sticky Note4

    ## Baserow Set-up:
    - Create a new Workspace called "Memories and Notes"
    - Create a table within the new workspace called "Memory Table"
    - Within the "Memory Table" table, create two fields
    - First field is called "Memory" (select "long text" as the field type)
    - Second field is called "Date Added" (select 'US' date format, and check include time
    
    ## Notes Setup:
    - For the notes table we can simply "Duplicate" the "Memory Table" table that we just created
    - Rename the table to "Notes Table" 
    - Rename the first from "Memory" to "Notes"
    - **Make sure time and date are on and set correctly in "Date Added" field.**

    Setup guidance · Source text。Baserow field configuration reference images; corresponds to node Sticky Note16

    ## Baserow Memory Table Setup:
    ![Baserow example 1](https://i.imgur.com/hXADtza.png)
    ## Name first field "Memory" and set to "Long Text":
    ![Baserow example 2](https://i.imgur.com/AJG0jO6.png)
    ## Name second field "Date Added" and set to 'US' date format
    ![Baserow example 2](https://i.imgur.com/z8AJWfB.png)
  6. Test and Deploy

    After activating the workflow, send text, voice, and captioned photo messages to your Telegram bot to verify: 1) messages are routed correctly; 2) new memory/note records appear in Baserow; 3) the AI reply references historical information. Check n8n execution logs to troubleshoot credential or node errors.

Prompt you can copy

Setup guidance · Editorial suggestion。Give to setup assistant; confirm inputs and permissions before proceeding step by step

This block is the prompt. Ads are never placed here.

You are building an n8n-based Telegram AI assistant integrating voice/photo/text processing, GPT-4o-mini analysis, and Baserow long-term memory and note storage. First confirm you have ready: n8n instance, Telegram Bot Token, OpenAI API Key, PostgreSQL database, Baserow account. Then configure credentials, import the workflow, set the AI Agent system prompt, create the Baserow table structure, and test the multimodal message flow.

Before building, configure all four credentials in n8n: openAiApi, telegramApi, postgres, baserowApi. The AI Agent System Message is provided verbatim—paste it directly into the node. Baserow databaseId/tableId/fieldId values must match your actual tables; template IDs (e.g., 122/639/640) are examples only.

Source

All-in-one Telegram/Baserow AI assistant 🤖🧠 Voice/Photo/Save notes/Long term mem · xxbean-sproutxx · n8n.io · 2025-02-23

Comments & feedback

Tried this method? Share results, problems or improvements. Comments appear after moderation. Please avoid sensitive information.

Loading…

    Related