Gmail
Gmail is a widely used email service by Google, offering free and feature-rich communication, organization, and storage capabilities accessible through web browsers and mobile apps.
Categories: Communication
Type: googleMail/v1
Connections
Version: 1
OAuth2 Authorization Code
Properties
| Name | Label | Type | Description | Required |
|---|---|---|---|---|
| clientId | Client Id | STRING | true | |
| clientSecret | Client Secret | STRING | true |
Connection Setup
Create OAuth 2.0 Application
Creation of OAuth 2.0 application is documented here.
Enable Gmail API
- In the Google Cloud Console, select your project.
- Go to the APIs & Services.
- Click on ENABLE APIS AND SERVICES.
- Search for "gmail api" in the search bar.
- Click on Gmail API.
- Click Enable.
Actions
Add Labels
Name: addLabels
Add labels to an email in your Gmail account.
Properties
| Name | Label | Type | Description | Required |
|---|---|---|---|---|
| id | Message ID | STRING | ID of the message to add labels. | true |
| labelIds | Labels IDs | ARRAY Items[STRING] | ID of the labels to add to message. You can add up to 100 labels with each update. | true |
Example JSON Structure
{
"label" : "Add Labels",
"name" : "addLabels",
"parameters" : {
"id" : "",
"labelIds" : [ "" ]
},
"type" : "googleMail/v1/addLabels"
}Output
Type: OBJECT
Properties
| Name | Type | Description |
|---|---|---|
| id | STRING | The ID of the message. |
| threadId | STRING | The ID of the thread the message belongs to. |
| labelIds | ARRAY Items[STRING] | List of IDs of labels applied to this message. |
Output Example
{
"id" : "",
"threadId" : "",
"labelIds" : [ "" ]
}Find Message ID
To find the Message ID, click here.
Find Label ID
To find the Label ID, click here.
Archive Email
Name: archiveEmail
Archive an email message.
Properties
| Name | Label | Type | Description | Required |
|---|---|---|---|---|
| id | Message ID | STRING | ID of the message to be archived. | true |
Example JSON Structure
{
"label" : "Archive Email",
"name" : "archiveEmail",
"parameters" : {
"id" : ""
},
"type" : "googleMail/v1/archiveEmail"
}Output
Type: OBJECT
Properties
| Name | Type | Description |
|---|---|---|
| id | STRING | The ID of the message. |
| threadId | STRING | The ID of the thread the message belongs to. |
| labelIds | ARRAY Items[STRING] | List of IDs of labels applied to this message. |
Output Example
{
"id" : "",
"threadId" : "",
"labelIds" : [ "" ]
}Find Message ID
To find the Message ID, click here.
Create Label
Name: createLabel
Creates a new label.
Properties
| Name | Label | Type | Description | Required |
|---|---|---|---|---|
| name | Name | STRING | The display name of the newly created label. | true |
Example JSON Structure
{
"label" : "Create Label",
"name" : "createLabel",
"parameters" : {
"name" : ""
},
"type" : "googleMail/v1/createLabel"
}Output
Type: OBJECT
Properties
| Name | Type | Description |
|---|---|---|
| id | STRING | ID of the newly created label. |
| labelListVisibility | STRING | The visibility of the label in the label list in the Gmail web interface. |
| messageListVisibility | STRING | The visibility of messages with this label in the message list in the Gmail web interface. |
| name | STRING | The display name of the label. |
Output Example
{
"id" : "",
"labelListVisibility" : "",
"messageListVisibility" : "",
"name" : ""
}Delete Email
Name: deleteEmail
Deletes an email from your Gmail account immediately and permanently.
Properties
| Name | Label | Type | Description | Required |
|---|---|---|---|---|
| id | Message ID | STRING | The ID of the message to delete. | true |
Example JSON Structure
{
"label" : "Delete Email",
"name" : "deleteEmail",
"parameters" : {
"id" : ""
},
"type" : "googleMail/v1/deleteEmail"
}Output
This action does not produce any output.
Get Email
Name: getEmail
Gets the specified email message.
Properties
| Name | Label | Type | Description | Required |
|---|---|---|---|---|
| id | Message ID | STRING | The ID of the message to retrieve. | true |
| format | Format | STRING OptionsSIMPLE, MINIMAL, FULL, RAW, metadata | The format to return the message in. | false |
| metadataHeaders | Metadata headers | ARRAY Items[STRING] | When given and format is METADATA, only include headers specified. | false |
Example JSON Structure
{
"label" : "Get Email",
"name" : "getEmail",
"parameters" : {
"id" : "",
"format" : "",
"metadataHeaders" : [ "" ]
},
"type" : "googleMail/v1/getEmail"
}Output
The output for this action is dynamic and may vary depending on the input parameters. To determine the exact structure of the output, you need to execute the action.
Get Thread
Name: getThread
Gets the specified thread.
Properties
| Name | Label | Type | Description | Required |
|---|---|---|---|---|
| id | Thread ID | STRING | The ID of the thread to retrieve. | true |
| format | Format | STRING OptionsSIMPLE, MINIMAL, FULL, RAW, metadata | The format to return the message in. | false |
| metadataHeaders | Metadata headers | ARRAY Items[STRING] | When given and format is METADATA, only include headers specified. | false |
Example JSON Structure
{
"label" : "Get Thread",
"name" : "getThread",
"parameters" : {
"id" : "",
"format" : "",
"metadataHeaders" : [ "" ]
},
"type" : "googleMail/v1/getThread"
}Output
The output for this action is dynamic and may vary depending on the input parameters. To determine the exact structure of the output, you need to execute the action.
Find Message ID
To find the Thread ID, click here.
List Labels
Name: listLabels
Lists all labels in your mailbox.
Example JSON Structure
{
"label" : "List Labels",
"name" : "listLabels",
"type" : "googleMail/v1/listLabels"
}Output
Type: ARRAY
Items Type: OBJECT
Properties
| Name | Type | Description |
|---|---|---|
| name | STRING | The display name of the label. |
| id | STRING | ID of the label. |
| messageListVisibility | STRING | The visibility of messages with this label in the message list in the Gmail web interface. |
| labelListVisibility | STRING | The visibility of the label in the label list in the Gmail web interface. |
| type | STRING | The owner type for the label. |
Output Example
[ {
"name" : "",
"id" : "",
"messageListVisibility" : "",
"labelListVisibility" : "",
"type" : ""
} ]Remove Labels
Name: removeLabels
Removes labels on the specified message.
Properties
| Name | Label | Type | Description | Required |
|---|---|---|---|---|
| id | Message ID | STRING | ID of the message to remove labels. | true |
| labelIds | Labels IDs | ARRAY Items[STRING] | ID of the labels to remove from message. | true |
Example JSON Structure
{
"label" : "Remove Labels",
"name" : "removeLabels",
"parameters" : {
"id" : "",
"labelIds" : [ "" ]
},
"type" : "googleMail/v1/removeLabels"
}Output
Type: OBJECT
Properties
| Name | Type | Description |
|---|---|---|
| id | STRING | The ID of the message. |
| threadId | STRING | The ID of the thread the message belongs to. |
| labelIds | ARRAY Items[STRING] | List of IDs of labels applied to this message. |
Output Example
{
"id" : "",
"threadId" : "",
"labelIds" : [ "" ]
}Find Message ID
To find the Message ID, click here.
Find Label ID
To find the Label ID, click here.
Reply to Email
Name: replyToEmail
Send a reply to an email message.
Properties
| Name | Label | Type | Description | Required |
|---|---|---|---|---|
| id | Message ID | STRING | The ID of the message to reply to. | true |
| to | To | ARRAY Items[STRING] | Recipients email addresses. | true |
| bcc | Bcc | ARRAY Items[STRING] | Bcc recipients email addresses. | false |
| cc | Cc | ARRAY Items[STRING] | Cc recipients email addresses. | false |
| bodyType | Body Type | STRING Optionsplain, html | true | |
| body | Body - Text | STRING | The body of the message in text format. | true |
| body | Body - HTML | STRING | The body of the message in HTML format. | true |
| attachments | Attachments | ARRAY Items[FILE_ENTRY] | A list of attachments to send with the email. | false |
Example JSON Structure
{
"label" : "Reply to Email",
"name" : "replyToEmail",
"parameters" : {
"id" : "",
"to" : [ "" ],
"bcc" : [ "" ],
"cc" : [ "" ],
"bodyType" : "",
"body" : "",
"attachments" : [ {
"extension" : "",
"mimeType" : "",
"name" : "",
"url" : ""
} ]
},
"type" : "googleMail/v1/replyToEmail"
}Output
Type: OBJECT
Properties
| Name | Type | Description |
|---|---|---|
| id | STRING | The ID of the message. |
| threadId | STRING | The ID of the thread the message belongs to. |
| labelIds | ARRAY Items[STRING] | List of IDs of labels applied to this message. |
Output Example
{
"id" : "",
"threadId" : "",
"labelIds" : [ "" ]
}Find Message ID
To find the Message ID, click here.
Search Email
Name: searchEmail
Lists the email messages in the user's mailbox.
Properties
| Name | Label | Type | Description | Required |
|---|---|---|---|---|
| maxResults | Max Results | NUMBER | Maximum number of messages to return. | false |
| pageToken | Page Token | STRING | Page token to retrieve a specific page of results in the list. | false |
| from | From | STRING | The address sending the mail | false |
| to | To | STRING | The address receiving the new mail | false |
| subject | Subject | STRING | Words in the subject line | false |
| category | Category | STRING Optionsprimary, social, promotions, updates, forums, reservations, purchases | Messages in a certain category | false |
| labelIds | Labels | ARRAY Items[STRING] | Only return messages with labels that match all of the specified label IDs. Messages in a thread might have labels that other messages in the same thread don't have. | false |
| includeSpamTrash | Include Spam Trash | BOOLEAN Optionstrue, false | Include messages from SPAM and TRASH in the results. | false |
Example JSON Structure
{
"label" : "Search Email",
"name" : "searchEmail",
"parameters" : {
"maxResults" : 0.0,
"pageToken" : "",
"from" : "",
"to" : "",
"subject" : "",
"category" : "",
"labelIds" : [ "" ],
"includeSpamTrash" : false
},
"type" : "googleMail/v1/searchEmail"
}Output
Type: OBJECT
Properties
| Name | Type | Description |
|---|---|---|
| messages | ARRAY Items[{STRING(id), STRING(threadId)}] | |
| nextPageToken | STRING | |
| resultSizeEstimate | NUMBER | Estimated number of messages. |
Output Example
{
"messages" : [ {
"id" : "",
"threadId" : ""
} ],
"nextPageToken" : "",
"resultSizeEstimate" : 0.0
}Send Email
Name: sendEmail
Creates and sends a new email message from your Gmail account.
Properties
| Name | Label | Type | Description | Required |
|---|---|---|---|---|
| to | To | ARRAY Items[STRING] | Recipients email addresses. | true |
| subject | Subject | STRING | Subject of the email. | true |
| bcc | Bcc | ARRAY Items[STRING] | Bcc recipients email addresses. | false |
| cc | Cc | ARRAY Items[STRING] | Cc recipients email addresses. | false |
| replyTo | Reply To | ARRAY Items[STRING] | Reply-to email addresses. | false |
| bodyType | Body Type | STRING Optionsplain, html | true | |
| body | Body - Text | STRING | The body of the message in text format. | true |
| body | Body - HTML | STRING | The body of the message in HTML format. | true |
| attachments | Attachments | ARRAY Items[FILE_ENTRY] | A list of attachments to send with the email. | false |
Example JSON Structure
{
"label" : "Send Email",
"name" : "sendEmail",
"parameters" : {
"to" : [ "" ],
"subject" : "",
"bcc" : [ "" ],
"cc" : [ "" ],
"replyTo" : [ "" ],
"bodyType" : "",
"body" : "",
"attachments" : [ {
"extension" : "",
"mimeType" : "",
"name" : "",
"url" : ""
} ]
},
"type" : "googleMail/v1/sendEmail"
}Output
Type: OBJECT
Properties
| Name | Type | Description |
|---|---|---|
| id | STRING | The ID of the message. |
| threadId | STRING | The ID of the thread the message belongs to. |
| labelIds | ARRAY Items[STRING] | List of IDs of labels applied to this message. |
Output Example
{
"id" : "",
"threadId" : "",
"labelIds" : [ "" ]
}Triggers
New Email
Name: newEmail
Triggers when new mail is found in your Gmail inbox.
Type: STATIC_WEBHOOK
Properties
| Name | Label | Type | Description | Required |
|---|---|---|---|---|
| topicName | Topic Name | STRING | Name of your PubSub topic you want to subscribe to. | true |
| format | Format | STRING OptionsSIMPLE, MINIMAL, FULL, RAW, metadata | The format to return the message in. | false |
Output
The output for this action is dynamic and may vary depending on the input parameters. To determine the exact structure of the output, you need to execute the action.
JSON Example
{
"label" : "New Email",
"name" : "newEmail",
"parameters" : {
"topicName" : "",
"format" : ""
},
"type" : "googleMail/v1/newEmail"
}New Email Trigger Setup
Setting up Pub/Sub service
- Deploy a project that has New Mail Trigger.
- Click this icon to copy the static webhook URL.
- In the search bar enter
pub/sub. - Click on Pub/Sub.
- Click on Create topic.
- Enter your topic name.
- Click on Create.
- Click on Subscriptions.
- Click on your automatically created subscription.
- Click on Edit.
- Select Push.
- Click on Endpoint URL and paste the previously copied URL.
- Select Never expire.
- Click on Update.
- Click on Topics.
- Click here.
- Click on Add principal.
- Add gmail-api-push@system.gserviceaccount.com as the new principal.
- Click here.
- Click on Pub/Sub Publisher.
- Click on Save.
- Click on MyTopic.
- This is your topic name.
New Email Polling
Name: newEmailPolling
Periodically checks your Gmail inbox for any new incoming emails.
Type: POLLING
Properties
| Name | Label | Type | Description | Required |
|---|---|---|---|---|
| format | Format | STRING OptionsSIMPLE, MINIMAL, FULL, RAW, metadata | The format to return the message in. | false |
Output
The output for this action is dynamic and may vary depending on the input parameters. To determine the exact structure of the output, you need to execute the action.
JSON Example
{
"label" : "New Email Polling",
"name" : "newEmailPolling",
"parameters" : {
"format" : ""
},
"type" : "googleMail/v1/newEmailPolling"
}New Email Pooling Trigger Setup
Turning on Google Calendar API
Gmail doesn’t manage its own time zone; it inherits the time zone from your Google Calendar settings, so we rely on the Calendar API to resolve times correctly.
- Go to the Google Cloud Console.
- Click on APIs & Services.
- In search bar enter "Google Calendar API".
- Click on Google Calendar API.
- Click on Enable.
- Done 🚀
What to do if your action is not listed here?
If this component doesn't have the action you need, you can use Custom Action to create your own. Custom Actions empower you to define HTTP requests tailored to your specific requirements, allowing for greater flexibility in integrating with external services or APIs.
To create a Custom Action, simply specify the desired HTTP method, path, and any necessary parameters. This way, you can extend the functionality of your component beyond the predefined actions, ensuring that you can meet all your integration needs effectively.
Additional Instructions
How to find Message ID
The best way to find a message ID is to use the output of one of the Gmail actions or triggers. In the output, you will find an id property, which represents the message ID.
Some actions and triggers that return a message ID:
- Search Email
- Get Mail
- Send Email
- New Email trigger
Via API
- Use the
GET https://gmail.googleapis.com/gmail/v1/users/{userId}/messagesendpoint. - Lists the messages in the user's mailbox.
How to find Label ID
The best way to find a label ID is to use the List Labels action. It returns a list of labels, each containing a name and an id.
Via API
- Use the
GET https://gmail.googleapis.com/gmail/v1/users/{userId}/labelsendpoint. - Lists all labels in the user's mailbox.
How to find Thread ID
The best way to find a thread ID is to use the output of Gmail actions such as Get Thread, Get Mail, or Search Email. In the output, you will find a threadId property.
Via API
- Use the
GET https://gmail.googleapis.com/gmail/v1/users/{userId}/threadsendpoint. - Lists the threads in the user's mailbox.
Troubleshooting
Access Blocked: Verification Process Not Completed
Documentation for how to add a test user can be found here
![]()
How is this guide?
Last updated on
Google Forms
Google Forms is a web-based application that allows users to create surveys, quizzes, and forms for data collection and analysis, with real-time collaboration and response tracking.
Google Maps
Google Maps is a widely used mapping service by Google, offering free and feature-rich navigation, location discovery, and real-time traffic updates accessible through web browsers and mobile apps.