What this workflow does
This workflow is an AI assistant inside n8n that works with Telegram and Baserow.
It takes voice, text, and photo messages from Telegram, turns voice into text, understands photos, and keeps important notes saved in Baserow.
The assistant then uses AI to reply nicely and helpfully on Telegram.
This saves time by organizing messages automatically and making replies smart and personal.
Who should use this workflow
This automation fits people who use Telegram for work and personal chats and want to keep track of important messages easily.
It is good if you get voice notes, pictures, or text you want to remember or act on without searching manually.
Tools and services used
- Telegram Bot API: Receives messages and sends replies on Telegram.
- OpenAI API: Converts voice to text, analyzes images, and generates AI replies.
- Baserow database: Stores long-term memories and notes from messages.
- Postgres database (optional): Keeps recent chat memory to improve AI reply context.
- n8n automation platform: Runs all workflow steps and connects the tools.
How this workflow works: Inputs → Processing → Output
Inputs
- Voice, photo, or text messages sent to the Telegram bot.
- User details for access control.
Processing steps
- Webhook: Captures incoming Telegram messages.
- User validation: Checks if messenger matches an allowed user ID.
- Message type detection: Routes voice, text, and photo messages separately.
- Voice processing: Downloads audio, then transcribes speech to text using OpenAI.
- Photo processing: Downloads images, converts to base64, and analyzes content with OpenAI.
- Text processing: Extracts message text for AI understanding.
- Memory retrieval: Gets stored notes and memories from Baserow to add context.
- AI reply generation: Uses LangChain agent with OpenAI GPT to create personalized responses using memory context.
- Memory saving: Adds new notes or memories to Baserow automatically if AI finds important info.
- Optional session memory: Stores recent chats in Postgres to improve AI replies contextually.
Output
- Sends back formatted, interactive replies on Telegram bot conversation.
- Stores long-term memory and notes accessible later in Baserow.
Beginner step-by-step: How to use this workflow in n8n production
1. Import workflow
- Download the workflow file using the Download button on this page.
- Open the n8n editor where you want to run the automation.
- Use the “Import from File” option to load the downloaded workflow.
2. Setup credentials and settings
- Add your Telegram Bot API token in the Telegram nodes.
- Insert OpenAI API key in relevant transcription, image analysis, and GPT nodes.
- Connect your Baserow account and update table IDs for Memories and Notes.
- Check and update the user ID and names in the Validation nodes to your Telegram details.
3. Testing and activation
- Send a test voice, text, or photo message to your Telegram bot to see if the workflow triggers and replies.
- If it works, toggle the workflow from draft to active to run it live.
Optional: For stronger control over your data and better privacy use, consider self-host n8n.
Possible issues and how to fix
- If webhook does not trigger, check the webhook path is exactly set to “gram” and HTTP method is POST in the Webhook node.
Also confirm Telegram webhook points to correct n8n URL. - If AI replies are not personal or too general, review the system prompt and ensure Baserow memories are fetched properly in the LangChain agent node.
- If voice transcription fails, verify the audio binary data path is mapped correctly from Telegram file download to the OpenAI transcription node input.
Customizations and extensions
- Change OpenAI model in the LangChain agent to GPT-4 or other supported versions for smarter replies.
- Add new AI tools or APIs like calendar or contacts in the system prompt for richer AI help.
- Edit the prompt in LangChain agent to control when notes or memories are saved based on keywords or message content.
- Support multiple users by adding more Telegram users in the Validation nodes with their IDs and names.
- Connect Baserow tables to no-code UI tools for manual browsing or editing of saved memories and notes.
Summary
✓ Automatically process Telegram voice, text, and photo messages.
✓ Turn voice into text and analyze images using AI.
✓ Save and recall important notes and memories in Baserow.
✓ Generate personalized AI replies that keep conversations flowing.
✓ Free up your time by automating message organization and replies.
