Reference · Tools

Google Gmail

Send, receive, reply to emails, manage drafts, labels, and threads with full attachment support via the Gmail API.

Action (binary) Communication v1 Binary data

The Google Gmail node connects your BusyBot workflows to Gmail via the Gmail API, letting you send, receive, reply to, and organize email programmatically. You can do things like automatically forward incoming support emails with their attachments to a Slack channel, or draft and send weekly reports without touching your inbox. It covers messages, drafts, labels, and threads in one node.

Node type
Action (binary)
Parameters
44
Outputs
Output, Error
Credentials
Gmail OAuth2

Google Gmail

Send, receive, and manage Gmail messages with attachment support

Overview

Google Gmail tool provides complete email management: send messages with attachments, receive and download messages with attachments, reply to messages and threads with attachments, create and manage drafts with attachments, organize with labels, manage conversation threads. Supports OAuth2 authentication with automatic token refresh.

Category: Communication
Tool Name: google_gmail
Version: 1

Appearance: Icon: si-gmail | Color: #D44638

Node Type

Action (Binary) — handles file/binary data operations

Input / Output

DirectionPort(s)
InputInput
OutputOutput, Error

Credentials

This tool requires Gmail OAuth2 credentials. See the Credentials Guide for setup instructions.

The node also offers a service-account path: set Authentication to serviceAccount and fill in the Service Account Email and Private Key parameters instead of connecting an account.

Resources

ResourceValue
Messagemessage
Draftdraft
Labellabel
Threadthread

Operations

OperationValueDescription
SendsendSend a new email message (Message resource)
ReplyreplyReply to an existing message (Message resource)
GetgetGet a single message by ID (Message resource)
Get ManygetAllGet many messages with filtering (Message resource)
DeletedeletePermanently delete a message (Message resource)
Mark as ReadmarkAsReadMark a message as read (Message resource)
Mark as UnreadmarkAsUnreadMark a message as unread (Message resource)
Add LabelsaddLabelsAdd labels to a message (Message resource)
Remove LabelsremoveLabelsRemove labels from a message (Message resource)
CreatecreateCreate a new draft (Draft resource)
GetgetGet a draft by ID (Draft resource)
Get ManygetAllGet many drafts (Draft resource)
DeletedeleteDelete a draft (Draft resource)
CreatecreateCreate a new label (Label resource)
GetgetGet a label by ID (Label resource)
Get ManygetAllGet all labels (Label resource)
DeletedeleteDelete a label (Label resource)
GetgetGet a thread with all its messages (Thread resource)
Get ManygetAllGet many threads (Thread resource)
DeletedeletePermanently delete a thread (Thread resource)
ReplyreplyReply to a message in a thread (Thread resource)
TrashtrashMove a thread to trash (Thread resource)
UntrashuntrashRemove a thread from trash (Thread resource)
Add LabelsaddLabelsAdd labels to a thread (Thread resource)
Remove LabelsremoveLabelsRemove labels from a thread (Thread resource)

Parameters

Message: Send

ParameterTypeRequiredDefaultDescription
To (sendTo)stringYesComma-separated recipient email addresses. Supports expressions like {{ $json.email }}.
SubjectstringYesSubject line of the email. Supports expressions.
Email Type (emailType)optionsYeshtmlWhether the body is plain text or HTML.
Options: text, html
MessagestringYesEmail body content (text or HTML based on emailType). Supports expressions.
OptionscollectionNo{}Optional send settings. Add only the ones you need.
— Attachments (attachmentsUi)fixedCollectionNo{}Files to attach, taken from the item’s binary data. Add one entry per property.
— — Binary Property (property)stringNodataName of the binary property containing the attachment. Multiple properties can be separated by comma.
— CC (ccList)stringNoComma-separated CC email addresses.
— BCC (bccList)stringNoComma-separated BCC email addresses.
— Reply-To (replyTo)stringNoReply-To email address.
— Sender Name (senderName)stringNoDisplay name shown in recipient inboxes.

Message: Reply

ParameterTypeRequiredDefaultDescription
Message ID (messageId)stringYesThe Gmail message ID to operate on. Supports expressions.
Email Type (emailType)optionsYeshtmlWhether the body is plain text or HTML.
Options: text, html
MessagestringYesEmail body content (text or HTML based on emailType). Supports expressions.
OptionscollectionNo{}Optional reply settings. Add only the ones you need.
— Attachments (attachmentsUi)fixedCollectionNo{}Files to attach, taken from the item’s binary data. Add one entry per property.
— — Binary Property (property)stringNodataName of the binary property containing the attachment. Multiple properties can be separated by comma.
— CC (ccList)stringNoComma-separated CC email addresses.
— BCC (bccList)stringNoComma-separated BCC email addresses.
— Sender Name (senderName)stringNoDisplay name shown in recipient inboxes.
— Reply to Sender Only (replyToSenderOnly)booleanNofalseWhether to reply to sender only instead of all recipients.
— Reply to Recipients Only (replyToRecipientsOnly)booleanNofalseWhether to exclude the sender from the reply.

