Gmail to Vector Embeddings with PGVector & Ollama
Ingests Gmail emails into Postgres with pgvector for vector embeddings using local Ollama. Enables semantic searches on email history while storing structured data.
This workflow automates the extraction and vectorization of Gmail emails into a Postgres database enhanced with pgvector. It uses the open-source Ollama with nomic-embed-text model for generating embeddings locally, ensuring privacy and no external dependencies. Emails are stored in both structured tables (with metadata like ID, date, sender) and a vector embeddings table, linked by Gmail message ID for hybrid queries.
To use, specify your Gmail account creation date and manually run the workflow to bulk-import historical emails in monthly batches. Once populated, activate the Gmail Trigger node to continuously process new incoming emails. This setup supports semantic similarity searches, allowing queries like 'What hotel did I stay in last summer?' via vector search on email content.
Benefits include 100% local operation for data sovereignty, dual storage for structured and semantic access, and foundation for RAG applications. It saves hours of manual data organization and enables AI-powered insights from email archives without cloud costs.
Ideal use cases: Personal knowledge bases from emails, business email analytics for customer interactions, compliance archiving with search, or integrating with chatbots for querying history (pairs with Telegram RAG workflows). Perfect for users wanting offline AI vector stores.
New buyers can create an account from the cart to unlock a controlled $10 first-purchase credit on eligible orders of $25+.
Secure checkout powered by Stripe
Tags
Support
How to import this workflow into n8n
- 1Purchase or download the workflow to get the n8n workflow JSON file.
- 2In your n8n instance, open Workflows and choose "Import from File" (or paste the JSON with Ctrl+V on the canvas).
- 3Open each node marked with a credential warning and connect your own accounts and API keys.
- 4Run the workflow once manually to verify the data flow, then toggle it to Active.
Related Business Operations & ERPs workflows
- Automate Job Applications and Track Status with LinkedIn, Indeed, and Google Sheets$14.99
- Automated Stock Price Monitoring and Alerts for Indian & US Markets$9.99
- Build Custom Workflows Automatically with GPT-4o, RAG, and Web Search$24.99
- AI Chat Agent Receptionist for Clinics$150
- Automatically Archive Zoom Recordings to Google Drive and Log in Airtable$4.99
- Automate Call Scheduling with Voice AI Receptionist Using Twilio, Google Calendar & Airtable$24.99
More from Nadia Ivanov
Need this deployed? We'll set it up for you.
Our automation experts deploy this workflow in your stack, connect your accounts, and verify it works — or build a custom solution from scratch.