节点 / builtin / integration
Gmail
Integrate with Gmail to perform operations on messages and drafts.
此内容尚不支持你的语言。
Send email, read and search your Gmail messages, and manage drafts from a workflow.
What it does
Section titled “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
Section titled “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.
Inputs and settings
Section titled “Inputs and settings”| 设置项 | 类型 | 作用 |
|---|---|---|
| Credential (必填) | Credential | The Credential to use to make request. |
9 个选项 · 选择“Resource and Operation”以查看其设置
Message · Send 的设置
| 设置项 | 类型 | 作用 |
|---|---|---|
| To (必填) | List | Email addresses to send to. |
| Subject (必填) | Text | Email subject. |
| Body (必填) | Long text | Email body (plain text). |
| HTML Body | Text | Email body (HTML). |
| CC | List | Carbon copy recipients. |
| BCC | List | Blind carbon copy recipients. |
| Attachments | List | Logical $binary keys on the incoming item to attach as email files. Each selected key is read from the item and added to the message; leave empty to send with no attachments. |
Message · Get 的设置
| 设置项 | 类型 | 作用 |
|---|---|---|
| Message ID (必填) | Choice (loaded from your account) | The Gmail message ID to work with. |
Message · Delete 的设置
| 设置项 | 类型 | 作用 |
|---|---|---|
| Message ID (必填) | Choice (loaded from your account) | The Gmail message ID to work with. |
Message · Search 的设置
| 设置项 | 类型 | 作用 |
|---|---|---|
| Search Query | Text | Gmail search query. |
| Page Size | Number | Number of results per page (1-100). 默认值:100 |
Draft · Create 的设置
| 设置项 | 类型 | 作用 |
|---|---|---|
| To (必填) | List | Email addresses to send to. |
| Subject (必填) | Text | Email subject. |
| Body | Long text | Email body (plain text). |
| HTML Body | Text | Email body (HTML). |
| CC | List | Carbon copy recipients. |
| BCC | List | Blind carbon copy recipients. |
Draft · Get 的设置
| 设置项 | 类型 | 作用 |
|---|---|---|
| Draft ID (必填) | Choice (loaded from your account) | The Gmail draft ID to work with. |
Draft · Update 的设置
| 设置项 | 类型 | 作用 |
|---|---|---|
| Draft ID (必填) | Choice (loaded from your account) | The Gmail draft ID to work with. |
| To (必填) | List | Email addresses to send to. |
| Subject (必填) | Text | Email subject. |
| Body | Long text | Email body (plain text). |
| HTML Body | Text | Email body (HTML). |
| CC | List | Carbon copy recipients. |
| BCC | List | Blind carbon copy recipients. |
Draft · Delete 的设置
| 设置项 | 类型 | 作用 |
|---|---|---|
| Draft ID (必填) | Choice (loaded from your account) | The Gmail draft ID to work with. |
Draft · List 的设置
| 设置项 | 类型 | 作用 |
|---|---|---|
| Page Size | Number | Number of results per page (1-100). 默认值:100 |
正在显示 Message · Send 的设置
- 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, Http Request or Screenshot Page. - Search Query is not applied yet: Message → Search currently returns your latest messages, up to Page Size. Filter them afterwards with Filter, for example on the
Fromheader.
Outputs
Section titled “Outputs”-
Output
- Message → Send returns the new message’s
idandthreadId. - Message → Get returns the Gmail message:
id,threadId,labelIds,snippet(a short preview of the text) andpayload, which holds the headers (Subject,From,Date) and the body parts. - Search returns a list of messages; use Split Out to handle them one per item.
- Draft → List returns
drafts, a list of drafts, andnextPageTokenwhen there are more. - Delete returns
success,deletedand the id of the message or draft.
Dependencies and credentials
Section titled “Dependencies and credentials”- Credential (connection, OAuth2): required. See Create a connection.
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. 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.
Example workflow
Section titled “Example workflow”- A Schedule trigger runs every Monday at 8:00.
- Data Store reads the list of prices you saved during the week.
- CSV and Convert to File turn it into a file under the key
data. - Gmail, Message → Send, To
you@example.com, SubjectWeekly prices, BodyAttached., Attachmentsdata.
Common issues
Section titled “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
Section titled “Related nodes”- Microsoft 365: email with Outlook instead.
- Google Drive: get files to attach.
- Basic LLM Chain: write the email text.
- Slack: send the alert to a chat channel instead.