Gmail

Gmail logo

Gmail

Configuration

Gmail source connector integrates with the Gmail API to extract and synchronize email data.

Connects to your Gmail account.

It supports syncing email threads, individual messages, and file attachments.

Authentication

This connector uses OAuth 2.0 with custom credentials. You need to provide your OAuth application’s Client ID and Client Secret, then complete the OAuth consent flow.

OAuth Setup Required
  1. Create an OAuth application in your provider’s developer console
  2. Enter your Client ID and Client Secret when configuring the connection
  3. Complete the OAuth consent flow

Configuration Options

This connector does not have any additional configuration options.

Data Models

The following data models are available for this connector:

Schema for Gmail thread entities.

Reference: https://developers.google.com/gmail/api/reference/rest/v1/users.threads

FieldTypeDescription
snippetOptional[str]A short snippet from the thread
history_idOptional[str]The thread’s history ID
message_countOptional[int]Number of messages in the thread
label_idsList[str]Labels applied to this thread
last_message_dateOptional[datetime]Date of the last message

Schema for Gmail message entities.

Reference: https://developers.google.com/gmail/api/reference/rest/v1/users.messages

FieldTypeDescription
thread_idstrID of the thread this message belongs to
subjectOptional[str]Subject line of the message
senderOptional[str]Email address of the sender
toList[str]Recipients of the message
ccList[str]CC recipients
bccList[str]BCC recipients
dateOptional[datetime]Date the message was sent
snippetOptional[str]Brief snippet of the message content
body_plainOptional[str]Plain text message body
body_htmlOptional[str]HTML message body
label_idsList[str]Labels applied to this message
internal_dateOptional[datetime]Internal Gmail timestamp
size_estimateOptional[int]Estimated size in bytes

Schema for Gmail attachment entities.

Reference: https://developers.google.com/gmail/api/reference/rest/v1/users.messages.attachments

FieldTypeDescription
message_idstrID of the message this attachment belongs to
attachment_idstrGmail’s attachment ID
thread_idstrID of the thread containing the message
metadataOptional[Dict[str, Any]]Additional metadata about the attachment

Deletion signal for a Gmail message.

Emitted when the Gmail History API reports a messageDeleted. The entity_id matches the message entity’s ID format so downstream deletion removes the correct parent/children.

FieldTypeDescription
message_idstrThe Gmail message ID that was deleted
thread_idstrNone
deletion_statusstrStatus indicating the message was removed (e.g., ‘removed’)

Integrate Airweave with Google APIs on localhost

This guide will walk you through connecting Google Workspace APIs to Airweave when running locally. Google provides extensive documentation on setting up your workspace. Below is a streamlined process for connecting Google APIs to Airweave.

  1. Create a Google Cloud project for your Google Workspace (if you don’t already have one)
  2. Enable the Google Workspace APIs for Gmail, Google Calendar, and Google Drive
  3. Configure Google OAuth 2.0 consent screen
  4. Under Audience, select Make external and add test users
  5. Under Data Access, add the following scopes:
https://www.googleapis.com/auth/docs
https://www.googleapis.com/auth/drive.photos.readonly
https://www.googleapis.com/auth/drive
https://www.googleapis.com/auth/drive.readonly
https://www.googleapis.com/auth/drive.metadata
https://www.googleapis.com/auth/drive.metadata.readonly
https://www.googleapis.com/auth/gmail.readonly
https://www.googleapis.com/auth/calendar.events.public.readonly
https://www.googleapis.com/auth/calendar.freebusy
https://www.googleapis.com/auth/calendar.readonly
https://www.googleapis.com/auth/calendar.calendars.readonly
https://www.googleapis.com/auth/calendar.events.owned.readonly
https://www.googleapis.com/auth/calendar.events.readonly
  1. Create OAuth client ID credentials
  2. Under “Authorized redirect URIs,” click ”+ Add URI” and add the following URIs:
    http://localhost:8080/auth/callback/gmail
    http://localhost:8080/auth/callback/google_calendar
    http://localhost:8080/auth/callback/google_drive
  3. Locate the client ID and client secret from your newly created OAuth client. Add these credentials to the dev.integrations.yml file to enable Google API integration.