Gmail
API actions for the Gmail integration.
Gmail
Send, read, and manage email from your Gmail account.
Add label to message
Add a label to a Gmail message.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
message_id | string | Yes | Gmail message ID |
label_name | string | Yes | Name of the label to add |
create_if_missing | boolean | No | Create the label if it does not exist |
Response
{
"label_id": "Label_123",
"message_id": "18abc123def456",
"thread_id": "18abc123def456"
}Archive email
Archive a Gmail message so it no longer appears in the inbox.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
message_id | string | Yes | Gmail message ID |
Response
{
"status": "success"
}Create draft
Create an email draft in Gmail.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
to | string | Yes | Recipient email address(es). Separate multiple recipients (including variables) with commas. |
subject | string | Yes | Email subject line |
body | string | Yes | Plain text body of the email |
cc | string | No | Optional Cc recipients. Separate multiple addresses (including variables) with commas. |
bcc | string | No | Optional Bcc recipients. Separate multiple addresses (including variables) with commas. |
Response
{
"id": "r123456789",
"message_id": "18abc123def456"
}Create label
Create a new Gmail label.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
label | string | Yes | Name of the label to create |
Response
{
"label": "My Label",
"label_id": "Label_123",
"label_list_visibility": "labelShow",
"message_list_visibility": "show"
}Create reply message
Create a reply message in a thread.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
message_id | string | Yes | The ID of the email to reply to |
subject | string | No | Email subject line. Leave blank to reuse the original email's subject with a 'Re:' prefix. |
body | string | Yes | Plain text body of the reply |
attachments | array | No | Files to attach to the reply. Upload a file or reference a document (or list of documents) from an earlier step. |
cc | string | No | Optional Cc recipients. Separate multiple addresses (including variables) with commas. |
bcc | string | No | Optional Bcc recipients. Separate multiple addresses (including variables) with commas. |
Response
{
"status": "success"
}Delete email
Move a Gmail message to the trash.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
message_id | string | Yes | Gmail message ID |
Response
{
"status": "success"
}Download attachments
Download all attachments from a Gmail message.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
sender | string | Yes | Only download attachments from emails sent by this address |
Response
{
"documents": [
{
"content_type": "application/pdf",
"filename": "attachment1.pdf",
"size_bytes": 2048
}
],
"filepaths": [
"/tmp/attachment1.pdf",
"/tmp/attachment2.docx"
]
}Find email
Find the first Gmail email that matches your search.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
query | string | Yes | What to search for, using Gmail's search format |
unread_only | boolean | No | If true, only search unread emails |
in_inbox | boolean | No | If true, only search in inbox |
Response
{
"email": {
"body": "Hey, just wanted to follow up on our conversation from last week. Let me know if you have any questions.",
"from": "sender@example.com",
"id": "18abc123def456",
"reply_body": "Hey, just wanted to follow up on our conversation from last week. Let me know if you have any questions.",
"sender": "sender@example.com",
"snippet": "Hey, just wanted to follow up on...",
"subject": "Hello",
"thread_id": "18abc123def456"
}
}Get message headers
Get the header details of a Gmail message, such as From, To, Subject, and Date.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
message_id | string | Yes | Gmail message ID |
Response
{
"Date": "Mon, 1 Jan 2024 12:00:00 +0000",
"From": "sender@example.com",
"Subject": "Hello World",
"To": "recipient@example.com",
"threadId": "18abc123def456"
}Get most recent email
Get the most recently received email from your Gmail inbox.
Response
{
"date": "Mon, 1 Jan 2024 12:00:00 +0000",
"from_": "sender@example.com",
"id": "18abc123def456",
"snippet": "This is a preview of the email content...",
"subject": "Hello World",
"thread_id": "18abc123def456"
}List emails
List emails matching filters and return message details.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
limit | number | No | Maximum number of emails to return |
q | string | No | What to search for, using Gmail's search format (for example, from:foo@example.com) |
unread_only | boolean | No | If true, only return unread emails |
in_inbox | boolean | No | If true, only return emails in the inbox |
Response
{
"emails": [
{
"body": "Hello there, this is the full email body content.",
"from": "sender@example.com",
"id": "18abc123def456",
"reply_body": "Hello there, this is the full email body content.",
"sender": "sender@example.com",
"snippet": "Hello there",
"subject": "Hello",
"thread_id": "18abc123def456"
}
]
}Mark as read
Mark a Gmail message as read.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
message_id | string | Yes | Gmail message ID |
Response
{
"status": "success"
}Remove label from message
Remove a label from a Gmail message.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
message_id | string | Yes | Gmail message ID |
label_name | string | Yes | Name of the label to remove |
Response
{
"label_id": "Label_123",
"message_id": "18abc123def456",
"thread_id": "18abc123def456"
}Send message
Send an email message or reply to a thread.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
to | string | Yes | Recipient email address(es). Separate multiple recipients (including variables) with commas. |
subject | string | Yes | Email subject line |
body | string | Yes | Plain text body of the email |
attachments | array | No | Files to attach to the email. Upload a file or reference a document (or list of documents) from an earlier step. |
cc | string | No | Optional Cc recipients. Separate multiple addresses (including variables) with commas. |
bcc | string | No | Optional Bcc recipients. Separate multiple addresses (including variables) with commas. |
Response
{
"status": "success"
}