n8n-nodes-gmail-custom 0.6.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +66 -53
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,66 +1,79 @@
1
1
  # n8n-nodes-gmail-custom
2
2
 
3
- Self-contained n8n node for sending emails via Gmail API with a Google service account and domain-wide delegation.
3
+ Self-contained n8n nodes for Gmail API via Google service accounts with domain-wide delegation. No n8n credential setup required — all parameters inline, supports expressions.
4
4
 
5
- No credential setup in n8n required — all parameters are inline, supports expressions.
5
+ ## Nodes
6
6
 
7
- ## Features
7
+ | Node | Description |
8
+ |---|---|
9
+ | **Gmail Custom** | Send emails via Gmail API |
10
+ | **Gmail Trigger Custom** | Poll Gmail for new messages on a schedule |
11
+ | **Gmail Get Custom** | Get a single Message or Thread by ID |
8
12
 
9
- - **Self-contained**: service account email + private key are node parameters (no n8n credential needed)
10
- - **Token caching**: access token reused for 58 minutes — only 1 oauth call per hour instead of per email
11
- - **Domain-wide delegation**: send as any user in your Workspace domain
12
- - **Sender name**: set a display name without extra API calls
13
- - **Optional custom Message-ID**: auto-generated `<uuid@domain>` or specify your own — included in output
14
- - **Attachments**: from binary data with graceful skip if missing
15
- - **HTML and plain text email support**
13
+ All three share the same token cache only 1 oauth call per hour across all nodes.
16
14
 
17
15
  ## Installation
18
16
 
19
17
  In n8n: **Settings → Community Nodes → Install** → `n8n-nodes-gmail-custom`
20
18
 
21
- ## Usage
22
-
23
- 1. Add a **Gmail Custom** node to your workflow
24
- 2. Fill in the required fields (supports expressions):
25
-
26
- | Field | Description | Example |
27
- |---|---|---|
28
- | Service Account Email | Your SA `client_email` | `sa-name@project.iam.gserviceaccount.com` |
29
- | Private Key | RSA private key (PEM, hidden) | Expression from a previous node |
30
- | From Email | The user to impersonate (DWD) | `sender@your-domain.com` |
31
- | To | Recipient(s), comma-separated | `recipient@example.com` |
32
- | Subject | Email subject | `Hello World` |
33
- | Email Type | `HTML` or `Text` | `HTML` |
34
- | Message | Email body | Your HTML or text |
35
-
36
- 3. Configure **Options** as needed:
37
- - **CC / BCC**: carbon copy recipients
38
- - **Reply To**: reply-to address
39
- - **Sender Name**: display name (e.g. `John Doe`)
40
- - **Attachments**: binary data field names from previous nodes
41
- - **Custom Message-ID**: enable and optionally specify a `Message-ID` header. Auto-generated as `<uuid@domain>` if left empty. Returned in the node output.
42
-
43
- ## Output
44
-
45
- ```json
46
- {
47
- "id": "19ef486e4ed521e6",
48
- "threadId": "19ef486e4ed521e6",
49
- "labelIds": ["SENT"],
50
- "messageId": "<generated-uuid@your-domain.com>"
51
- }
52
- ```
53
-
54
- `messageId` is only present when the Custom Message-ID option is enabled.
55
-
56
- ## How it works
57
-
58
- 1. Signs a JWT with the service account private key
59
- 2. Obtains an access token from `oauth2.googleapis.com/token` (cached)
60
- 3. Builds a MIME email message
61
- 4. Sends via `POST gmail.googleapis.com/gmail/v1/users/me/messages/send`
62
-
63
- Per email sent: **1 Gmail API call** (token is cached for 1 hour).
19
+ ## Gmail Custom (Send)
20
+
21
+ 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.
22
+
23
+ | Field | Description |
24
+ |---|---|
25
+ | Service Account Email | SA `client_email` (JWT `iss`) |
26
+ | Private Key | RSA PEM key (hidden) |
27
+ | From Email | User to impersonate via DWD (JWT `sub`) |
28
+ | To | Recipient(s), comma-separated |
29
+ | Subject | Email subject |
30
+ | Email Type | `HTML` or `Text` |
31
+ | Message | Email body |
32
+
33
+ Options: CC, BCC, Reply-To, Sender Name, Attachments (binary data), Custom Message-ID (auto-generated `<uuid@domain>` if empty).
34
+
35
+ Output: `{ id, threadId, labelIds, messageId }` (messageId only when Custom Message-ID enabled).
36
+
37
+ ## Gmail Trigger Custom (Polling)
38
+
39
+ Polls Gmail inbox on a schedule and returns new messages. State persists between polls via workflow static data.
40
+
41
+ | Field | Description |
42
+ |---|---|
43
+ | Service Account Email | SA `client_email` |
44
+ | Private Key | RSA PEM key |
45
+ | Delegated Email | Mailbox to monitor (impersonated user) |
46
+ | Simplify | `true` = metadata only, `false` = raw |
47
+ | Max Emails per Poll | 1-50, excess queued for next poll |
48
+ | Mark as Read | Optional: marks processed emails as read (+1 API call per email) |
49
+
50
+ Filters: Include Spam/Trash, Include Drafts, Label IDs, Search query, Read Status, Sender.
51
+
52
+ Output: `[{ json: { id, threadId, labelIds, payload, ... } }]` — flat headers when simplify is true.
53
+
54
+ ## Gmail Get Custom (Message / Thread)
55
+
56
+ Retrieves a single message or thread by ID.
57
+
58
+ | Field | Description |
59
+ |---|---|
60
+ | Service Account Email | SA `client_email` |
61
+ | Private Key | RSA PEM key |
62
+ | Delegated Email | Mailbox to access |
63
+ | Resource | `Message` or `Thread` |
64
+ | Message ID / Thread ID | The Gmail ID to retrieve |
65
+ | Simplify | `true` = metadata with flat headers, `false` = raw |
66
+ | Return Only Messages | (Thread only) Return message array without thread wrapper |
67
+
68
+ **Get Message output** (simple): `{ id, threadId, labelIds, snippet, From, To, Subject, Cc, Bcc, ... }`
69
+
70
+ **Get Thread output** (simple): `{ id, historyId, messages: [{ id, From, To, Subject, ... }, ...] }`
71
+
72
+ ## Token caching
73
+
74
+ Access token is cached in-memory for 58 minutes (3500 seconds). Cache key: `${serviceAccountEmail}:${delegatedEmail}`. All three nodes share the same cache.
75
+
76
+ Per-email API calls: **1 Gmail API call** after the first oauth call of the hour.
64
77
 
65
78
  ## License
66
79
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-gmail-custom",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "Custom Gmail nodes for n8n — Send, Trigger, Get (Message+Thread) — token caching, self-contained",
5
5
  "keywords": [
6
6
  "n8n-community-node-package",