n8n-nodes-gmail-custom
v0.7.1
Published
Custom Gmail nodes for n8n — Send, Trigger, Get (Message+Thread) — token caching, self-contained
Maintainers
Readme
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 a single Message or Thread by ID |
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), sender name, and optional custom Message-ID.
| 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), Custom Message-ID (auto-generated <uuid@domain> if empty).
Output: { id, threadId, labelIds, messageId } (messageId only when Custom Message-ID enabled).
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 a single message or thread by ID.
| 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 Message output (simple: true): { id, threadId, labelIds, snippet, from, to, subject, date, messageId, html, text, attachments }
Get Message output (simple: false): Raw Gmail API response
Get Thread output (simple: true): { id, historyId, messages: [{ id, from, to, subject, ... }, ...] } — headers flattened per message
Token caching
Access token is cached in-memory for 58 minutes (3500s). Cache key: ${serviceAccountEmail}:${delegatedEmail}. Shared across all three nodes.
License
MIT
