Reference · Tools

Gmail Trigger

Starts workflow when new emails are received in Gmail

Polling trigger Communication v1 Binary data

The Gmail Trigger node polls your Gmail inbox and starts a workflow the moment a new email arrives. You can filter by label, sender, read status, or any Gmail search query — for example, routing support emails tagged INBOX+IMPORTANT into a ticketing system. It returns either lightweight metadata or the full email including body, headers, and attachments.

Node type
Polling trigger
Parameters
10
Outputs
Output
Credentials
Gmail OAuth2

Gmail Trigger

Trigger workflows on new Gmail emails

Overview

The Gmail Trigger node polls the Gmail API for new emails and starts the workflow when new messages are detected. It supports filtering by labels, sender, read status, and Gmail search queries. Uses timestamp-based deduplication with ID tracking to handle same-second collisions. Can return simplified metadata or full raw email content including headers, body text, HTML, and attachments. Requires Google OAuth2 credentials.

Category: Communication
Tool Name: gmail_trigger
Version: 1

Appearance: Icon: si-gmail | Color: #4285f4

Node Type

Trigger — polling (checks for new data on a schedule)

Input / Output

DirectionPort(s)
InputNone (trigger node)
OutputOutput

Credentials

This tool requires Gmail OAuth2 credentials. See the Credentials Guide for setup instructions.

Parameters

ParameterTypeRequiredDefaultDescription
AuthenticationoptionsNooAuth2Authentication method to use.
Options: oAuth2 (recommended), serviceAccount
Google AccountcredentialNoConnect or select your Google account. (shown when Authentication is oAuth2)
Service Account EmailstringYesThe email address of the Google service account. (shown when Authentication is serviceAccount)
Private KeystringYesThe private key from the service account JSON key file. (shown when Authentication is serviceAccount)
EventoptionsNomessageReceivedWhich event to listen for.
Options: messageReceived
SimplifybooleanNotrueWhether to return a simplified version of the response instead of the raw data. When true, returns metadata only (From, To, Subject, snippet). When false, returns the full email with headers, text, HTML, and attachment info.
FilterscollectionNo{}Which emails should start the workflow. Every filter you set must match.
— Include Spam and TrashbooleanNofalseWhether to include messages from SPAM and TRASH in the results.
— Include DraftsbooleanNofalseWhether to include email drafts in the results.
— Label IDsstringNoComma-separated label IDs to filter by. Only messages matching all specified labels will be returned.
— SearchstringNoGmail search query to filter messages. Uses the same syntax as the Gmail search box (e.g. “has:attachment”, “from:user@example.com”, “subject:invoice”).
— Read StatusoptionsNounreadFilter emails by whether they have been read or not.
Options: both (Unread and Read Emails), unread (Unread Emails Only), read (Read Emails Only)
— SenderstringNoSender name or email to filter by.
OptionscollectionNo{}Additional handling for the full-email output. (shown when Simplify is false)
— Attachment PrefixstringNoattachment_Prefix for the name of attachment data properties. An index starting with 0 will be appended.
— Download AttachmentsbooleanNofalseWhether the email attachments will be included in the output.
Poll IntervalnumberNo1How often to check for new emails.
Poll Interval UnitoptionsNominutesUnit for the poll interval.
Options: seconds, minutes, hours

Output Data

Each new message becomes one output item. Every item carries _trigger (always gmail_polling) and _timestamp (when the poll ran). The rest of the shape depends on Simplify.

With Simplify on (the default), the item holds message metadata, resolved label names, and each requested header flattened to a top-level key using the header’s own name:

{
  "id": "18f2c1a9b0d4e5f6",
  "threadId": "18f2c1a9b0d4e5f6",
  "snippet": "Your invoice for August is attached",
  "sizeEstimate": 24518,
  "historyId": "552310",
  "internalDate": "1755248400000",
  "labels": [{ "id": "INBOX", "name": "INBOX" }],
  "From": "Billing <billing@example.com>",
  "To": "accounts@mycompany.com",
  "Cc": "",
  "Bcc": "",
  "Subject": "Invoice 4192",
  "_trigger": "gmail_polling",
  "_timestamp": "2026-08-15T09:01:00.000Z"
}

With Simplify off, the item holds the full message instead: id, threadId, labelIds, snippet, sizeEstimate, historyId, internalDate, headers (every header keyed by its lower-cased name), the convenience fields subject, from, to, cc, date, messageId and replyTo, the decoded text and html bodies, and attachments — one entry per attached file with filename, mimeType, size and attachmentId.

Reference values downstream by expression, e.g. {{ $json.Subject }} in simplified mode or {{ $json.subject }} in full mode.

Usage Examples

  • Start a workflow when a new email arrives in Gmail
  • Monitor a specific label for incoming support requests
  • Trigger processing when emails from a specific sender arrive
  • Watch for unread emails matching a search query
  • Poll Gmail every 5 minutes for new messages with attachments

