Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Gmail

connector.gmail · connector.gmail_trigger · communication, email

Send, reply to, search and organize Gmail messages, threads, drafts and labels.

Vendor API documentation: https://developers.google.com/gmail/api/reference/rest

Authentication

MethodCredential kindAuth kindFieldsTest request
Google account (OAuth2)gmail/oauth2oauth2_auth_codeclient_id, client_secret (secret), scopesyes
Service account (Workspace)gmail/service_accountjwt_service_accountclient_email, private_key (secret), subject, scopesyes

Actions

Node type connector.gmail. Choose a resource and an operation; each operation has its own parameters.

Message

OperationIDEffectPaginatedCassette tests
Send an emailmessage.sendwrites4
Reply to an emailmessage.replywrites1
Get an emailmessage.getreads2
Get email attachmentsmessage.get_attachmentsreads1
Search emailsmessage.listreadsyes2
Add labels to an emailmessage.add_labelswrites1
Remove labels from an emailmessage.remove_labelswrites1
Mark as readmessage.mark_readwrites1
Mark as unreadmessage.mark_unreadwrites1
Move to trashmessage.trashwrites1
Restore from trashmessage.untrashwrites1
Delete permanentlymessage.deletewrites1

Send an email

Operation message.send.

NameTypeDefaultRequiredShown whenDescription
tostringyesComma-separated recipients.
subjectstring
email_typeoptions"html"Body format. One of html, text.
messagestringBody. Message body in the chosen format.
text_alternativestringemail_type = htmlPlain-text alternative. Optional plain-text version sent alongside the HTML.
ccstringComma-separated recipients.
bccstringComma-separated recipients.
fromstringA send-as alias configured in Gmail (default: the account address).
reply_tostringReply-To.
attachmentsstringComma-separated binary property names to attach (a list of names also works).
headersjsonExtra headers. Object of additional header names and values.
thread_idstringThread ID. Add the message to an existing thread (subject must match).

Reply to an email

Operation message.reply. Replies in the original thread with In-Reply-To and References set, to the Reply-To or From address (optionally everyone).

NameTypeDefaultRequiredShown whenDescription
message_idstringyesMessage ID.
email_typeoptions"html"Body format. One of html, text.
messagestringBody. Message body in the chosen format.
text_alternativestringemail_type = htmlPlain-text alternative. Optional plain-text version sent alongside the HTML.
reply_allbooleanfalseReply to all. Also copy the original To and Cc recipients (except yourself).
ccstringComma-separated recipients.
bccstringComma-separated recipients.
fromstringA send-as alias configured in Gmail (default: the account address).
attachmentsstringComma-separated binary property names to attach (a list of names also works).

Get an email

Operation message.get. Returns headers, plain-text and HTML bodies and the attachment list of a message.

NameTypeDefaultRequiredShown whenDescription
message_idstringyesMessage ID.
formatoptions"full"One of full, metadata, raw.

Get email attachments

Operation message.get_attachments. Returns one item per attachment with its content as standard base64 in data (use a convert-to-file step to turn it into binary data).

NameTypeDefaultRequiredShown whenDescription
message_idstringyesMessage ID.

Search emails

Operation message.list. Lists messages matching a Gmail search query and labels, newest first.

NameTypeDefaultRequiredShown whenDescription
querystringSearch. Gmail search syntax.
label_idsmulti_optionsLabels. Only messages that have all of these labels. Values from lookup labels.
include_spam_trashbooleanfalseInclude spam and trash.
formatoptions"metadata"One of metadata, full, minimal.
return_allbooleanfalse
limitnumber50return_all = false

Add labels to an email

Operation message.add_labels.

NameTypeDefaultRequiredShown whenDescription
message_idstringyesMessage ID.
label_idsmulti_optionsyesLabels. Values from lookup labels.

Remove labels from an email

Operation message.remove_labels.

NameTypeDefaultRequiredShown whenDescription
message_idstringyesMessage ID.
label_idsmulti_optionsyesLabels. Values from lookup labels.

Mark as read

Operation message.mark_read.

NameTypeDefaultRequiredShown whenDescription
message_idstringyesMessage ID.

Mark as unread

Operation message.mark_unread.

NameTypeDefaultRequiredShown whenDescription
message_idstringyesMessage ID.

Move to trash

Operation message.trash.

NameTypeDefaultRequiredShown whenDescription
message_idstringyesMessage ID.

Restore from trash

Operation message.untrash.

NameTypeDefaultRequiredShown whenDescription
message_idstringyesMessage ID.

Delete permanently

Operation message.delete. Deletes the message immediately, skipping the trash. Needs the https://mail.google.com/ scope.

NameTypeDefaultRequiredShown whenDescription
message_idstringyesMessage ID.

Thread

OperationIDEffectPaginatedCassette tests
Get a threadthread.getreads1
Search threadsthread.listreadsyes1
Add labels to a threadthread.add_labelswrites1
Remove labels from a threadthread.remove_labelswrites1
Move a thread to trashthread.trashwrites1
Restore a thread from trashthread.untrashwrites1
Delete a thread permanentlythread.deletewrites1

Get a thread

Operation thread.get. Returns one item per message in the thread, oldest first.

NameTypeDefaultRequiredShown whenDescription
threadstringyesThread ID.
formatoptions"full"One of full, metadata, raw.

Search threads

Operation thread.list.

