Process Voice, Images & Documents with GP-40, MongoDB & Gmail Tools
## What it does
This n8n workflow creates a cutting-edge, multi-modal AI Memory Assistant designed to capture, understand, and intelligently recall your personal or business information from diverse sources. It automatically processes voice notes, images, documents (like PDFs), and text messages sent via Telegram. Leveraging GPT-4 for advanced AI processing (including visual analysis, document parsing, transcription, and semantic understanding) and MongoDB Atlas Vector Search for persistent and lightning-fast recall, this assistant acts as an external brain. Furthermore, it integrates with Gmail, allowing the AI to send and search emails as part of its memory and response capabilities. This end-to-end solution blueprint provides a powerful starting point for personal knowledge management and intelligent automation.
## How it works
#### 1. Multi-Modal Input Ingestion
Your memories begin when you send a voice note, an image, a document (e.g., PDF), or a text message to your Telegram bot. The workflow immediately identifies the input type.
#### 2. Advanced AI Content Processing
Each input type undergoes specialized AI processing by GPT-4:
1. Voice notes are transcribed into text using OpenAI Whisper.
2. Images are visually analyzed by GPT-4 Vision, generating detailed textual descriptions.
3. Documents (PDFs) are processed for text extraction, leveraging GPT-4 for robust parsing and understanding of content and structure. Unsupported document types are gracefully handled with a user notification.
4. Text messages are directly forwarded for further processing.
This phase transforms all disparate input formats into a unified, rich textual representation.
#### 3. Intelligent Memory Chunking & Vectorization
The processed content (transcriptions, image descriptions, extracted document text, or direct text) is then fed back into GPT-4. The AI intelligently chunks the information into smaller, semantically coherent pieces, extracts relevant keywords and tags, and generates concise summaries. Each of these enhanced memory chunks is then converted into a high-dimensional vector embedding using OpenAI Embeddings.
#### 4. Persistent Storage & Recall (MongoDB Atlas Vector Search)
These vector embeddings, along with their original content, metadata, and tags, are stored in your MongoDB Atlas cluster, which is configured with Atlas Vector Search. This allows for highly efficient and semantically relevant retrieval of memories based on user queries, forming the core of your smart recall system.
#### 5. AI Agent & External Tools (Gmail Integration)
When you ask a question, the AI Agent (powered by GPT-4) acts as the central intelligence. It uses the MongoDB Chat Memory to maintain conversational context and, crucially, queries the MongoDB Atlas Vector Search store to retrieve relevant past memories. The agent also has access to Gmail tools, enabling it to send emails on your behalf or search your past emails to find information or context that might not be in your personal memory store.
#### 6. Smart Response Generation & Delivery
Finally, using the retrieved context from MongoDB and the conversational history, GPT-4 synthesizes a concise, accurate, and contextually aware answer. This response is then delivered back to you via your Telegram bot.
## How to set it up (~20 Minutes)
Getting this powerful workflow running requires a few key configurations and external service dependencies.
**Telegram Bot Setup:**
1. Use BotFather in Telegram to create a new bot and obtain its API Token.
2. In your n8n instance, add a new Telegram API credential. Give it a clear name (e.g., My AI Memory Bot) and paste your API Token.
**OpenAI API Key Setup:**
1. Log in to your OpenAI account and generate a new API key.
2. Within n8n, create a new OpenAI API credential. Name it appropriately (e.g., My OpenAI Key for GPT-4) and paste your API key. This credential will be used by the OpenAI Chat Model (GPT-4 for processing, chunking, and RAG), Analyze Image, and Transcribe Audio nodes.
**MongoDB Atlas Setup:**
1. If you don't have one, create a free-tier or paid cluster on MongoDB Atlas.
2. Create a database and a collection within your cluster to store your memory chunks and their vector embeddings.
3. Crucially, configure an Atlas Vector Search index on your chosen collection. This index will be on the field containing your embeddings (e.g., embedding field, type knnVector). Refer to MongoDB Atlas documentation for detailed instructions on creating vector search indexes.
4. In n8n, add a new MongoDB credential. Provide your MongoDB Atlas connection string (ensure it includes your username, password, and database name), and give it a clear name (e.g., My Atlas DB). This credential will be used by the MongoDB Chat Memory node and for any custom HTTP requests you might use for Atlas Vector Search insertion/querying.
**Gmail Account Setup:**
1. Go to Google Cloud
n8nFree