Message: Get

ParameterTypeRequiredDefaultDescription
Message ID (messageId)stringYesThe Gmail message ID to operate on. Supports expressions.
Simplify (simple)booleanNotrueWhether to return simplified metadata or full parsed content.
Download Attachments (downloadAttachments)booleanNofalseWhether to download email attachments as binary data. Only applies when Simplify is false. (shown when Simplify is false)
Attachment Prefix (attachmentPrefix)stringNoattachment_Prefix for binary property names for downloaded attachments. An index starting at 0 is appended. (shown when Simplify is false and Download Attachments is true)

Message: Get Many

ParameterTypeRequiredDefaultDescription
Return AllbooleanNofalseWhether to return all results or only up to a given limit.
LimitnumberNo50Max number of results to return. (shown when Return All is false)
Simplify (simple)booleanNotrueWhether to return simplified metadata or full parsed content.
FilterscollectionNo{}Narrow the message list. Add only the filters you need.
— Search Query (q)stringNoGmail search query syntax.
— Label IDs (labelIds)stringNoComma-separated label IDs to filter by.
— Include Spam and Trash (includeSpamTrash)booleanNofalseWhether spam and trash are searched too.
— Read Status (readStatus)optionsNounreadWhich messages to include by read state.
Options: both (Unread and Read), unread (Unread Only), read (Read Only)
— SenderstringNoFilter by sender email or name.
— Received After (receivedAfter)stringNoISO date string or Unix timestamp. Only return emails received after this time.
— Received Before (receivedBefore)stringNoISO date string or Unix timestamp. Only return emails received before this time.
Download Options (downloadOptions)collectionNo{}Attachment handling for the fetched messages. (shown when Simplify is false)
— Download Attachments (downloadAttachments)booleanNofalseWhether to download email attachments as binary data.
— Attachment Prefix (attachmentPrefix)stringNoattachment_Prefix for binary property names.

Message: Delete

ParameterTypeRequiredDefaultDescription
Message ID (messageId)stringYesThe Gmail message ID to operate on. Supports expressions.

Message: Mark as Read

ParameterTypeRequiredDefaultDescription
Message ID (messageId)stringYesThe Gmail message ID to operate on. Supports expressions.

Message: Mark as Unread

ParameterTypeRequiredDefaultDescription
Message ID (messageId)stringYesThe Gmail message ID to operate on. Supports expressions.

Message: Add Labels

ParameterTypeRequiredDefaultDescription
Message ID (messageId)stringYesThe Gmail message ID to operate on. Supports expressions.
Label IDs (labelIds)stringYesComma-separated label IDs to add or remove. You can find label IDs via the label:getAll operation.

Message: Remove Labels

ParameterTypeRequiredDefaultDescription
Message ID (messageId)stringYesThe Gmail message ID to operate on. Supports expressions.
Label IDs (labelIds)stringYesComma-separated label IDs to add or remove. You can find label IDs via the label:getAll operation.

Draft: Create

ParameterTypeRequiredDefaultDescription
SubjectstringYesSubject line of the draft. Supports expressions.
Email Type (emailType)optionsYestextWhether the body is plain text or HTML.
Options: text, html
MessagestringYesDraft body content. Supports expressions.
Draft Options (draftOptions)collectionNo{}Optional draft settings. Add only the ones you need.
— Attachments (attachmentsUi)fixedCollectionNo{}Files to attach, taken from the item’s binary data. Add one entry per property.
— — Binary Property (property)stringNoName of the binary property containing the attachment.
— To (sendTo)stringNoComma-separated recipient email addresses.
— CC (ccList)stringNoComma-separated CC email addresses.
— BCC (bccList)stringNoComma-separated BCC email addresses.
— Reply-To (replyTo)stringNoReply-To email address.
— From Alias (fromAlias)stringNoGmail alias email to send from.
— Thread ID (threadId)stringNoThread ID to associate the draft with.

Draft: Get

ParameterTypeRequiredDefaultDescription
Draft ID (draftId)stringYesThe Gmail draft ID. Supports expressions.
Draft Get Options (draftGetOptions)collectionNo{}Attachment handling for the fetched draft.
— Download Attachments (downloadAttachments)booleanNofalseWhether to download draft attachments as binary data.
— Attachment Prefix (attachmentPrefix)stringNoattachment_Prefix for binary property names.

