Sync Gmail emails to PostgreSQL with S3 attachment storage
Ready for 3.0What this workflow does
This workflow has 19 nodes and runs on Gmail events (plus 1 other trigger). Along the way it connects Postgres, S3 and Gmail.
How it runs
Trigger: On Gmail events (plus 1 other trigger).
- Get Individual Message (Gmail): get
- Get Many Sent (Gmail): get many
- Get Many Inbox (Gmail): get many
- Binary Data Filter (Filter): keeps only the items that match a condition
- Merge: merges the data from its input branches
- Email to PostgreSQL Transform (Code): runs custom JavaScript code
- Extract Binary Metadata (Code): runs custom JavaScript code
- Upload to Storage (S3): upload
- Final Merge (Merge): merges the data from its input branches
- Split Attachments (Split Out): splits a list into separate items
…plus 5 more steps. See the full node list below.
Services it uses
Other Gmail + PostgreSQL templates (82) · Other Gmail + S3 templates (3)
Before you upgrade to n8n 3.0
Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.
- Still check Gmail Trigger below v1.4 runs as v1.4 (drafts skipped, max emails per poll) (Gmail Trigger).
- Code node: the task timeout drops from 300s to 60s. Test with a realistic data volume.
Nodes used (13)
- Loop Over Items (Split in Batches)
n8n-nodes-base.splitInBatches - Code
n8n-nodes-base.code - Edit Fields (Set)
n8n-nodes-base.set - Merge
n8n-nodes-base.merge - Aggregate
n8n-nodes-base.aggregate - Postgres
n8n-nodes-base.postgres - Filter
n8n-nodes-base.filter - S3
n8n-nodes-base.s3 - No Operation, do nothing
n8n-nodes-base.noOp - Gmail
n8n-nodes-base.gmail - Schedule Trigger
n8n-nodes-base.scheduleTrigger - Gmail Trigger
n8n-nodes-base.gmailTrigger - Split Out
n8n-nodes-base.splitOut
From the author
Sync Gmail emails to PostgreSQL with S3 attachment storage Automated Gmail Email Processing System Who's it for Businesses and individuals who need to: - Archive email communications in a searchable database - Backup email attachments to cloud storage -…