Gmail
Send and manage Gmail messages, drafts, threads, and labels from inside an agent workflow.
Gmail actions let an agent work with a mailbox directly in a flow. An agent can send and reply to messages, manage drafts and threads, apply and remove labels, and pass the results to later steps.
Supported actions
| Group | Actions |
|---|---|
| Message | Send, Reply, Get, Get All, Delete, Mark As Read, Mark As Unread, Add Labels, Remove Labels |
| Draft | Create, Get, Get All, Delete |
| Thread | Reply, Get, Get All, Delete, Trash, Untrash, Add Labels, Remove Labels |
| Label | Create, Get, Get All, Delete |
Prerequisites
How to use these actions
- Map text inputs from earlier steps. Inputs such as To, Subject, and Body accept a value mapped from a previous step. Max Results and the Is HTML and Include Spam Trash toggles take fixed values.
- Recipient fields accept multiple addresses. To, Cc, and Bcc accept multiple comma separated addresses.
- List actions use Gmail search syntax. The Query input on the Get All actions uses Gmail search syntax such as
is:unreadorfrom:[email protected]. - Labels are comma separated. Label IDs is a comma separated list.
- Send HTML bodies. Set Is HTML on to send an HTML body.
Actions
Message
Gmail Message Send
Sends a new message.
| Input | Required | Description |
|---|---|---|
| To | Yes | Recipient addresses, comma separated for multiple recipients. |
| Subject | Yes | The subject line of the message. |
| Body | Yes | The body content of the message. |
| Cc | No | Carbon copy addresses, comma separated. |
| Bcc | No | Blind carbon copy addresses, comma separated. |
| Is HTML | No | Toggle. Set on to send the body as HTML. Defaults to off. |
Gmail Message Reply
Replies to an existing message.
| Input | Required | Description |
|---|---|---|
| Message ID | Yes | The message to reply to. |
| Body | Yes | The reply content. |
| Is HTML | No | Toggle. Set on to send the reply as HTML. |
Gmail Message Get
Retrieves a message by ID.
| Input | Required | Description |
|---|---|---|
| Message ID | Yes | The message to retrieve. |
Gmail Message Get All
Lists messages.
| Input | Required | Description |
|---|---|---|
| Max Results | No | Maximum number of messages to return, from 1 to 500. Defaults to 10. |
| Query | No | A Gmail search query, such as is:unread or from:[email protected]. |
| Label IDs | No | Comma separated list of labels to filter by. |
| Include Spam Trash | No | Toggle. Set on to include messages from spam and trash. Defaults to off. |
Gmail Message Delete
Deletes a message.
| Input | Required | Description |
|---|---|---|
| Message ID | Yes | The message to delete. |
Gmail Message Mark As Read
Marks a message as read.
| Input | Required | Description |
|---|---|---|
| Message ID | Yes | The message to mark as read. |
Gmail Message Mark As Unread
Marks a message as unread.
| Input | Required | Description |
|---|---|---|
| Message ID | Yes | The message to mark as unread. |
Gmail Message Add Labels
Adds labels to a message.
| Input | Required | Description |
|---|---|---|
| Message ID | Yes | The message to update. |
| Label IDs | Yes | Comma separated labels to add. |
Gmail Message Remove Labels
Removes labels from a message.
| Input | Required | Description |
|---|---|---|
| Message ID | Yes | The message to update. |
| Label IDs | Yes | Comma separated labels to remove. |
Draft
Gmail Draft Create
Creates a draft message.
| Input | Required | Description |
|---|---|---|
| To | Yes | Recipient addresses, comma separated for multiple recipients. |
| Subject | Yes | The subject line of the draft. |
| Body | Yes | The body content of the draft. |
| Cc | No | Carbon copy addresses, comma separated. |
| Bcc | No | Blind carbon copy addresses, comma separated. |
| Is HTML | No | Toggle. Set on to use an HTML body. Defaults to off. |
Gmail Draft Get
Retrieves a draft by ID.
| Input | Required | Description |
|---|---|---|
| Draft ID | Yes | The draft to retrieve. |
Gmail Draft Get All
Lists drafts.
| Input | Required | Description |
|---|---|---|
| Max Results | No | Maximum number of drafts to return, from 1 to 500. Defaults to 10. |
Gmail Draft Delete
Deletes a draft.
| Input | Required | Description |
|---|---|---|
| Draft ID | Yes | The draft to delete. |
Thread
Gmail Thread Reply
Replies to a thread.
| Input | Required | Description |
|---|---|---|
| Thread ID | Yes | The thread to reply to. |
| Body | Yes | The reply content. |
| Is HTML | No | Toggle. Set on to send the reply as HTML. |
Gmail Thread Get
Retrieves a thread by ID.
| Input | Required | Description |
|---|---|---|
| Thread ID | Yes | The thread to retrieve. |
Gmail Thread Get All
Lists threads.
| Input | Required | Description |
|---|---|---|
| Max Results | No | Maximum number of threads to return, from 1 to 500. Defaults to 10. |
| Query | No | A Gmail search query, such as is:unread or from:[email protected]. |
| Label IDs | No | Comma separated list of labels to filter by. |
| Include Spam Trash | No | Toggle. Set on to include threads from spam and trash. Defaults to off. |
Gmail Thread Delete
Deletes a thread.
| Input | Required | Description |
|---|---|---|
| Thread ID | Yes | The thread to delete. |
Gmail Thread Trash
Moves a thread to trash.
| Input | Required | Description |
|---|---|---|
| Thread ID | Yes | The thread to move to trash. |
Gmail Thread Untrash
Restores a thread from trash.
| Input | Required | Description |
|---|---|---|
| Thread ID | Yes | The thread to restore from trash. |
Gmail Thread Add Labels
Adds labels to a thread.
| Input | Required | Description |
|---|---|---|
| Thread ID | Yes | The thread to update. |
| Label IDs | Yes | Comma separated labels to add. |
Gmail Thread Remove Labels
Removes labels from a thread.
| Input | Required | Description |
|---|---|---|
| Thread ID | Yes | The thread to update. |
| Label IDs | Yes | Comma separated labels to remove. |
Label
Gmail Label Create
Creates a label.
| Input | Required | Description |
|---|---|---|
| Name | Yes | The name of the label. |
| Label List Visibility | No | Visibility of the label in the label list, one of labelShow, labelShowIfUnread, or labelHide. |
| Message List Visibility | No | Visibility of messages with the label in the message list, one of show or hide. |
Gmail Label Get
Retrieves a label by ID.
| Input | Required | Description |
|---|---|---|
| Label ID | Yes | The label to retrieve. |
Gmail Label Get All
Lists labels.
This action takes no inputs beyond the credential.
Gmail Label Delete
Deletes a label.
| Input | Required | Description |
|---|---|---|
| Label ID | Yes | The label to delete. |
Example
An agent that triages unread mail and replies on behalf of the user:
A Gmail Message Get All action sets Query to is:unread and Max Results to a fixed value so the flow reads only the latest unread messages.
A model step reads the message body and writes a response, then a Gmail Message Reply action maps Message ID to the message from the previous step and Body to the generated reply.
A Gmail Message Mark As Read action clears the unread flag, and a Gmail Message Add Labels action applies a follow up label by passing its ID into Label IDs.
Troubleshooting
For issues common to every vendor, see the Actions overview.