Gmail Integration

'Connect Gmail to Supervity, authorize access, and automate email sending, message search, thread parsing, label management, and real-time email triggers in workflows.'

This guide explains how to connect Gmail to Supervity, what capabilities become available after connection, how operators and workflows can send and manage emails, and how to manage or remove the integration when needed.


Overview

The Supervity Gmail integration allows your workspace to securely connect Gmail as a governed platform capability.

Once connected, operators and workflows can compose and send formatted emails, retrieve incoming messages, search historical threads with advanced queries, apply and remove labels, and react in real time to newly received emails using push notifications.

With the Gmail integration, Supervity can:

  • Send plain-text and rich HTML emails with recipients, CC, BCC, and attachments
  • Support email threading by replying directly into existing conversations (threadId)
  • Search mailbox messages and threads using Gmail's full search syntax (from:, has:attachment, is:unread)
  • Retrieve full email details including sender headers, subject, body text, and attachments
  • Modify message labels to archive, star, mark as read, or assign custom tags
  • Trigger workflows in real time when new emails arrive in the inbox or under specific labels
  • Provide email communication history as context for AI operators
  • Coordinate communications between customer support inquiries, CRM leads, and internal alerts

All Gmail access is governed through Supervity's security, permissions, and audit controls.


Why Use the Gmail Integration?

The Gmail integration helps your organization:

  • Automate customer outreach, onboarding sequences, and transaction confirmations
  • Monitor inbound mailboxes (e.g., support@, billing@) and auto-triage incoming requests
  • Extract key data from invoices, booking receipts, and client emails for automated processing
  • Keep team communication synchronized by drafting or sending email updates directly from workflows
  • Maintain conversational continuity by keeping replies organized within standard email threads
  • Protect your domain with strict OAuth 2.0 authorization—no shared passwords or IMAP credentials required

Prerequisites

Before connecting Gmail, ensure you have:

  • An active Supervity workspace
  • A Google account (Google Workspace or personal @gmail.com account)
  • Permission to authorize third-party applications on your Google account
  • Access to the mailbox you wish to automate

In Google Workspace domains, administrators can configure API access under Google Workspace Admin Console → Security → API Controls.


Adding the Gmail Integration

Follow these steps to connect Gmail to Supervity. If you encounter any issues during setup, refer to the Troubleshooting section of this guide.

Step 1: Open Integrations

  1. Log in to Supervity.
  2. From the left navigation bar, click the Integrations icon.

This opens the Integrations page, where all available and connected integrations are listed.

Step 2: Select Gmail

  1. Locate Gmail in the available integrations list.
  2. Click Connect.

Step 3: Authorize Access

You will be redirected to Google's secure OAuth 2.0 authorization screen.

  1. Select the Google account you wish to connect.
  2. Review the requested permissions (sending emails, reading emails, managing labels).
  3. Click Continue (or Allow) to grant Supervity access.
  • Supervity uses standard Google OAuth 2.0 with offline access for secure token refresh.
  • Your Google password is never shared with or stored by Supervity.
  • All tokens are encrypted at rest using AES-256.

Step 4: Complete Connection

After authorization, Google redirects you back to Supervity.

The Gmail integration will appear as Connected on the Integrations page. Your workspace can now send emails, search messages, and listen for incoming mail.

Step 5: Start Using Gmail

Once connected:

  • Gmail actions become available in operator planning and workflow steps.
  • Real-time triggers can be configured to start workflows whenever new emails arrive.
  • Operators can draft responses and inspect email threads during task execution.
  • You can manage, share with teams, or disconnect the integration at any time from the Integrations page.

How Gmail Works in Supervity

After connection, Gmail becomes available as a governed platform capability.

Workflows interact with Gmail via:

  • Actions: Query messages, send new or threaded emails, fetch message bodies, and update labels.
  • Triggers: Real-time push notifications via Google Cloud Pub/Sub notify Supervity whenever new mail arrives in the mailbox.
  • Enrichment: When a message arrives, Supervity automatically fetches the full message body (up to 100k characters with text/plain preferred and HTML fallback), sender address, subject, and timestamp before executing the workflow.