Draft: Get Many

ParameterTypeRequiredDefaultDescription
Return AllbooleanNofalseWhether to return all results or only up to a given limit.
LimitnumberNo50Max number of results to return. (shown when Return All is false)
Draft List Options (draftListOptions)collectionNo{}Listing and attachment settings.
— Include Spam and Trash (includeSpamTrash)booleanNofalseWhether spam and trash are included.
— Download Attachments (downloadAttachments)booleanNofalseWhether to download draft attachments as binary data.
— Attachment Prefix (attachmentPrefix)stringNoattachment_Prefix for binary property names.

Draft: Delete

ParameterTypeRequiredDefaultDescription
Draft ID (draftId)stringYesThe Gmail draft ID. Supports expressions.

Label: Create

ParameterTypeRequiredDefaultDescription
Label Name (labelName)stringYesName of the label to create. Supports expressions.
Label Options (labelOptions)collectionNo{}Visibility settings for the new label.
— Label List Visibility (labelListVisibility)optionsNolabelShowWhether the label appears in the Gmail label list.
Options: labelHide (Hide), labelShow (Show), labelShowIfUnread (Show If Unread)
— Message List Visibility (messageListVisibility)optionsNoshowWhether the label appears on messages in the message list.
Options: hide, show

Label: Get

ParameterTypeRequiredDefaultDescription
Label ID (labelId)stringYesThe Gmail label ID. Supports expressions.

Label: Get Many

ParameterTypeRequiredDefaultDescription
Return AllbooleanNofalseWhether to return all results or only up to a given limit.
LimitnumberNo50Max number of results to return. (shown when Return All is false)

Label: Delete

ParameterTypeRequiredDefaultDescription
Label ID (labelId)stringYesThe Gmail label ID. Supports expressions.

Thread: Get

ParameterTypeRequiredDefaultDescription
Thread ID (threadId)stringYesThe Gmail thread ID. Supports expressions.
Simplify (simple)booleanNotrueWhether to return simplified metadata or full parsed content.
Thread Get Options (threadGetOptions)collectionNo{}How much of the thread to return.
— Return Only Messages (returnOnlyMessages)booleanNotrueWhether to return only thread messages instead of the full thread object.

Thread: Get Many

ParameterTypeRequiredDefaultDescription
Return AllbooleanNofalseWhether to return all results or only up to a given limit.
LimitnumberNo50Max number of results to return. (shown when Return All is false)
Thread Filters (threadFilters)collectionNo{}Narrow the thread list. Add only the filters you need.
— Search Query (q)stringNoGmail search query syntax.
— Label IDs (labelIds)stringNoComma-separated label IDs to filter by.
— Include Spam and Trash (includeSpamTrash)booleanNofalseWhether spam and trash are searched too.
— Read Status (readStatus)optionsNounreadWhich threads to include by read state.
Options: both (Unread and Read), unread (Unread Only), read (Read Only)
— Received After (receivedAfter)stringNoISO date string or Unix timestamp.
— Received Before (receivedBefore)stringNoISO date string or Unix timestamp.

Thread: Reply

ParameterTypeRequiredDefaultDescription
Thread ID (threadId)stringYesThe Gmail thread ID. Supports expressions.
Message ID (threadMessageId)stringYesThe specific message in the thread to reply to. Supports expressions.
Email Type (emailType)optionsYestextWhether the body is plain text or HTML.
Options: text, html
MessagestringYesReply body content. Supports expressions.
Thread Reply Options (threadReplyOptions)collectionNo{}Optional reply settings. Add only the ones you need.
— Attachments (attachmentsUi)fixedCollectionNo{}Files to attach, taken from the item’s binary data. Add one entry per property.
— — Binary Property (property)stringNoName of the binary property containing the attachment.
— CC (ccList)stringNoComma-separated CC email addresses.
— BCC (bccList)stringNoComma-separated BCC email addresses.
— Sender Name (senderName)stringNoDisplay name shown in recipient inboxes.
— Reply to Sender Only (replyToSenderOnly)booleanNofalseWhether to reply to sender only instead of all recipients.
— Reply to Recipients Only (replyToRecipientsOnly)booleanNofalseWhether to exclude the sender from the reply.

Thread: Delete

ParameterTypeRequiredDefaultDescription
Thread ID (threadId)stringYesThe Gmail thread ID. Supports expressions.

Thread: Trash

ParameterTypeRequiredDefaultDescription
Thread ID (threadId)stringYesThe Gmail thread ID. Supports expressions.

