gmail-custom

Custom Gmail nodes for n8n — Send, Trigger, Get/Get Many (Message+Thread) — token caching, self-contained

Documentation

n8n-nodes-gmail-custom

Self-contained n8n nodes for Gmail API via Google service accounts with domain-wide delegation. No n8n credential setup — all parameters inline, supports expressions.

Nodes

Node Description
Gmail Custom Send emails via Gmail API
Gmail Trigger Custom Poll Gmail for new messages
Gmail Get Custom Get one or many Messages/Threads by ID or with filters

All three share the same token cache — only 1 oauth call per hour across all nodes.

Installation

In n8n: Settings → Community Nodes → Install → n8n-nodes-gmail-custom

Gmail Custom (Send)

Sends an email via Gmail API. Supports HTML/text body, CC, BCC, Reply-To, attachments (with graceful skip), and sender name.

Field Description
Service Account Email SA client_email (JWT iss)
Private Key RSA PEM key (hidden)
From Email User to impersonate via DWD (JWT sub)
To Recipient(s), comma-separated
Subject Email subject
Email Type HTML or Text
Message Email body

Options: CC, BCC, Reply-To, Sender Name, Attachments (binary data).

Output: { id, threadId, labelIds }.

Gmail Trigger Custom (Polling)

Polls Gmail inbox and returns new messages. Emails fetched in format: raw (single API call) and parsed via mailparser.

Field Description
Service Account Email SA client_email
Private Key RSA PEM key
Delegated Email Mailbox to monitor
Simplify true = parsed output, false = raw Gmail API response
Max Emails per Poll 1–50, excess queued for next poll
Mark as Read Optional: marks processed emails as read (+1 API call)

Filters: Include Spam/Trash, Include Drafts, Label IDs, Search query, Read Status, Sender.

Options: Download Attachments, Attachment Prefix (binary property name).

Output (simple: true): { id, threadId, labelIds, snippet, from, to, subject, date, messageId, html, text, attachments: [{filename, contentType, size}] }

Output (simple: false): Raw Gmail API response { id, threadId, labelIds, payload: { headers: [...] }, raw: "base64..." }

Gmail Get Custom (Message / Thread)

Retrieves one or many messages or threads by ID or with Gmail search filters.

Get (single)

Field Description
Service Account Email SA client_email
Private Key RSA PEM key
Delegated Email Mailbox to access
Resource Message or Thread
Message ID / Thread ID The Gmail ID to retrieve
Simplify true = parsed, false = raw

Options: Return Only Messages (Thread only), Download Attachments (Message only), Attachment Prefix.

Get Many

Field Description
Service Account Email SA client_email
Private Key RSA PEM key
Delegated Email Mailbox to access
Resource Message or Thread
Operation Get Many
Return All true = fetch all pages, false = limit
Limit Max results (1–500, default 50)
Simplify true = parsed output, false = raw

Filters:

Filter Description
Include Spam and Trash Include SPAM/TRASH in results
Label IDs Comma-separated Gmail label IDs
Search Gmail search syntax (e.g. has:attachment)
Read Status Unread only, Read only, or Both
Received After ISO date / timestamp
Received Before ISO date / timestamp
Sender Email or name to filter by

Get Message output (simple: true): { id, threadId, labelIds, snippet, from, to, subject, date, messageId, html, text, attachments }

Get Thread output (simple: true): { id, historyId, messages: [{ id, from, to, subject, ... }, ...] }

Token caching

Access token is cached in-memory for 58 minutes (3500s). Cache key: ${serviceAccountEmail}:${delegatedEmail}. Shared across all three nodes.

License

MIT

Discussion