Using Gmail in Operators

Connected Gmail capabilities become available to AI operators automatically. Operators determine when email communication is required and invoke the appropriate actions.

What Operators Can Do with Gmail

  • Send personalized customer notifications and follow-up emails
  • Parse inbound emails to extract tracking numbers, invoice amounts, or order details
  • Search the mailbox for correspondence related to a specific client or deal
  • Draft replies within existing email threads to maintain context
  • Move processed emails to designated archive or review labels
  • Forward critical alerts to team members based on message content

Typical Operator Use Cases

Use CaseExample
Inbound Email TriageTrigger when a support email arrives, summarize the inquiry, and route it to Jira or Slack
Invoice ExtractionFetch incoming emails with PDF attachments, extract invoice details, and log them into Google Sheets
Automated Customer OutreachSend an automated welcome email with personalized links when a new user registers
Threaded Support RepliesRead customer replies and send contextual responses within the same email thread
Email Clean-Up & ArchivingMark automated notifications as read and remove them from the primary inbox

Features & Prerequisites

For each Gmail capability available in Supervity, the following describes its functionality and prerequisites.

Send Email

Use Case: Compose and send an email message, with optional threading and rich formatting.

Key Parameters:

  • to: Recipient email address(es).
  • subject: Email subject line.
  • body: Plain text or HTML message body.
  • cc / bcc: Optional secondary recipients.
  • threadId: Conversation thread ID to reply within an existing thread.
  • attachments: Optional file attachments.

Prerequisites:

  • Gmail connected to Supervity
  • Send permission (gmail.send scope)

List Messages

Use Case: Query message IDs and thread IDs matching specific search terms or labels.

Key Parameters:

  • q: Search query string using standard Gmail search syntax.
  • labelIds: Array of labels to filter by (e.g., ["INBOX"], ["UNREAD"]).
  • maxResults: Maximum number of messages to return per page.
  • pageToken: Token for pagination.

Common Query Syntax Examples:

  • from:[email protected]: Match sender address.
  • subject:"Monthly Invoice": Match subject keywords.
  • has:attachment: Filter to messages containing attachments.
  • after:2024/01/01 is:unread: Match unread emails after a date.

Prerequisites:

  • Gmail connected to Supervity
  • Read permission (gmail.readonly scope)

Get Message

Use Case: Retrieve the full payload of an email message by its ID.

Key Parameters:

  • messageId: Unique identifier of the message.
  • format: Response format ('full', 'metadata', 'minimal', or 'raw').

Response Includes:

  • Subject line, sender, recipients, date header.
  • Extracted body text (plain text or clean HTML).
  • Attachment identifiers and filenames.
  • Current label IDs applied to the message.

Prerequisites:

  • Gmail connected to Supervity
  • Read permission (gmail.readonly scope)

Modify Labels

Use Case: Add or remove labels from an existing message to organize mail or update status.

Key Parameters:

  • messageId: Unique identifier of the message.
  • addLabelIds: Labels to apply (e.g., ["STARRED"], ["Label_123"]).
  • removeLabelIds: Labels to remove (e.g., ["UNREAD"], ["INBOX"] to archive).

Prerequisites:

  • Gmail connected to Supervity
  • Modify permission (gmail.modify scope)

Real-Time Webhook Triggers

Gmail supports real-time push triggers powered by Google Cloud Pub/Sub.

Available Triggers

Trigger EventCatalog KeyDescription
New Email Receivedgmail.message.receivedFires when an email arrives in the watched mailbox or label

Trigger Scoping

You can scope the trigger:

  • Default (Inbox): Watches for emails landing in INBOX.
  • Specific Label: Watch for messages tagged with a specific Gmail label ID (e.g., "SUPPORT", "INVOICES").

Enriched Event Fields