Thread: Untrash

ParameterTypeRequiredDefaultDescription
Thread ID (threadId)stringYesThe Gmail thread ID. Supports expressions.

Thread: Add Labels

ParameterTypeRequiredDefaultDescription
Thread ID (threadId)stringYesThe Gmail thread ID. Supports expressions.
Label IDs (threadLabelIds)stringYesComma-separated label IDs.

Thread: Remove Labels

ParameterTypeRequiredDefaultDescription
Thread ID (threadId)stringYesThe Gmail thread ID. Supports expressions.
Label IDs (threadLabelIds)stringYesComma-separated label IDs.

All Operations

ParameterTypeRequiredDefaultDescription
AuthenticationoptionsNooAuth2Authentication method to use.
Options: oAuth2, serviceAccount
Google Account (credentialId)credentialNoConnect or select your Google account. (shown when Authentication is oAuth2)
Service Account Email (serviceAccountEmail)stringYesThe email address of the Google service account. (shown when Authentication is serviceAccount)
Private Key (serviceAccountPrivateKey)stringYesThe private key from the service account JSON key file. (shown when Authentication is serviceAccount)
Max ConcurrencynumberNo5Maximum number of items to process concurrently. Lower values help avoid Gmail API rate limits.

Output Data

The Gmail response is merged into the incoming item JSON at the top level, so the fields you sent in pass through. Binary data from the input item is forwarded, and downloaded attachments are merged into it.

OperationOutput items
message / send, reply, markAsRead, markAsUnread, addLabels, removeLabelsOne item — Gmail’s response for the message, including its id and threadId.
message / getOne item. With Simplify on, a flattened record: id, threadId, snippet, sizeEstimate, historyId, labelIds, plus every RFC header (From, To, Subject, Date, …) as a top-level field. With Simplify off, the fully parsed message, and — when Download Attachments is on — each attachment as a binary property named with the Attachment Prefix plus an index starting at 0.
message / getAllFans out — one output item per message, each shaped by Simplify exactly as for Get. Attachments are downloaded per message when Download Options turns them on.
message / deleteOne item carrying success: true and deletedMessageId.
draft / createOne item — the created draft. id is the draft ID and messageId is the underlying message.
draft / getOne item — the draft, with attachments as binary properties when Download Attachments is on.
draft / getAllFans out — one output item per draft.
draft / deleteOne item carrying success: true and deletedDraftId.
label / create, getOne item — the label record.
label / getAllFans out — one output item per label. Use this to find the label IDs the Add Labels / Remove Labels operations need.
label / deleteOne item carrying success: true and deletedLabelId.
thread / getWith Return Only Messages on (the default), fans out one item per message in the thread; with it off, one item for the whole thread object.
thread / getAllFans out — one output item per thread.
thread / reply, trash, untrash, addLabels, removeLabelsOne item — Gmail’s response for the thread.
thread / deleteOne item carrying success: true and deletedThreadId.

Usage Examples

  • Send an email with a PDF attachment
  • Download all unread emails with attachments
  • Reply to a message in a thread
  • Create a draft email with CC and BCC
  • Search for emails from a specific sender
  • Add labels to organize emails
  • Get all messages in a thread

Example Configuration

Send an HTML email with an attachment, CC and BCC:

{
  "type": "google_gmail",
  "parameters": {
    "resource": "message",
    "operation": "send",
    "sendTo": "recipient@example.com",
    "subject": "HTML Email with Attachments",
    "emailType": "html",
    "message": "<h1>Hello</h1><p>This is an HTML email.</p>",
    "options": {
      "ccList": "cc@example.com,cc2@example.com",
      "bccList": "bcc@example.com",
      "senderName": "John Doe",
      "replyTo": "noreply@example.com",
      "attachmentsUi": {
        "attachmentsBinary": [
          { "property": "data" }
        ]
      }
    }
  }
}

Reply to the sender only:

{
  "type": "google_gmail",
  "parameters": {
    "resource": "message",
    "operation": "reply",
    "messageId": "{{ $json.id }}",
    "emailType": "text",
    "message": "Thank you for your email.",
    "options": {
      "replyToSenderOnly": true
    }
  }
}

Search for messages:

{
  "type": "google_gmail",
  "parameters": {
    "resource": "message",
    "operation": "getAll",
    "returnAll": false,
    "limit": 50,
    "simple": true,
    "filters": {
      "q": "is:unread",
      "sender": "important@example.com",
      "receivedAfter": "2024-01-01",
      "includeSpamTrash": false
    }
  }
}

Fetch a full message and download its attachments:

