Telegram AI Assistant with Multi-Modal Input and Baserow Long-Term Memory - n8n Workflow

Use this powerful n8n workflow to build a private, secure Telegram AI assistant. It handles voice, text, and image input, using Baserow for long-term memory and notes storage, powered by GPT-4o-mini.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Users looking for advanced n8n templates integrating LangChain agents.
Developers needing a complex n8n workflow for personal, secure Telegram bots.
Businesses requiring persistent, context-aware AI interactions stored securely in Baserow.
Automation specialists mastering intricate multi-step n8n node sequences.

Overview

This comprehensive n8n workflow transforms a basic conversational bot into an intelligent, context-aware AI assistant. It solves the critical problem of short-term LLM memory limits by integrating Baserow as a dedicated, searchable database for persistent 'Memories' and 'Notes'. The solution utilizes an advanced AI Agent powered by GPT-4o-mini, capable of processing any input type—text messages, voice notes (transcribed using OpenAI Whisper), or images (analyzed via Vision). This complex n8n automation provides a secure and reliable platform, starting with user validation and ending with a personalized response. This n8n workflow serves as an excellent foundation for any complex AI application requiring persistent data storage and multi-modal handling.

How it Works

The automation begins when the Listen for Telegram Events n8n trigger receives a message.


  1. Security and Validation: The n8n workflow first checks the sender's details against pre-configured values using the Check User & Chat ID n8n node to ensure security.

  2. Input Diversion: The Message Router n8n node directs the message based on content:

Voice: The audio is downloaded, and the Transcribe Recording n8n node converts it to text.
Image: The image file is retrieved, converted to base64, and the Analyze Image n8n node (GPT-4o-mini Vision) generates a text description.
* Text: The message proceeds directly.

  1. Contextual Retrieval: Regardless of the input type, the n8n workflow utilizes Baserow Retrieve Memories and Baserow Retrieve Notes n8n nodes to fetch relevant historical context.

  2. Agent Processing: All gathered context (input, retrieved Baserow data, and short-term chat history managed by the Postgres n8n node) is fed into the AI Tools Agent. This agent decides the best action, using the gpt-4o-mini n8n node, and autonomously employs the Save Note Tool or Save Memory n8n tool nodes to update Baserow if needed.

  3. Final Output: The Agent's final, personalized response is delivered back to the user instantly through the Telegram Response n8n node, completing the execution of the n8n workflow.

Installation Guide

To deploy this advanced n8n workflow template, follow these setup steps:


  1. Import the JSON: Copy the provided n8n workflow JSON and import it into your n8n instance.

  2. Baserow Database Setup: Follow the instructions in the sticky notes within the n8n template. Create two tables in Baserow—one for 'Memories' and one for 'Notes'—with appropriate Long Text and Date/Time fields. Configure the Baserow API credential and set the correct Database ID and Table IDs across all Baserow-related n8n nodes.

  3. OpenAI Credentials: Add an OpenAI API credential and link it to the gpt-4o-mini, Transcribe Recording, and Analyze Image n8n nodes.

  4. Telegram Credentials: Configure the Telegram API credential and link it to all Telegram n8n nodes (Listen for Telegram Events, Get Audio File, Telegram Response, etc.).

  5. Database Setup (Postgres): Set up a Postgres credential and connect the Postgres Chat Memory n8n node for short-term conversation storage.

  6. Secure User Validation: Modify the Validation n8n node to include your specific Telegram first name, last name, and user ID. This is vital to securing the n8n trigger and ensuring only you can run the n8n workflow.

  7. Activation: Activate the n8n workflow and set up the corresponding webhook in your Telegram bot configuration.

Node Details

Listen for Telegram Events (n8n trigger): The webhook n8n trigger that initiates the entire n8n workflow upon receiving any message from Telegram.
Check User & Chat ID (If n8n node): Filters incoming data based on pre-set user details, securing the n8n workflow. It only proceeds if the message matches the expected user ID.
Message Router (Switch n8n node): Essential for multi-modal handling; this n8n node dynamically routes execution based on the presence of voice, text, or image data in the message body.
Transcribe Recording (OpenAI n8n node): Converts voice messages into usable text data for the LLM, leveraging the high efficiency of the Whisper model.
Analyze Image (OpenAI n8n node): An n8n node that leverages GPT-4o-mini's vision capabilities to describe images, turning visual data into contextual input for the AI.
Baserow Retrieve Memories / Notes (Baserow n8n node): Retrieves long-term context from the Baserow database, providing the AI Agent with personalized history.
Postgres Chat Memory (LangChain n8n node): Maintains session-based chat history using Postgres, allowing the AI Agent to recall recent conversational turns efficiently.
AI Tools Agent (LangChain n8n node): The core control structure. This n8n node processes the prompt, accesses the connected LLM (gpt-4o-mini n8n node), utilizes memory, and determines if it needs to execute the Baserow Tool n8n nodes.


  • Save Memory / Save Note Tool (Baserow Tool n8n node): These specialized tool n8n nodes are exposed to the AI Agent, enabling it to write new memories or notes back to Baserow autonomously.

Related n8n Workflows

Free

Nodes: 18 Nodes
Updated: December 26 2025
View all
Created by
Rod
Rod

Automation enthusiast and builder of real-world AI tools. I specialize in self-hosted n8n workflows. My projects focus on practical AI applications, from data enrichment and search automation to AI-driven contact management. Always exploring new ways to make automation simple, efficient, and FUN!

Featured*