Gmail to Vector Embeddings with PGVector and Ollama
Configured with Document Default Data Loader, Embeddings Ollama, Gmail, Gmail Trigger, and additional nodes. Review the connections and setup before adapting this template.
Node categories in this workflow
- AI & models
- Files / media
- Transform
- Trigger
- Routing
- Data store
- Code
- Messaging
Icons describe general node roles, inferred from node types. Inspect the parameters for the configured action.
Drag to pan; use + and − to zoom. Reconstructed from the exported node positions; nothing runs here. Dashed lines represent non-main connections. Full node names and notes appear below.
How it works
The exported workflow contains the following configured nodes. Their connections are shown above; inspect the JSON for the complete logic, expressions, and external actions.
| Node | Category | Type | Operation |
|---|---|---|---|
| Embeddings Ollama | AI & models | Embeddings Ollama | See node parameters |
| Default Data Loader | Files / media | Document Default Data Loader | See node parameters |
| Recursive Character Text Splitter | Transform | Text Splitter Recursive Character Text Splitter | See node parameters |
| Gmail Trigger | Trigger | Gmail Trigger | See node parameters |
| Loop Over Items | Routing | Loop Over Items | See node parameters |
| Split Out | Transform | Split Out | See node parameters |
| Was manually triggered? | Routing | If | See node parameters |
| Manual Trigger | Trigger | Manual Trigger | See node parameters |
| No Operation, do nothing | Routing | No Op | See node parameters |
| Set before and after dates | Transform | Edit Fields | See node parameters |
| Extract email fields | Transform | Edit Fields | See node parameters |
| Store structured | Data store | Postgres | upsert |
| Store vectorized | Data store | Vector Store Pgvector | See node parameters |
| Create the table | Data store | Postgres | executeQuery |
| Explode interval into weeks | Code | Code | See node parameters |
| Get a batch of messages | Messaging | Gmail | getAll |
Setup
- Download the JSON and import it into an isolated n8n instance. Leave the workflow inactive.
- Connect your own credentials through n8n’s credential store. Replace
REPLACE_WITH_*values with your resource identifiers. - Inspect API destinations, Code nodes, database queries, file paths, and outbound actions.
- Run with synthetic data and harmless destinations. Enable triggers only after checking the actual outputs.
Requirements
An n8n instance with the listed node types and compatible versions. Service-connected workflows may require accounts, credentials, or paid APIs.
Credential types declared in the source
None declared. HTTP requests and Code nodes may still need configuration.
Workflow notes
Bulk e-mail import
Bulk e-mail import
Press the Test workflow button to run this once, and bulk import of all your e-mail
IMPORTANT
Specify your Gmail account creation date by editing the code node
Edit this ⬇️
Edit this ⬇️
And specify your Gmail account creation date
Activate the workflow
Activate the workflow
And this trigger will check for new mail, every minute
Magic here 🪄
Magic here 🪄
(not really, just statistics)
E-mail is stored in a emails_metadata structured table, and also fed to the nomic-embed-text model to be stored in a emails_embeddings table as vector embeddings so similarity searches are possible.
The email_id field can be used to make the relation between the structured records and the vector embeddings, as it's stored in their metadata as emails_metadata.id.
This is also the case for thread_id.
Gmail to Vector Embeddings with PGVector and Ollama
Gmail to Vector Embeddings with PGVector and Ollama
Purpose and structure
This folder contains the Gmail to Vector Embeddings with PGVector and Ollama workflow. Its executable nodes use code, documentDefaultDataLoader, embeddingsOllama, gmail, gmailTrigger, if, manualTrigger, noOp, postgres, set, splitInBatches, splitOut, textSplitterRecursiveCharacterTextSplitter, vectorStorePGVector. The table and connection map below are derived from the JSON, not an inferred guarantee of behavior.
Setup
Import inactive. Configure your own credentials and replace REPLACE_WITH_* values. Review external destinations and Code nodes before running.
Entry points
Gmail Trigger, Manual Trigger
Verification
Sanitized source candidate; not runtime-tested. This overview is generated from node metadata. Read the folder README for the connection map, credential types, and license.
Attribution
https://github.com/Zie619/n8n-workflows/blob/94007c1445d9258a7da116646b79473e7c7c3282/workflows/Splitout/1783_Splitout_Postgres_Automation_Triggered.json MIT; preserve source notices.