Resources · n8n integration

Gmail n8n integrationAutomate Gmail with n8n.

Every new email can start a workflow. The Gmail n8n integration exposes 26 operations across 4 resources: messages, labels, drafts and threads. The Gmail Trigger listens to a single event, Message Received, and checks the mailbox at the interval you set. For anyone wiring an inbox into n8n.

Verified Trustpilot reviews · AI, automation & growth agency

Why automate

What can the Gmail n8n integration actually do?

The Gmail n8n integration links a Gmail mailbox to n8n through two nodes. The Gmail node runs 26 operations on four resources: Message, Label, Draft and Thread. The Gmail Trigger starts a workflow when a new message shows up, which is the event n8n listens for. Both nodes share the same Google credential, created once in the Credentials menu and reused in every workflow. Nothing to install: the nodes ship with n8n, on n8n Cloud and on a self-hosted instance alike.

Sorting an inbox without opening it is where most teams start. The Gmail Trigger fires on messageReceived, a Search filter keeps only the mail worth acting on, then message.addLabels files the message and message.markAsRead takes it out of the unread pile. A short branch pushes the summary to Slack, so nobody reopens Gmail just to check what arrived.

Answering is the second job, and it splits in two. draft.create writes the reply into the Drafts folder and stops there, which leaves a person in charge of the send button. Once the workflow has earned some trust, message.reply posts the answer straight into the existing conversation, and message.sendAndWait holds the execution until someone approves from inside the email itself.

Reporting closes the loop. message.getAll with Return All turned on, plus a Received After date, pulls a whole period out of the mailbox and hands it to Google Sheets for counting. A digest of what came in overnight can land on Telegram instead, for people who never open a spreadsheet.

The node stays inside those four resources. Anything the Gmail API offers beyond them belongs to the HTTP Request node, which calls any endpoint and reuses the same Google credential through predefined authentication. Better to reach for it early than to bend a Gmail operation into something it does not do.

Two limits shape every design. The trigger polls, so a message reaches the workflow after a delay equal to the poll interval, and the node fetches 10 emails per poll by default, 50 at most, queueing the rest for the next cycle. The Delete operation on a message is permanent and cannot be undone, which is why the Thread resource keeps a Trash operation for anything recoverable. If the platform choice is still open, the n8n review lays out the criteria, and the n8n training walks through building these flows end to end.

Connect

How do you connect Gmail to n8n?

  1. 01

    Create the Google credential in n8n

    Open the Credentials menu and create a Google credential for Gmail. On n8n Cloud, Managed OAuth2 does the work: click Sign in with Google on the credential screen and nothing else needs configuring in the Google Cloud Console. Self-hosted instances do not get Managed OAuth2, so the dropdown on that same screen switches the authentication type to Custom OAuth2, which needs a Client ID and a Client Secret from Google.

  2. 02

    Build the OAuth client in Google Cloud

    Create a Google Cloud project, then enable the Gmail API under APIs & Services > Library. Configure the OAuth consent screen with an App name, a User support email and an Audience: Internal for your Workspace, External for any Google account. Under Branding, add the authorized domain, n8n.cloud on n8n Cloud or your instance domain when self-hosting. Then create an OAuth client ID, type Web application.

  3. 03

    Paste the redirect URL, then the keys

    Copy the OAuth Redirect URL shown in the n8n credential and paste it into Authorized redirect URIs in Google. A local instance works too: Google accepts localhost, so a URL like http://localhost:5678/rest/oauth2-credential/callback is valid without a public domain or an SSL certificate. Create the client, then copy the Client ID and Client Secret back into n8n to finish the credential.

Triggers

What starts a Gmail workflow?

Gmail Trigger is the node that starts a workflow when something happens in Gmail. It listens to 1 events, listed below by family. Pick one or several, activate the workflow: n8n registers the webhook on your Gmail account.

What you see in n8n

Every event, by family

One row per object, one chip per action. The event to tick in the node is object.action; hover a chip to read exactly when it fires.