{
  "type": "google_gmail",
  "parameters": {
    "resource": "message",
    "operation": "get",
    "messageId": "abc123def456",
    "simple": false,
    "downloadAttachments": true,
    "attachmentPrefix": "attachment_"
  }
}

Create a draft:

{
  "type": "google_gmail",
  "parameters": {
    "resource": "draft",
    "operation": "create",
    "subject": "Draft Email",
    "emailType": "html",
    "message": "<p>This is a draft email.</p>",
    "draftOptions": {
      "sendTo": "recipient@example.com",
      "ccList": "cc@example.com",
      "replyTo": "reply@example.com"
    }
  }
}

Add labels to a message:

{
  "type": "google_gmail",
  "parameters": {
    "resource": "message",
    "operation": "addLabels",
    "messageId": "abc123def456",
    "labelIds": "Label_1,Label_2"
  }
}

Create a label:

{
  "type": "google_gmail",
  "parameters": {
    "resource": "label",
    "operation": "create",
    "labelName": "Important Projects",
    "labelOptions": {
      "labelListVisibility": "labelShow",
      "messageListVisibility": "show"
    }
  }
}

Reply inside a thread:

{
  "type": "google_gmail",
  "parameters": {
    "resource": "thread",
    "operation": "reply",
    "threadId": "thread123",
    "threadMessageId": "msg456",
    "emailType": "text",
    "message": "Thanks for the thread discussion.",
    "threadReplyOptions": {
      "replyToRecipientsOnly": false,
      "ccList": "team@example.com"
    }
  }
}

Get a thread as individual messages:

{
  "type": "google_gmail",
  "parameters": {
    "resource": "thread",
    "operation": "get",
    "threadId": "thread123",
    "simple": false,
    "threadGetOptions": {
      "returnOnlyMessages": true
    }
  }
}

Error Handling

ModeBehavior
stopHalts workflow on first error
continueSkips failed items, passes successful ones through
errorPortRoutes failed items to Error output port

Tips

Full Gmail integration for sending, receiving, replying to emails, managing drafts/labels/threads with attachment support via Google API.

Parameter Dependencies

Key relationships to remember:

  • downloadAttachments requires simple: false
  • attachmentPrefix requires downloadAttachments: true
  • limit requires returnAll: false
  • Collection parameters like options, filters use flat object structure
  • Each resource type has different available operations
  • Reply operations can target either messages or threads

Notes

  • Attachments come from binary properties, not file paths. Put a download or read node upstream, then name its binary property in the Attachments entry. One entry can name several properties separated by commas.
  • Simplify hides the body. The simplified shape carries headers and a snippet only; turn it off when you need the full text or the attachments.
  • Label IDs, not label names. Add Labels and Remove Labels take Gmail’s internal IDs — run Label: Get Many first and read them from its output.
  • Keep Max Concurrency low. Gmail rate-limits aggressively, and a message list with attachment downloads makes one API call per message.

Frequently asked questions

How do I send an email with an attachment?

Attachments are read from binary properties in your workflow, not from file paths you type in. Place a file-download or file-read node before the Gmail node, then reference that node's binary property name in the Attachments field. You can reference multiple binary properties in one entry by separating them with commas.

I enabled 'Download Attachments' but nothing is downloading — what am I missing?

Downloading attachments requires two settings to be active together: 'Download Attachments' must be on, and 'Simplify' must be turned off (set to false). The simplified output only includes headers and a snippet, so attachments are suppressed. Once you disable Simplify, the full message body and any attachment data will be available.

Why does 'Add Labels' fail even though I typed the label name correctly?

The Add Labels and Remove Labels operations expect Gmail's internal label IDs, not the human-readable names you see in the Gmail interface. To get the correct IDs, run a Label: Get Many operation first and read the ID values from its output, then pass those into the label operation.

What credentials does this node require, and do I need to renew them manually?

The node uses Gmail OAuth2 credentials (credential type: gmailOAuth2). OAuth2 tokens refresh automatically, so you connect your Google account once through BusyBot's credential setup and the node handles token renewal without manual intervention.

My workflow is hitting Gmail rate limits when processing a list of messages. How should I handle this?

Gmail enforces aggressive API rate limits, and fetching a message list with attachment downloads compounds the problem because each message triggers an additional API call. Keep the Max Concurrency setting low on any Gmail node that processes lists, and if you don't need all results, disable 'Return All' and set a specific limit instead.

Build with the Google Gmail node

Drop it into a workflow, wire it to an agent, or call it on a schedule. You'll need Gmail OAuth2 credentials first.

Open BusyBot

Last updated . Spotted something wrong? Tell us.