Gmail Trigger Custom

Fetches emails from Gmail on polling intervals with token caching

Gmail Trigger Custom

AI-generated

Summary

Polls a delegated Gmail mailbox on the configured schedule and emits matching emails as workflow items. Uses a service account JWT for Gmail API access, caches access tokens, and tracks poll progress between runs.

Inputs

  • Poll Times (required) — Set one or more polling intervals, such as every minute, hour, day, week, month, every X minutes or hours, or a custom cron expression.
  • Service Account Email (required) — Service account client email used to sign the Gmail access request.
  • Private Key (required) — Service account RSA private key in PEM format.
  • Delegated Email (required) — Gmail mailbox to access through domain-wide delegation.
  • Simplify — Defaults to true. When enabled, parses the raw message into fields such as from, to, subject, text, HTML, date, and attachments. When disabled, returns the Gmail API message response.
  • Options — Download Attachments defaults to false. When enabled with Simplify on, attachments with content are added as binary properties, named using the Attachment Prefix (default attachment_).
  • Max Emails per Poll — Maximum messages to fetch per poll, default 10 and configurable from 1 to 50. Excess messages are carried over to subsequent polls; manual runs fetch at most one.
  • Mark as Read — Defaults to false. When enabled, removes the UNREAD label from each processed message; errors from this update are ignored.
  • Filters — Filter by spam/trash inclusion, drafts, comma-separated label names or IDs, Gmail search query, read status, and sender. Defaults exclude spam and trash and select unread messages. Drafts are excluded unless enabled; sent messages outside the inbox are always skipped.

Output shape

A list of email items, each containing a JSON message; with simplified output and attachment downloading enabled, an item can also contain binary attachment properties.

Returns no items when there are no fetched messages to emit. Polling uses stored timestamps, pending message IDs, and duplicate tracking; scheduled polls search after the last checked time. Scheduled polling errors are logged and swallowed, while manual poll errors are thrown. Messages skipped as drafts or sent outside the inbox are fetched and affect poll tracking but are not emitted.

Links

Discussion