message.*1

    Configuration notes

    01Gmail TriggerThe Gmail Trigger starts a workflow from the mailbox itself, with nothing to register on the Google side. It queries the Gmail API at the interval you set and emits one item per new message found.

    The Gmail Trigger starts a workflow from the mailbox itself, with nothing to register on the Google side. It queries the Gmail API at the interval you set and emits one item per new message found.

    Key parameters

    • Poll Times: the Mode decides how often the check runs, once a minute at the fastest. The delay before a message reaches the workflow equals that interval, so pick it against how urgent the mail really is.
    • Simplify: on by default, it returns message IDs, labels and the From, To, CC, BCC and Subject headers. Turn it off for the raw data.
    • Max Emails per Poll: 10 by default, 50 at the top. Anything above the limit waits in the queue and comes through on the next poll cycle.
    When to use it
    whenever the mailbox is the starting point rather than a step in the middle of a flow.
    02Message ReceivedMessage Received is the one event the trigger exposes, and every Gmail workflow starts there. The filters decide which messages wake the workflow, and they matter more than the event itself.

    Message Received is the one event the trigger exposes, and every Gmail workflow starts there. The filters decide which messages wake the workflow, and they matter more than the event itself.

    Key parameters

    • Search: the syntax of the Gmail search box, from: for instance, so the run only starts for a subset of the mailbox.
    • Label Names or IDs: only messages carrying the selected labels. The dropdown fills from the credential, or an expression passes the IDs.
    • Read Status: Unread emails only by default, Read emails only, or both.
    • Sender: an address, or part of a sender name.
    • Include Spam and Trash and Include Drafts: left off, the workflow sees delivered mail and nothing else.
    Use cases
    catching supplier invoices that always come from the same address, and ignoring the rest of the inbox.
    Actions

    What the Gmail node does, operation by operation

    The Gmail node exposes 26 operations across 4 resources. For each one: the node as you configure it in n8n, the required fields, and our field notes.

    Resources × operations matrix
    ResourceCreateGetGet ManyDeleteAdd LabelMark as ReadMark as UnreadRemove LabelReplySendSend and Wait for ResponseTrashUntrash
    Message✓✓✓✓✓✓✓✓✓✓
    Label✓✓✓✓
    Draft✓✓✓✓
    Thread✓✓✓✓✓✓✓✓

    Message

    10 operations
    01

    Add label to message

    message.addLabels

    What you see in n8n

    Notes & use cases

    Puts one or more existing labels on a single message, which is the filing a human would have done by dragging it.

    Key parameters

    • Message ID: the Gmail identifier of the message, in the shape of 172ce2c4a72cc243, usually carried over from the previous node with an expression, the {{ $json.id }} syntax that picks a field off the incoming item.
    • Label Names or IDs: pick the labels in the dropdown, which loads from the credential, or specify their IDs with an expression.
    Use cases
    tagging every incoming invoice so the monthly export finds them without a search.
    02

    Delete a message

    message.delete

    What you see in n8n

    Notes & use cases

    Erases a message immediately and permanently. Gmail does not move it to the trash, and no later operation brings it back.

    Key parameters

    • Message ID: the identifier of the message to remove. Run a Get with that ID first if there is any doubt it exists, because a wrong one ends the execution on Bad request - please check your parameters.
    Use cases
    clearing machine notifications that nobody reads. For anything a person might want back, the Thread resource has a Trash operation instead.
    03

    Get a message

    message.get

    What you see in n8n

    Notes & use cases

    Reads a single message back into the workflow, with its headers and, on demand, its attachments.

    Key parameters

    • Message ID: the message to retrieve.
    • Simplify: on, the node returns message IDs, labels and the From, To, CC, BCC and Subject headers; off, the full raw payload.
    • Download Attachments: the files come back as binary properties, named from Attachment Prefix plus an index starting at 0, so attachment_ produces attachment_0.
    Use cases
    fetching the body of a message the trigger only announced, before a classification step reads it.
    04

    Get many messages

    message.getAll

    What you see in n8n

    Notes & use cases

    Lists messages and narrows them down before they enter the workflow, which makes it the reporting operation of the node.

    Key parameters

    • Return All: on, n8n walks every page of the API; off, Limit caps how many messages come back.
    • Search: the Gmail search box syntax, has:attachment for example.
    • Received After and Received Before: a date picker, or an expression holding an ISO string or a timestamp in milliseconds.
    • Read Status, Sender, Label Names or IDs: the same filters as the trigger, applied on demand.
    Use cases
    exporting last quarter of mail from one supplier into a spreadsheet.
    05

    Mark a message as read

    message.markAsRead

    What you see in n8n

    Notes & use cases

    Flips a message to read without anyone opening Gmail. It belongs at the end of a branch, as the signal that the workflow has done its part.

    Key parameters

    • Message ID: the message the workflow just handled.
    Use cases
    once a ticket exists for an email, marking it read keeps a trigger set to Unread emails only from picking the same message up again on the next poll.
    06

    Mark a message as unread

    message.markAsUnread

    What you see in n8n

    Notes & use cases

    Sends a message back to the unread pile, where a human will see it. The mirror image of the operation above, and it exists for the cases automation should not close.

    Key parameters

    • Message ID: the message to hand back to a person.
    Use cases
    a classification branch that comes back unsure returns the email to the inbox instead of guessing, and the team treats unread as the queue to look at.
    07

    Remove label from message

    message.removeLabels

    What you see in n8n

    Notes & use cases

    Takes labels off a message, which keeps a mailbox from filling up with tags that meant something two steps ago.

    Key parameters

    • Message ID: the message to clean up.
    • Label Names or IDs: the labels to take off, chosen in the dropdown or passed as IDs with an expression.
    Use cases
    dropping a to-process label the moment the workflow finishes, so the label only ever lists what is still waiting.
    08

    Reply to a message

    message.reply

    What you see in n8n

    Notes & use cases

    Answers inside the existing conversation, so the thread stays in one piece in the recipient's mailbox.

    Key parameters

    • Message ID: the message being answered.
    • Email Type: Text or HTML, and Message holds the body.
    • Reply to Sender Only: on, the answer goes to the sender; off, to the whole list of recipients.
    • Append n8n Attribution: on by default, it adds the sentence about the email being sent automatically with n8n. Turn it off for customer-facing mail.
    Use cases
    acknowledging a support request the minute it arrives, in the thread the customer already has open.
    09

    Send a message

    message.send

    What you see in n8n

    Notes & use cases

    Starts a new email from the connected mailbox, outside any existing thread.

    Key parameters

    • To: one address, or several separated by commas.
    • Subject, Message and Email Type: the header line, the body, and Text or HTML.
    • Sender Name: the name recipients see in their inbox, which rarely matches the mailbox address.
    • CC, BCC, Send Replies To and Attachments: the usual extras, plus files taken from a field of the incoming item.
    Use cases
    the nightly recap of failed orders, sent from the shared mailbox rather than someone's personal one.
    10

    Send message and wait for response

    message.sendAndWait

    What you see in n8n

    Notes & use cases

    Sends an email, then pauses the execution until the recipient answers. This is how a human decision gets into an otherwise automatic run.

    Key parameters

    • Response Type: Approval, where the reader answers from the message; Free Text, for an open reply through a form; Custom Form, for a form you design.
    • Type of Approval: Approve Only, or Approve and Disapprove for two buttons.
    • Limit Wait Time: caps how long the node waits before the execution resumes on its own.
    Use cases
    a refund above the usual ceiling that waits for a manager to approve before the rest of the workflow runs.

    Label

    4 operations
    11

    Create a label

    label.create

    What you see in n8n

    Notes & use cases

    Creates a label in the mailbox, the filing unit Gmail uses in place of folders.

    Key parameters

    • Name: the display name, something like invoices.
    • Label List Visibility: Show, Hide, or Show If Unread in the label list of the Gmail web interface.
    • Message List Visibility: Show or Hide messages carrying that label in the message list.
    Use cases
    one label per active client, created by the same workflow that creates the client record, so the mailbox structure never drifts from the CRM.
    12

    Delete a label

    label.delete

    What you see in n8n

    Notes & use cases

    Removes a label from the mailbox. Worth a second look before running it on a schedule.

    Key parameters

    • Label ID: the ID of the label, not the name shown in Gmail. A Get Many on labels gives the matching IDs, and an ID that does not exist ends the run on Bad request - please check your parameters.
    Use cases
    tidying up the temporary labels a campaign created, once the campaign is over and the mail has been archived.
    13

    Get a label info

    label.get

    What you see in n8n

    Notes & use cases

    Returns the detail of one label. Small operation, mostly used as a safety check.

    Key parameters

    • Label ID: the ID of the label to look up.
    Use cases
    confirming a label still exists before a branch tries to apply it, which turns a failed execution into a clean IF condition. Handy in workflows where someone might have deleted the label from the Gmail interface since the workflow was built.
    14

    Get many labels

    label.getAll

    What you see in n8n

    Notes & use cases

    Lists the labels of the mailbox with their IDs, which is the quickest way to find the values every other label operation expects.

    Key parameters

    • Return All: on, every label comes back; off, Limit sets the maximum number returned.
    Use cases
    building a name to ID lookup at the start of a workflow, so later nodes pass IDs through an expression instead of relying on the dropdown.

    Draft

    4 operations
    15

    Create a draft

    draft.create

    What you see in n8n

    Notes & use cases

    Writes an email into the Drafts folder and stops there. Nothing leaves the mailbox until a person clicks send. That makes it the safest way to automate a reply.

    Key parameters

    • Subject, Message and Email Type: the draft content, in Text or HTML.
    • To Email: optional, so a draft can wait without a recipient.
    • Thread ID: attaches the draft to an existing conversation, as in 18cc573e2431878f.
    • From Alias Name or ID: the alias the draft goes out from, chosen in the dropdown that loads from the credential, or set with an expression.
    Use cases
    a generated answer parked in Drafts for review before it reaches a customer.
    16

    Delete a draft

    draft.delete

    What you see in n8n

    Notes & use cases

    Throws away a draft the workflow no longer needs. Housekeeping, but it keeps the Drafts folder from becoming a graveyard.

    Key parameters

    • Draft ID: the identifier of the draft, which looks like r-3254521568507167962 and has nothing in common with a message ID.
    Use cases
    an order cancelled after the confirmation draft was prepared, where the workflow removes the draft instead of leaving a person to wonder whether to send it.
    17

    Get a draft

    draft.get

    What you see in n8n

    Notes & use cases

    Reads one draft back, attachments included when the workflow asks for them.

    Key parameters

    • Draft ID: the draft to retrieve.
    • Download Attachments: the files arrive as binary data, named from Attachment Prefix plus an index that starts at 0.
    Use cases
    reading what an earlier node wrote, so a validation branch can decide between sending the draft and deleting it, without a human opening Gmail at all.
    18

    Get many drafts

    draft.getAll

    What you see in n8n

    Notes & use cases

    Lists the drafts sitting in the mailbox, with the same paging logic as the message operations.

    Key parameters

    • Return All: on, every draft comes back; off, Limit stops the list.
    • Include Spam and Trash: on, drafts filed in Spam and Trash count too.
    • Download Attachments and Attachment Prefix: the same binary naming as the single Get.
    Use cases
    a weekly reminder that lists the drafts nobody has sent, so they stop ageing quietly in the mailbox.

    Thread

    8 operations
    19

    Add label to thread

    thread.addLabels

    What you see in n8n

    Notes & use cases

    Labels applied here cover the whole conversation, not just the message that arrived last.

    Key parameters

    • Thread ID: the Gmail identifier of the conversation, a string like 172ce2c4a72cc243, usually carried over as {{ $json.threadId }} from the previous node.
    • Label Names or IDs: pick them from the list n8n reads out of the connected account, or pass label IDs through an expression when an earlier step decides which one applies.
    Use cases
    a support workflow reads the latest reply, decides a human is needed, and tags the conversation so it shows up in the escalation view of the shared mailbox.
    20

    Delete a thread

    thread.delete

    What you see in n8n

    Notes & use cases

    Nothing survives this one: the thread and all its messages go immediately and permanently, and the action cannot be undone. When a way back matters, Trash does the same job without burning the bridge.

    Key parameters

    • Thread ID: the identifier of the conversation the node operates on, so a wrong value wipes the wrong exchange. Reading the thread first and passing its ID forward is the safe pattern.
    Use cases
    clearing the disposable mailbox a team uses to rehearse workflows, once the run has been checked.
    21

    Get a thread

    thread.get

    What you see in n8n

    Notes & use cases

    Fetching one conversation gives the workflow its messages in a single item, and Simplify decides how heavy that item gets.

    Key parameters

    • Thread ID: the identifier of the conversation to retrieve.
    • Simplify: on by default, it returns a simplified version instead of the raw data, so message IDs, labels and the headers From, To, CC, BCC and Subject. Turn it off for the raw response.
    • Return Only Messages: found under Options, it keeps only the messages of the thread in the output.
    Use cases
    pull the full exchange before an assistant drafts an answer, so the draft accounts for what was already said.
    22

    Get many threads

    thread.getAll

    What you see in n8n

    Notes & use cases

    When a workflow needs a batch of conversations rather than one, this operation lists them and sends one item per thread down the branch.

    Key parameters

    • Return All and Limit: with Return All on, n8n walks the pages of the Gmail API to the end; off, Limit caps how many threads come back.
    • Search: the same syntax as the Gmail search box, has:attachment for example, so a query tested by hand is reusable as is.
    • Read Status: unread threads only, read only, or both.
    • Received After and Received Before: inside an expression, a date in ISO format or a timestamp in milliseconds.
    Use cases
    a morning digest built from the unread conversations of the night.
    23

    Remove label from thread

    thread.removeLabels

    What you see in n8n

    Notes & use cases

    Tagging is only half the loop. This operation strips labels off a conversation once its state changes, which keeps a filtered Gmail view from filling up with threads nobody has to look at anymore.

    Key parameters

    • Thread ID: the conversation losing the label, taken from the trigger or from a listing step upstream.
    • Label Names or IDs: the labels to take off, chosen in the dropdown or given as IDs through an expression; several can go at once.
    Use cases
    an invoice thread tagged as waiting loses that label as soon as the accounting workflow sees the payment land.
    24

    Reply to a message

    thread.reply

    What you see in n8n

    Notes & use cases

    A reply sent from here stays inside the existing conversation instead of opening a new one, as recipients expect when the exchange already has a history.

    Key parameters

    • Thread ID: the conversation the answer belongs to.
    • Email Type: Text or HTML, depending on whether the body carries markup.
    • Message: the body itself, written in the expression editor when it mixes fixed wording and data from earlier nodes.
    • Reply to Sender Only: in Options, it answers the sender alone, while Reply to Recipients Only leaves the sender out; CC, BCC, Sender Name and Attachments sit in the same collection.
    Use cases
    an acknowledgment that answers a quote request in the thread the prospect opened.
    25

    Trash a thread

    thread.trash

    What you see in n8n

    Notes & use cases

    Trash moves the conversation and all its messages out of the inbox while keeping them recoverable, which makes it the operation to reach for when a sorting rule might be wrong.

    Key parameters

    • Thread ID: the conversation to move to the trash, fed by any step upstream that returns a thread.
    Use cases
    a triage workflow that clears tool notifications out of a shared mailbox every evening, leaving them recoverable if someone asks for one back.
    26

    Untrash a thread

    thread.untrash

    What you see in n8n

    Notes & use cases

    Sometimes the rule that trashed a conversation was too eager. This operation recovers the thread and all its messages from the trash and puts them back in the mailbox.

    Key parameters

    • Thread ID: the identifier of the conversation to recover, which is a good reason to store it somewhere when a workflow trashes threads on its own.
    Use cases
    a reviewer approves a restore request in a chat tool, and the workflow brings the conversation back where the team can read it.
    Need help

    Need help automating Gmail with n8n?

    A person reads every message.

    FAQ

    Gmail and n8n, the questions that come next

    01Is the Gmail integration free in n8n?
    Yes. The Gmail node and the Gmail Trigger ship with n8n, so there is nothing to install and nothing extra to pay on the n8n side, whether the instance runs on n8n Cloud or self-hosted under the Community Edition and its Sustainable Use licence. A workflow behaves the same way in both cases. The Google credential is created once in the Credentials menu and reused across every workflow that touches the mailbox, so a second or a tenth Gmail automation costs no additional setup. What a Google account itself costs is a separate question, outside what the node does.
    02What credentials does the Gmail node need?
    A Google credential, and two methods exist. OAuth2 is the recommended one: on n8n Cloud, Managed OAuth2 lets you click Sign in with Google with no setup in the Google Cloud Console. Self-hosted instances use Custom OAuth2 instead, which means a Google Cloud project, the Gmail API enabled under APIs and Services, an OAuth consent screen, and a Client ID and Client Secret pasted back into n8n. The Service Account method takes a Service Account Email and a Private Key from the downloaded JSON file, plus Impersonate a User turned on and domain-wide delegation that includes the Gmail API.
    03What are the limits of the Gmail n8n integration?
    The node covers 26 operations across four resources: Message, Label, Draft and Thread. Anything the Gmail API exposes beyond those has to go through the HTTP Request node, which reaches any endpoint and reuses the same Google credential through predefined authentication. Listing operations page by page depends on Return All, with Limit capping the result when it stays off. Deleting a message is permanent and cannot be undone, so the Thread Trash operation is the recoverable option. And a Message ID, Thread ID or Label ID that does not exist fails the execution on a bad request error.
    04How fast does the Gmail Trigger pick up a new email?
    It depends on the interval you set. The Gmail Trigger works by polling: n8n queries the Gmail API at the frequency chosen in Poll Times, once a minute at the fastest, and emits one item per new message found. Nothing has to be registered on the Google side: no webhook, so no public URL for Google to call on every message, which is why the setup is short. The trade-off is a delay equal to the poll interval. The node also fetches 10 emails per poll cycle by default, 50 at the most, and queues anything above that limit for the next cycle.
    05n8n or Make for Gmail automation?
    It depends on three things: hosting, data control and the cost model. n8n runs on its own Cloud offer or on your own server through Docker or npm, and the workflow is identical either way, so mailbox data can stay on infrastructure you own. Make is hosted only, with no self-hosting option, and it bills per operation, which changes how a high-volume mailbox loop is designed. Both build flows visually. For a Gmail workflow that polls a busy inbox and runs several operations per message, the cost model usually decides.