Example Configuration

Watch for any new unread mail, simplified output:

{
  "type": "gmail_trigger",
  "parameters": {
    "event": "messageReceived",
    "simple": true,
    "pollInterval": 5,
    "pollIntervalUnit": "minutes"
  }
}

Watch one sender for invoices:

{
  "type": "gmail_trigger",
  "parameters": {
    "event": "messageReceived",
    "simple": true,
    "pollInterval": 15,
    "pollIntervalUnit": "minutes",
    "filters": {
      "includeSpamTrash": false,
      "includeDrafts": false,
      "readStatus": "unread",
      "sender": "billing@supplier.com",
      "q": "subject:invoice"
    }
  }
}

Watch specific labels with a Gmail search query:

{
  "type": "gmail_trigger",
  "parameters": {
    "event": "messageReceived",
    "simple": true,
    "pollInterval": 30,
    "pollIntervalUnit": "seconds",
    "filters": {
      "labelIds": "INBOX,IMPORTANT",
      "q": "subject:invoice OR subject:receipt",
      "readStatus": "unread"
    }
  }
}

Return the full email, including body and attachment details:

{
  "type": "gmail_trigger",
  "parameters": {
    "event": "messageReceived",
    "simple": false,
    "pollInterval": 2,
    "pollIntervalUnit": "minutes",
    "filters": {
      "readStatus": "unread",
      "q": "has:attachment"
    },
    "options": {
      "dataPropertyAttachmentsPrefixName": "attachment_",
      "downloadAttachments": true
    }
  }
}

Trigger Behavior

  • Activation: Polling starts when the workflow is activated. There is no poll at the moment of activation — the first check runs one full interval later.
  • Schedule: The trigger polls for new data based on the configured polling interval.
  • State: Maintains internal state (the date of the newest message seen, plus the IDs at that boundary) so each poll returns only mail that arrived since the last check.
  • First Run: The first poll records the current position and returns no items, so activating the workflow never replays your mailbox.
  • Testing: Running the node from the editor emits a single sample message so you can build the rest of the workflow; real mail arrives only while the workflow is activated.

Tips

The Gmail Trigger polls your Gmail inbox for new messages at a configurable interval. Filter emails by labels, sender, read status, or Gmail search queries. In simple mode, returns metadata (From, To, Subject, snippet). In full mode, returns the complete email with headers, text, HTML body, and optionally attachments. On first activation, it establishes a baseline and will only trigger on emails received after that point.

Key Relationships

  • simple controls options availability: when simple is true, the options parameter is hidden and unavailable.
  • Filter combination: all specified filter criteria work together with AND logic (all must match).
  • Gmail search syntax: the q field uses the same search syntax available in Gmail’s web interface.
  • Label IDs: use comma-separated Gmail label IDs (like “INBOX,IMPORTANT”) rather than label names.

Notes

  • Messages carrying the SENT label but not INBOX are skipped, so replies you send yourself do not re-trigger the workflow.

Frequently asked questions

Will this trigger fire for emails I send myself?

No. The node skips any message that carries the SENT label but not the INBOX label, so replies or emails you draft and send won't re-trigger the workflow. Only genuinely received messages in your inbox are processed.

What credentials does the Gmail Trigger require, and how do I set them up?

The node uses Gmail OAuth2 credentials (credential type: gmailOAuth2). You need to connect your Google account through BusyBot's credential manager using the OAuth2 flow — standard username/password credentials are not supported. Make sure the Gmail API is enabled in your Google Cloud project before authorizing.

What is the difference between simple mode and full mode, and when should I use each?

In simple mode the node returns lightweight metadata: From, To, Subject, and a short snippet. In full mode it returns the complete email including all headers, plain-text body, HTML body, and optionally attachments. Use simple mode when you only need to route or log emails; use full mode when downstream steps need to read or process the email content. Note that the additional output options (such as attachment handling) are only available in full mode — they are hidden when simple mode is active.

How do I filter emails to only match messages that meet multiple conditions?

All filter fields — label IDs, sender, read status, and the Gmail search query field — are combined with AND logic, meaning every condition you specify must match for the trigger to fire. For the label field, provide comma-separated Gmail label IDs like INBOX,IMPORTANT rather than display names. The search query field accepts the same syntax as Gmail's web search bar, so you can use operators like subject:, from:, or has:attachment alongside the other filters.

If I activate the node for the first time, will it process all existing emails in my inbox?

No. On first activation the node establishes a baseline using the current timestamp and will only trigger on emails received after that point. Existing messages in your inbox are ignored, so you won't get a flood of historical emails when you first turn the workflow on.

Build with the Gmail Trigger node

Drop it into a workflow, wire it to an agent, or call it on a schedule. You'll need Gmail OAuth2 credentials first.

Open BusyBot

Last updated . Spotted something wrong? Tell us.