Gmail
App · Email · 14 actions · 1 trigger
Send, read, and manage email from your Gmail account.
Triggers
Start a workflow when something happens in Gmail. See how triggers work.
Gmail New Email
Triggers when a new email arrives in your Gmail inbox
Filters
Narrow which events start a run.
sender
Event fields
What a run starts with. Later steps read each field with an @ reference.
email_idtextthread_idtextfromtexttotextsubjecttextdatetextbodytext
Actions
| Action | What it does |
|---|---|
| Add label to message | Add a label to a Gmail message. |
| Archive email | Archive a Gmail message so it no longer appears in the inbox. |
| Create draft | Create an email draft in Gmail. |
| Create label | Create a new Gmail label. |
| Create reply message | Create a reply message in a thread. |
| Delete email | Move a Gmail message to the trash. |
| Download attachments | Download all attachments from a Gmail message. |
| Find email | Find the first Gmail email that matches your search. |
| Get message headers | Get the header details of a Gmail message, such as From, To, Subject, and Date. |
| Get most recent email | Get the most recently received email from your Gmail inbox. |
| List emails | List emails matching filters and return message details. |
| Mark as read | Mark a Gmail message as read. |
| Remove label from message | Remove a label from a Gmail message. |
| Send message | Send an email message or reply to a thread. |
Add label to message
Add a label to a Gmail message.
Inputs
- Message ID
message_idtextRequired - Gmail message ID
- Label name
label_nametextRequired - Name of the label to add
- Create if missing
create_if_missingtrue/false - Create the label if it does not existDefault:
true.
Outputs
label_idtext- Label ID
message_idtext- Message ID
thread_idtext- Thread ID
Example output
{
"label_id": "Label_123",
"message_id": "18abc123def456",
"thread_id": "18abc123def456"
}Archive email
Archive a Gmail message so it no longer appears in the inbox.
Inputs
- Message ID
message_idtextRequired - Gmail message ID
Outputs
No return value
Example output
{}Create draft
Create an email draft in Gmail. Set 'Reply to message' to draft a reply inside that email's conversation; nothing is sent.
Inputs
- To
totext - Recipient email address(es). Separate multiple recipients (including variables) with commas. Required unless 'Reply to message' is set, when leaving it blank addresses the draft to that email's sender.
- Subject
subjecttext - Email subject line. Required unless 'Reply to message' is set, when leaving it blank reuses that email's subject with a 'Re:' prefix.
- Body
bodytextRequired - Plain text body of the email
- CC
cctext - Optional Cc recipients. Separate multiple addresses (including variables) with commas.
- BCC
bcctext - Optional Bcc recipients. Separate multiple addresses (including variables) with commas.
- Reply to message
reply_to_message_idtext - The ID of an email to draft a reply to. The draft is saved in that email's conversation and threads with it when sent. Leave blank for a new email.
Outputs
idtext- Draft ID
message_idtext- Message ID
Example output
{
"id": "r123456789",
"message_id": "18abc123def456"
}Create label
Create a new Gmail label.
Inputs
- Label
labeltextRequired - Name of the label to create
- Label list visibility
label_list_visibilitytext - Whether the label appears in Gmail's label list
- Message list visibility
message_list_visibilitytext - Whether the label appears in Gmail's message list
Outputs
labeltext- Label name
label_idtext- Label ID
label_list_visibilitytext- Label list visibility
message_list_visibilitytext- Message list visibility
Example output
{
"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.
Inputs
- Message to reply to
message_idtextRequired - The ID of the email to reply to
- Subject
subjecttext - Email subject line. Leave blank to reuse the original email's subject with a 'Re:' prefix.
- Body
bodytextRequired - Plain text body of the reply
- Attachments
attachmentslist - Files to attach to the reply. Upload a file or reference a document (or list of documents) from an earlier step.
- CC
cctext - Optional Cc recipients. Separate multiple addresses (including variables) with commas.
- BCC
bcctext - Optional Bcc recipients. Separate multiple addresses (including variables) with commas.
Outputs
No return value
Example output
{}Delete email
Move a Gmail message to the trash.
Inputs
- Message ID
message_idtextRequired - Gmail message ID
Outputs
No return value
Download attachments
Download all attachments from a Gmail message.
Inputs
- Sender
sendertextRequired - Only download attachments from emails sent by this address
Outputs
document_refslist- References to the downloaded attachments, usable as file inputs in later steps (e.g. an email's attachments field).
documentslist- Downloaded attachment metadata.
Example output
{
"document_refs": [
"doc_0123456789abcdef0123456789abcdea",
"doc_0123456789abcdef0123456789abcdeb"
],
"documents": [
{
"content_type": "application/pdf",
"document_ref": "doc_0123456789abcdef0123456789abcdea",
"filename": "attachment1.pdf",
"size_bytes": 2048
},
{
"content_type": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"document_ref": "doc_0123456789abcdef0123456789abcdeb",
"filename": "attachment2.docx",
"size_bytes": 4096
}
]
}Find email
Find the first Gmail email that matches your search.
Inputs
- Search query
querytextRequired - What to search for, using Gmail's search format
- Unread only
unread_onlytrue/false - If true, only search unread emailsDefault:
false. - In inbox
in_inboxtrue/false - If true, only search in inboxDefault:
false.
Outputs
Object containing the found email, or email: null if not found
emailobject- Found email or null if not found
Example output
{
"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.
Inputs
- Message ID
message_idtextRequired - Gmail message ID
Outputs
Dictionary of email headers
Example output
{
"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.
Inputs
None.
Outputs
Most recent email details
datetext- Email date
from_text- Sender email address
idtext- Gmail message ID
snippettext- Email snippet preview
subjecttext- Email subject
thread_idtext- Thread ID
Example output
{
"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.
Inputs
- Limit
limitnumber - Maximum number of emails to return
- Search query
qtext - What to search for, using Gmail's search format (for example, from:foo@example.com)
- Unread only
unread_onlytrue/false - If true, only return unread emailsDefault:
false. - In inbox
in_inboxtrue/false - If true, only return emails in the inboxDefault:
true.
Outputs
List of Gmail emails under `emails`
emailslist
Example output
{
"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.
Inputs
- Message ID
message_idtextRequired - Gmail message ID
Outputs
No return value
Remove label from message
Remove a label from a Gmail message.
Inputs
- Message ID
message_idtextRequired - Gmail message ID
- Label name
label_nametextRequired - Name of the label to remove
Outputs
label_idtext- Label ID
message_idtext- Message ID
thread_idtext- Thread ID
Example output
{
"label_id": "Label_123",
"message_id": "18abc123def456",
"thread_id": "18abc123def456"
}Send message
Send an email message or reply to a thread.
Inputs
- To
totextRequired - Recipient email address(es). Separate multiple recipients (including variables) with commas.
- Subject
subjecttextRequired - Email subject line
- Body
bodytextRequired - Plain text body of the email
- Attachments
attachmentslist - Files to attach to the email. Upload a file or reference a document (or list of documents) from an earlier step.
- CC
cctext - Optional Cc recipients. Separate multiple addresses (including variables) with commas.
- BCC
bcctext - Optional Bcc recipients. Separate multiple addresses (including variables) with commas.
Outputs
No return value
Example output
{}