When an email arrives, Supervity enriches the delivery with full message details:

  • messageId: Unique Gmail message ID
  • threadId: Conversation thread ID
  • subject: Email subject
  • from: Sender name and email address
  • to: Primary recipient email address
  • snippet: Short preview snippet of the message
  • body: Full email body text (preferred text/plain, HTML fallback, capped at 100k chars)
  • received_at: ISO 8601 received timestamp
  • labels: Array of label names applied to the message
  • fetch_error: Non-null only if message details could not be retrieved from Gmail

Loop Prevention & Thread Guard

When Supervity workflows send emails, the created messageId and threadId are cached in Redis. Subsequent notifications matching the connected mailbox's outgoing sends are identified and dropped as self-generated, preventing feedback loops.


Permissions Requested

Supervity only requests the permissions required for enabled Gmail capabilities.

Depending on the features used in your workspace, permissions may include:

Permission TypePurpose
User IdentityAssociate email activity with authorized Google accounts
Message ReadSearch, read, and inspect incoming emails, threads, and attachments
Message SendCompose, send, and reply to emails and automated notifications
Draft ManagementCreate, update, and manage email drafts for human review
Label & OrganizationApply labels, archive, star, or organize emails in mailbox folders

Supervity follows least-privilege principles and only accesses data necessary to provide requested functionality.


Authentication & Security

  • Direct OAuth 2.0: Secure authentication with Google Identity—no app passwords or IMAP credentials required.
  • AES-256 Encryption: Stored OAuth access and refresh tokens are encrypted at rest with AES-256-GCM.
  • OIDC Push Verification: Google Pub/Sub push notifications are verified using OpenID Connect (OIDC) service account signatures.
  • Full Audit Trail: All outgoing emails and message reads are logged with timestamp, user ID, and action parameters.

Troubleshooting

Issue: Inbound Email Trigger Is Not Firing

Cause: Gmail push notifications require active Pub/Sub topic subscription and a valid mailbox watch channel.

Resolution:

  1. Navigate to Webhooks & Triggers in Supervity and verify the trigger status.
  2. Click Re-register to renew the Gmail mailbox watch.
  3. Verify that new emails are actually arriving in the configured label (default: INBOX).

Issue: "Daily User Sending Quota Exceeded" (429 / 403)

Cause: Google imposes sending limits on Gmail accounts (typically 500 emails/day for personal accounts, 2,000 emails/day for Google Workspace accounts).

Resolution:

  1. For high-volume marketing broadcasts, use a dedicated email service (e.g., Mailchimp or SendGrid).
  2. For operational notifications, batch messages or add rate-limiting delays between workflow runs.

Issue: Replies Are Not Appearing in the Same Thread

Cause: Email threading requires both threadId and standard email headers (In-Reply-To and References).

Resolution:

  1. In the gmail_send_email action, supply the threadId returned from the incoming message.
  2. Ensure the email subject begins with Re: and matches the original subject.

Frequently Asked Questions

Q: Can Supervity send emails from aliases or shared mailboxes?
Yes, provided the alias is configured under the connected user's Gmail "Send mail as" settings in Google Workspace.

Q: Does Supervity support sending HTML emails?
Yes. You can supply standard HTML markup in the message body, including tables, links, and inline formatting.

Q: Can I attach files from Google Drive to Gmail emails?
Yes. Workflows can download a file from Google Drive using google_drive_download_file and attach it directly to the outgoing Gmail message.


Support

If you need assistance with the Gmail integration, visit the Support page.

Support Hours

  • Monday to Friday, 9:00 AM – 6:00 PM IST
  • Requests submitted outside business hours will be addressed on the next business day

First Response SLA

  • All support requests receive an initial response within 24 business hours

Contact Information

When Contacting Support, Please Provide

  • Workspace name
  • Gmail account used for authorization
  • Target label or thread ID (if applicable)
  • Relevant workflow or operator information
  • Error messages or screenshots when available

This helps the support team investigate and resolve issues more quickly.


product-guide/integrations-overview/gmail