Create Gmail Feed
User Intent
"How do I sync Gmail messages? Show me Gmail feed configuration."
Operation
SDK Method: createFeed() with FeedTypes.Email
Auth: Google OAuth tokens
Code Example (TypeScript)
import { Graphlit } from 'graphlit-client';
import { FeedTypes, FeedServiceTypes, EmailListingTypes } from 'graphlit-client/dist/generated/graphql-types';
const graphlit = new Graphlit();
const feed = await graphlit.createFeed({
name: 'Gmail Inbox',
type: FeedTypes.Email,
email: {
type: FeedServiceTypes.GoogleEmail,
google: {
type: EmailListingTypes.Past,
clientId: process.env.GOOGLE_CLIENT_ID!,
clientSecret: process.env.GOOGLE_CLIENT_SECRET!,
refreshToken: process.env.GOOGLE_REFRESH_TOKEN!,
readLimit: 100,
inboxOnly: true,
excludeSentItems: true
},
includeAttachments: true,
},
// Optional: add workflow for content processing
// workflow: { id: workflow.createWorkflow.id }
});
console.log(`Created Gmail feed: ${feed.createFeed.id}`);Configuration
type: EmailListingTypes.Past or EmailListingTypes.New
readLimit: Number of emails to sync
inboxOnly: Only sync inbox (excludes other labels)
excludeSentItems: Exclude sent messages
includeSpam: Include spam folder (default: false)
includeDeletedItems: Include trash (default: false)
includeAttachments: Download email attachments
filter: Gmail search filter (e.g., "from:[email protected] has:attachment")
Gmail OAuth Setup
Create project in Google Cloud Console
Enable Gmail API
Create OAuth 2.0 credentials (Web application)
Add redirect URI
Get refresh token via OAuth flow
What Gets Synced
Email subject, body, and headers
Sender and recipient information
Timestamps and labels
Attachments (if enabled)
Thread relationships
Filtering Examples
By sender:
filter: "from:[email protected]"By date range:
filter: "after:2024/01/01 before:2024/12/31"With attachments:
filter: "has:attachment"By label:
filter: "label:important"Related
Outlook Email Feed - Microsoft email
Slack Feed - Team messaging
Feed Operations - Query and manage feeds
Last updated
Was this helpful?