Graphlit Platform
Developer PortalChangelogPlatform StatusMore InformationJoin Discord
  • Graphlit Platform
    • What is Graphlit?
    • Key Concepts
  • Getting Started
    • Sign up for Graphlit
    • Create Graphlit Project
    • For Python Developers
    • For Node.js Developers
    • For .NET Developers
  • 🚀Quickstart
    • Next.js applications
      • GitHub Code
    • Python applications
      • GitHub Code
  • Graphlit Data API
    • API Usage
      • API Endpoints
      • API Authentication
      • API Explorer
      • GraphQL 101
    • API Reference
      • Content
        • Ingest With Workflow
        • Ingest File
        • Ingest Encoded File
        • Ingest Web Page
        • Ingest Text
        • Semantic Search
          • Query All Content
          • Query Facets
          • Query By Name
          • Filter By Contents
        • Metadata Filtering
          • Filter By Observations
          • Filter By Feeds
          • Filter By Collections
          • Filter By Content Type
          • Filter By File Type
          • Filter By File Size Range
          • Filter By Date Range
        • Summarize Contents
        • Extract Contents
        • Publish Contents
      • Knowledge Graph
        • Labels
        • Categories
        • Persons
        • Organizations
        • Places
        • Events
        • Products
        • Repos
        • Software
      • Collections
      • Feeds
        • Create Feed With Workflow
        • Create RSS Feed
        • Create Podcast Feed
        • Create Web Feed
        • Create Web Search Feed
        • Create Reddit Feed
        • Create Notion Feed
        • Create YouTube Feed
        • User Storage Feeds
          • Create OneDrive Feed
          • Create Google Drive Feed
          • Create SharePoint Feed
        • Cloud Storage Feeds
          • Create Amazon S3 Feed
          • Create Azure Blob Feed
          • Create Azure File Feed
          • Create Google Blob Feed
        • Messaging Feeds
          • Create Slack Feed
          • Create Microsoft Teams Feed
          • Create Discord Feed
        • Email Feeds
          • Create Google Mail Feed
          • Create Microsoft Outlook Feed
        • Issue Feeds
          • Create Linear Feed
          • Create Jira Feed
          • Create GitHub Issues Feed
        • Configuration Options
      • Workflows
        • Ingestion
        • Indexing
        • Preparation
        • Extraction
        • Enrichment
        • Actions
      • Conversations
      • Specifications
        • Azure OpenAI
        • OpenAI
        • Anthropic
        • Mistral
        • Groq
        • Deepseek
        • Replicate
        • Configuration Options
      • Alerts
        • Create Slack Audio Alert
        • Create Slack Text Alert
      • Projects
    • API Changelog
    • Multi-tenant Applications
  • JSON Mode
    • Overview
    • Document JSON
    • Transcript JSON
  • Content Types
    • Files
      • Documents
      • Audio
      • Video
      • Images
      • Animations
      • Data
      • Emails
      • Code
      • Packages
      • Other
    • Web Pages
    • Text
    • Posts
    • Messages
    • Emails
    • Issues
  • Data Sources
    • Feeds
  • Platform
    • Developer Portal
      • Projects
    • Cloud Platform
      • Security
      • Subprocessors
  • Resources
    • Community
Powered by GitBook
On this page
  • Reading Past Emails
  • Reading New Emails

Was this helpful?

  1. Graphlit Data API
  2. API Reference
  3. Feeds
  4. Email Feeds

Create Google Mail Feed

Create Google Email feed to ingest emails and email attachments.

Graphlit supports ingesting emails and email attachments from Google Mail.

The createFeed mutation enables the creation of a feed by accepting the feed name, type and email feed parameters and it returns essential details, including the ID, name, state, and type of the newly generated feed.

You will need to opt-in to extracting email attachments from emails, which will be ingested as new content objects, by assigning includeAttachments to true.

Graphlit can either read past emails, newest to oldest, or read new emails with a recurrent feed.

Reading emails from Google requires an OAuth refresh token, which must be requested by your application for the user's email account. Graphlit stores this refresh token, and will use it to request a new user token when reading from the Google email account. Also, you will need your Google OAuth client ID and client secret.

Reading Past Emails

To read past emails, you can set the type to PAST, and optionally set a readLimit if you don't want to read all the past emails in your account.

Mutation:

mutation CreateFeed($feed: FeedInput!) {
  createFeed(feed: $feed) {
    id
    name
    state
    type
  }
}

Variables:

{
  "feed": {
    "type": "EMAIL",
    "email": {
      "type": "GOOGLE_EMAIL",
      "includeAttachments": true,
      "google": {
        "refreshToken": "redacted",
        "clientId": "redacted",
        "clientSecret": "redacted",
        "type": "PAST"
      },
      "readLimit": 50
    },
    "name": "Google Mail"
  }
}

Response:

{
  "type": "EMAIL",
  "id": "70cf882a-9cd9-45c1-b5a0-88606938248a",
  "name": "Google Mail",
  "state": "ENABLED"
}

Reading New Emails

If you want to continually read new emails, you can assign type field to NEW, and configure the schedulePolicy to repeat reading from the feed every 5 minutes.

Mutation:

mutation CreateFeed($feed: FeedInput!) {
  createFeed(feed: $feed) {
    id
    name
    state
    type
  }
}

Variables:

{
  "feed": {
    "type": "EMAIL",
    "email": {
      "type": "GOOGLE_EMAIL",
      "includeAttachments": true,
      "google": {
        "refreshToken": "redacted",
        "type": "NEW"
      }
    },
    "schedulePolicy": {
      "recurrenceType": "REPEAT",
      "repeatInterval": "PT5M"
    },
    "name": "Google Mail"
  }
}

Response:

{
  "type": "EMAIL",
  "id": "cdd33957-774e-4bfb-a62a-87e0905268b1",
  "name": "Google Mail",
  "state": "ENABLED"
}

User Authentication

When using User authentication, you will need to authenticate your end-user via OAuth 2.0 and receive a refresh token for the end-user. Graphlit will use the refresh token to authenticate and enumerate emails on Google Email on your user's behalf.

Last updated 10 months ago

Was this helpful?

More information on creating a Google OAuth client ID can be found and .

here
here

Queries

Mutations

Objects