NameTypeDefaultRequiredShown whenDescription
querystringSearch. Gmail search syntax.
label_idsmulti_optionsLabels. Only messages that have all of these labels. Values from lookup labels.
include_spam_trashbooleanfalseInclude spam and trash.
return_allbooleanfalse
limitnumber50return_all = false

Add labels to a thread

Operation thread.add_labels.

NameTypeDefaultRequiredShown whenDescription
threadstringyesThread ID.
label_idsmulti_optionsyesLabels. Values from lookup labels.

Remove labels from a thread

Operation thread.remove_labels.

NameTypeDefaultRequiredShown whenDescription
threadstringyesThread ID.
label_idsmulti_optionsyesLabels. Values from lookup labels.

Move a thread to trash

Operation thread.trash.

NameTypeDefaultRequiredShown whenDescription
threadstringyesThread ID.

Restore a thread from trash

Operation thread.untrash.

NameTypeDefaultRequiredShown whenDescription
threadstringyesThread ID.

Delete a thread permanently

Operation thread.delete. Needs the https://mail.google.com/ scope.

NameTypeDefaultRequiredShown whenDescription
threadstringyesThread ID.

Draft

OperationIDEffectPaginatedCassette tests
Create a draftdraft.createwrites1
Get a draftdraft.getreads1
List draftsdraft.listreadsyes1
Send a draftdraft.sendwrites1
Delete a draftdraft.deletewrites1

Create a draft

Operation draft.create.

NameTypeDefaultRequiredShown whenDescription
tostringComma-separated recipients.
subjectstring
email_typeoptions"html"Body format. One of html, text.
messagestringBody. Message body in the chosen format.
text_alternativestringemail_type = htmlPlain-text alternative. Optional plain-text version sent alongside the HTML.
ccstringComma-separated recipients.
bccstringComma-separated recipients.
fromstringA send-as alias configured in Gmail (default: the account address).
reply_tostringReply-To.
attachmentsstringComma-separated binary property names to attach (a list of names also works).
thread_idstringThread ID. Create the draft as a reply inside this thread.

Get a draft

Operation draft.get.

NameTypeDefaultRequiredShown whenDescription
draftstringyesDraft ID.
formatoptions"full"One of full, metadata.

List drafts

Operation draft.list.

NameTypeDefaultRequiredShown whenDescription
querystringSearch. Gmail search syntax.
include_spam_trashbooleanfalseInclude spam and trash.
return_allbooleanfalse
limitnumber50return_all = false

Send a draft

Operation draft.send.

NameTypeDefaultRequiredShown whenDescription
draftstringyesDraft ID.

Delete a draft

Operation draft.delete.

NameTypeDefaultRequiredShown whenDescription
draftstringyesDraft ID.

Label

OperationIDEffectPaginatedCassette tests
Create a labellabel.createwrites1
Get a labellabel.getreads1
List labelslabel.listreads2
Update a labellabel.updatewrites1
Delete a labellabel.deletewrites1

Create a label

Operation label.create.

NameTypeDefaultRequiredShown whenDescription
namestringyesUse slashes for nesting, e.g. Clients/Acme.
label_list_visibilityoptions"labelShow"Show in label list. One of labelShow, labelShowIfUnread, labelHide.
message_list_visibilityoptions"show"Show in message list. One of show, hide.
background_colorstringOne of the colors Gmail offers.
text_colorstring

Get a label

Operation label.get.

NameTypeDefaultRequiredShown whenDescription
labeloptionsyesValues from lookup labels.

List labels

Operation label.list.

This node has no parameters.

Update a label

Operation label.update.

NameTypeDefaultRequiredShown whenDescription
labeloptionsyesValues from lookup labels.
namestringNew name.
label_list_visibilityoptionsShow in label list. One of labelShow, labelShowIfUnread, labelHide.
message_list_visibilityoptionsShow in message list. One of show, hide.
background_colorstringOne of the colors Gmail offers.
text_colorstring

Delete a label

Operation label.delete. Removes the label from all messages and deletes it.

NameTypeDefaultRequiredShown whenDescription
labeloptionsyesValues from lookup labels.

Lookups

Lookups fill dropdowns and resource pickers in the editor from the vendor API.

LookupDepends onSearchDescription
labelsclient-side{{ ‘System label’ if item.type == ‘system’ else ‘Your label’ }}

Triggers

Node type connector.gmail_trigger.

TriggerIDKindDeduplication keySignatureWebhook registrationCassette tests
New emailmessage_receivedpoll{{ '' if item.id == '_cursor' else item.id }}0

Trigger: New email

Emits each message added to the mailbox since the previous poll (from the Gmail history, so nothing is missed between polls). Items carry the message, thread and label IDs; use Get an email to read the content.

NameTypeDefaultRequiredShown whenDescription
labeloptionsOnly with label. For example INBOX; leave empty to watch every new message. Values from lookup labels.
include_sentbooleanfalseInclude messages you send.
include_spam_trashbooleanfalseInclude spam and trash.

Import

Exported workflows that use these node types import to this node. Unverified ranges import with a parameter warning until parity fixtures confirm them; see Migrating.

Source typeVersion rangeStatusFixtures
n8n-nodes-base.gmail>=2 <3unverified
n8n-nodes-base.gmailTrigger>=1 <2unverified

Provenance

Written from the vendor’s documentation: