Max Plan Required: The Gmail connector is available on Max plan and above.
Quick Setup
1. Create Gmail Connection
- TypeScript
- Python
- cURL
2. Handle OAuth Callback
After user grants permissions, Google redirects to your callback URL. The connection is automatically established and the initial sync begins.3. Check Connection Status
- TypeScript
- Python
- cURL
What Gets Synced
Email Threads
Gmail threads (conversations) are synced as individual documents with all messages included:- Thread content converted to structured markdown
- All messages within each thread preserved in order
- Message metadata: subject, from, to, cc, bcc, date
- HTML content converted to clean markdown
- Attachment metadata: filename, mime type, size (attachments are referenced, not stored)
Document Metadata
Each synced thread includes searchable metadata:
You can filter searches using these metadata fields:
Connection Management
List All Connections
- TypeScript
- Python
- cURL
Delete Connection
- TypeScript
- Python
- cURL
Deleting a connection will:
- Stop all future syncs from Gmail
- Remove the OAuth authorization
- Keep existing synced documents in supermemory (they won’t be deleted)
Manual Sync
Trigger a manual synchronization:- TypeScript
- Python
- cURL
Sync Mechanism
Gmail connector supports multiple sync methods:How Real-time Sync Works
- When a connection is created, supermemory registers a Gmail API “watch” subscription
- Gmail sends notifications to a Google Cloud Pub/Sub topic when emails change
- supermemory receives these notifications and fetches updated threads
- Watch subscriptions expire after 7 days and are automatically renewed
Real-time sync monitors the INBOX label. Emails in other labels are synced via scheduled/manual sync.
Permissions & Scopes
The Gmail connector requests the following OAuth scopes:Limitations
Troubleshooting
OAuth Fails or Missing Refresh Token
If OAuth fails or the connection stops syncing:- Delete the existing connection
- Create a new connection
- Ensure the user completes the full OAuth flow with consent
Emails Not Syncing in Real-time
If real-time sync isn’t working:- Scheduled sync (every 4 hours) and manual sync still work
- Real-time sync requires supermemory’s Pub/Sub infrastructure
- Check if the connection was created recently (watch registration happens on creation)
- Trigger a manual sync to verify the connection is working
Permission Denied Errors
If you see permission errors:- Ensure the user granted the required Gmail scopes during OAuth
- Verify your organization has Scale Plan or Enterprise Plan access
- Check if the user revoked app access in their Google Account settings