---
title: Gmail
description: Integrate with Gmail to perform operations on messages and drafts.
---

Send email, read and search your Gmail messages, and manage drafts from a workflow.

Pick a saved connection in the **Credential** field, or create one from there. It signs in with an OAuth2.

## What it does

The Gmail node works on two kinds of things (**Resource**):

* **Message**: **Send** an email (with optional HTML body, CC, BCC and file attachments), **Get** one message, **Delete** a message, or **Search** your mailbox.
* **Draft**: **Create**, **Get**, **Update**, **Delete** or **List** drafts. Drafts are saved, not sent, so you can review them in Gmail first.

**Delete** moves a message to the Trash, where you can still restore it; it does not erase it for good. **Search** and **List** return complete messages or drafts, up to **Page Size** (100 by default). Once a credential is set, **Message ID** and **Draft ID** are lists loaded from your mailbox.

Temporary Google errors (too many requests, server errors) are retried automatically before the node fails.

## When to use it

* Email yourself a daily digest or a report built by earlier nodes.
* Send a file produced by the workflow, such as a CSV export or a screenshot, as an attachment.
* Have an AI node draft replies as Gmail drafts, then review and send them yourself.
* Read recent messages and pass them to [Summarization](/nodes/builtin/ai/aiagents/summarizationchainnode/).

## Inputs and settings

Call the Gmail API yourself with the HTTP Request node, and pick the same connection in its **Credential** field.

* **To**, **CC** and **BCC** take one address per entry, for example `{{ $input.email }}`. Every address is checked before sending.
* **Body** is plain text. If you also fill **HTML Body**, mail apps that show HTML use it, and the others fall back to **Body**.
* **Attachments** lists the file keys to attach from the incoming item, usually `data`. Files come from nodes such as [Convert to File](/nodes/builtin/datatransformation/converttofile/), [Http Request](/nodes/builtin/core/http-request/) or [Screenshot Page](/nodes/extension/screenshotpage/).
* **Search Query** is not applied yet: **Message → Search** currently returns your latest messages, up to **Page Size**. Filter them afterwards with [Filter](/nodes/builtin/flow/filter/), for example on the `From` header.

## Outputs

* **Message → Send** returns the new message's `id` and `threadId`.
* **Message → Get** returns the Gmail message: `id`, `threadId`, `labelIds`, `snippet` (a short preview of the text) and `payload`, which holds the headers (`Subject`, `From`, `Date`) and the body parts.
* **Search** returns a list of messages; use [Split Out](/nodes/builtin/datatransformation/splitout/) to handle them one per item.
* **Draft → List** returns `drafts`, a list of drafts, and `nextPageToken` when there are more.
* **Delete** returns `success`, `deleted` and the id of the message or draft.

## Dependencies and credentials

* **Credential** (connection, OAuth2): required. See [Create a connection](/app/connections/).

Gmail connects by signing in to your Google account (OAuth). You first create your own Google OAuth client once, with the Gmail API enabled: follow [Create your OAuth client](/app/connections/oauth-client/#google). Then create a Gmail credential, paste the **Client ID** and **Client Secret**, click **Check connection** and approve the Google window. AWFlow asks for permission to read, compose and send email, and to move messages to the Trash. The sign-in is kept and refreshed for you. See also [Create a credential](/app/connections/create/).

## Example workflow

1. A [Schedule](/nodes/builtin/trigger/schedule/) trigger runs every Monday at 8:00.
2. [Data Store](/nodes/builtin/core/datastore/) reads the list of prices you saved during the week.
3. [CSV](/nodes/builtin/datatransformation/csv/) and [Convert to File](/nodes/builtin/datatransformation/converttofile/) turn it into a file under the key `data`.
4. Gmail, **Message → Send**, **To** `you@example.com`, **Subject** `Weekly prices`, **Body** `Attached.`, **Attachments** `data`.

## Common issues

* **"Invalid email address: …".** One of **To**, **CC** or **BCC** is not a valid address. Check the value, or the expression that builds it.
* **"No $binary found on the incoming item for attachment key "data"".** The previous node did not produce a file under that key. Check the key name, or add a node that creates the file.
* **"Request had insufficient authentication scopes" or a 403 error.** The Gmail API is not enabled for your OAuth client, or the sign-in is missing a permission. Enable the API in Google Cloud, then click **Check connection** again on the credential.
* **The node starts failing with a sign-in error after a week.** Your Google OAuth client is still in testing mode, where Google ends sign-ins after 7 days. Click **Check connection** again, or publish the client.

## Related nodes

* [Microsoft 365](/nodes/builtin/integration/microsoft-graph/): email with Outlook instead.
* [Google Drive](/nodes/builtin/integration/google-drive/): get files to attach.
* [Basic LLM Chain](/nodes/builtin/ai/aiagents/basicllmchainnode/): write the email text.
* [Slack](/nodes/builtin/integration/slack/): send the alert to a chat channel instead.