Gmail

App · Email · 28 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_idtext
thread_idtext
fromtext
totext
subjecttext
datetext
bodytext

Actions

ActionWhat it does
Add label to conversationPut a label on every email in a conversation.
Add label to emailAdd a label to an email.
Archive emailArchive an email so it no longer appears in the inbox.
Create draftSave an email as a draft in Gmail without sending it.
Create labelCreate a new label in Gmail.
Delete draftDelete a draft for good, without sending it.
Delete emailMove an email to the trash.
Delete labelDelete one of your own labels for good.
Download attachmentsSave every attachment on an email so later steps can use the files.
Find emailFind the first email that matches a Gmail search.
Forward emailForward an email to someone, as Gmail does: your note, then the original email's sender, date, subject and text, with its attachments.
Get conversationGet every email in a conversation, oldest first, with who sent each one, when, and its text.
Get draftGet a draft: who it is to, its subject and its text.
Get email detailsGet who an email is from and to, its subject and its date.
Get labelGet a label's details, with how many emails and conversations carry it and how many of them are unread.
Get most recent emailGet the most recently received email from your Gmail inbox.
List conversationsList the conversations that match a Gmail search, newest first, with a short preview of each.
List draftsList your Gmail drafts, newest first, with who each is to and its subject.
List emailsList the emails that match a Gmail search, with each one's sender, subject and text.
List labelsList every label in the mailbox: your own labels first, then Gmail's own, such as Inbox and Starred.
Mark as readMark an email as read.
Mark as unreadMark an email as unread, so it shows as new in Gmail again.
Remove label from conversationRemove a label from every email in a conversation.
Remove label from emailRemove a label from an email.
Reply to emailSend a reply to an email, in the same conversation.
Restore conversationBring a conversation's emails back out of Gmail's trash, where they were before.
Send emailSend an email.
Trash conversationMove every email in a conversation to Gmail's trash.

Add label to conversation

Put a label on every email in a conversation. A label that doesn't exist yet is created.

Inputs

Conversationthread_idtextRequired
The conversation, such as the thread ID of the email that started the run. Any email in it works too.
Labellabel_nametextRequired
The label to add, such as Follow up. Pick one, or type a new name to create it.

Outputs

label_idtext
Label ID
label_nametext
The label's name
thread_idtext
The conversation's ID
Example output
{
  "label_id": "Label_123",
  "label_name": "Follow up",
  "thread_id": "18abc123def456"
}

Add label to email

Add a label to an email.

Inputs

Emailmessage_idtextRequired
The email, such as the one that started the run.
Labellabel_nametextRequired
The label to add. Pick one from the list, or type a new name to create it.
Create if missingcreate_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 an email so it no longer appears in the inbox.

Inputs

Emailmessage_idtextRequired
The email, such as the one that started the run.

Outputs

No return value

Example output
{}

Create draft

Save an email as a draft in Gmail without sending it. Set 'Reply to email' to draft a reply in that email's conversation.

Inputs

Tototext
Recipient email address(es). Separate multiple recipients (including variables) with commas. Required unless 'Reply to email' is set, when leaving it blank addresses the draft to that email's sender.
Subjectsubjecttext
Email subject line. Required unless 'Reply to email' is set, when leaving it blank reuses that email's subject with a 'Re:' prefix.
BodybodytextRequired
The body of the email: plain text, or HTML (such as a table made with the HTML step), which is sent as a formatted email
CCcctext
Optional Cc recipients. Separate multiple addresses (including variables) with commas.
BCCbcctext
Optional Bcc recipients. Separate multiple addresses (including variables) with commas.
Reply to emailreply_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 label in Gmail.

Inputs

LabellabeltextRequired
Name of the label to create
Label list visibilitylabel_list_visibilitytext
Whether the label appears in Gmail's label list
Message list visibilitymessage_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"
}

Delete draft

Delete a draft for good, without sending it. It doesn't go to the trash, so this can't be undone.

Inputs

Draftdraft_idtextRequired
The draft's ID, from Create draft or List drafts.

Outputs

deletedtrue/false
True once the draft is deleted.
draft_idtext
The deleted draft's ID.
Example output
{
  "deleted": true,
  "draft_id": "r-1234567890"
}

Delete email

Move an email to the trash.

Inputs

Emailmessage_idtextRequired
The email, such as the one that started the run.

Outputs

No return value

Example output
{}

Delete label

Delete one of your own labels for good. The emails it was on stay where they are; they just lose the label. Gmail's own labels, such as Inbox, can't be deleted.

Inputs

Labellabel_nametextRequired
The label: pick one, or type its name.

Outputs

deletedtrue/false
True once the label is deleted.
label_idtext
The deleted label's ID.
label_nametext
The deleted label's name.
Example output
{
  "deleted": true,
  "label_id": "Label_123",
  "label_name": "Old project"
}

Download attachments

Save every attachment on an email so later steps can use the files. Choose the email, or a sender to read their latest email. An email with no attachments gives an empty list, so when a workflow reads the files (an invoice, a CV), check the list is not empty first: a new-email trigger fires on every message.

Inputs

Emailmessage_idtext
The email whose attachments to download, such as the one that started the run. Leave blank to use Sender instead.
Sendersendertext
Used when Email is blank: download the attachments on the latest email from 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 email that matches a Gmail search.

Inputs

Search queryquerytextRequired
What to search for, using Gmail's search format
Unread onlyunread_onlytrue/false
If true, only search unread emailsDefault: false.
In inboxin_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"
  }
}

Forward email

Forward an email to someone, as Gmail does: your note, then the original email's sender, date, subject and text, with its attachments.

Inputs

Emailmessage_idtextRequired
The email to forward, such as the one that started the run.
TototextRequired
Who to forward it to. Separate several addresses with commas.
Messagenotetext
A note to put above the forwarded email. Leave blank to forward it as it is.
CCcctext
Who to copy in. Separate several addresses with commas.
Include attachmentsinclude_attachmentstrue/false
Forward the email's attachments with it.Default: true.

Outputs

attachments_forwardednumber
How many attachments went with it
message_idtext
ID of the forwarded email in your Sent mail
thread_idtext
The conversation the forwarded email is in
totext
Who it was forwarded to
Example output
{
  "attachments_forwarded": 1,
  "message_id": "18abc123def999",
  "thread_id": "18abc123def999",
  "to": "colleague@example.com"
}

Get conversation

Get every email in a conversation, oldest first, with who sent each one, when, and its text.

Inputs

Conversationthread_idtextRequired
The conversation, such as the thread ID of the email that started the run. Any email in it works too.

Outputs

countnumber
How many emails the conversation has
emailslist
Its emails, oldest first
subjecttext
The subject of its first email
thread_idtext
The conversation's ID
Example output
{
  "count": 2,
  "emails": [
    {
      "body": "Could you send a quote for the new office?",
      "from": "Sam <sam@example.com>",
      "id": "18abc123def456",
      "received": "2026-11-02T09:00:00+00:00",
      "reply_body": "Could you send a quote for the new office?",
      "sender": "Sam <sam@example.com>",
      "snippet": "Could you send a quote for the new office?",
      "subject": "Quote for the new office",
      "thread_id": "18abc123def456",
      "to": "me@example.com"
    },
    {
      "body": "Here it is: $4,200 for the fit-out.",
      "from": "me@example.com",
      "id": "18abc123def999",
      "received": "2026-11-02T11:30:00+00:00",
      "reply_body": "Here it is: $4,200 for the fit-out.",
      "sender": "me@example.com",
      "snippet": "Here it is: $4,200 for the fit-out.",
      "subject": "Re: Quote for the new office",
      "thread_id": "18abc123def456",
      "to": "Sam <sam@example.com>"
    }
  ],
  "subject": "Quote for the new office",
  "thread_id": "18abc123def456"
}

Get draft

Get a draft: who it is to, its subject and its text.

Inputs

Draftdraft_idtextRequired
The draft's ID, from Create draft or List drafts.

Outputs

bodytext
The draft's text.
cctext
Who the draft copies, if anyone.
draft_idtext
The draft's ID.
message_idtext
The ID of the email the draft holds.
subjecttext
The draft's subject.
thread_idtext
The conversation the draft belongs to.
totext
Who the draft is to.
Example output
{
  "body": "Hi Sam, here is the quote we talked about.",
  "cc": "",
  "draft_id": "r-1234567890",
  "message_id": "18abc123def456",
  "subject": "Your quote",
  "thread_id": "18abc123def456",
  "to": "sam@example.com"
}

Get email details

Get who an email is from and to, its subject and its date.

Inputs

Emailmessage_idtextRequired
The email, such as the one that started the run.

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 label

Get a label's details, with how many emails and conversations carry it and how many of them are unread.

Inputs

Labellabel_nametextRequired
The label: pick one, or type its name.

Outputs

label_idtext
The label's ID.
messages_totalnumber
How many emails carry the label.
messages_unreadnumber
How many of those emails are unread.
nametext
The label's name.
threads_totalnumber
How many conversations carry the label.
threads_unreadnumber
How many of those conversations are unread.
typetext
user for your own labels, system for Gmail's own.
Example output
{
  "label_id": "Label_123",
  "messages_total": 42,
  "messages_unread": 3,
  "name": "Invoices",
  "threads_total": 30,
  "threads_unread": 2,
  "type": "user"
}

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 conversations

List the conversations that match a Gmail search, newest first, with a short preview of each.

Inputs

Search queryqtext
What to search for, in Gmail's search format (for example, from:sam@example.com is:unread). Leave blank for the newest conversations.
Limitlimitnumber
The most to list, up to 100. Defaults to 20.From 1 to 100.
Include spam and trashinclude_spam_trashtrue/false
Also list conversations in Spam and Trash.Default: false.

Outputs

conversationslist
The matching conversations, newest first.
countnumber
How many conversations came back.
has_moretrue/false
True when more conversations match than were listed.
Example output
{
  "conversations": [
    {
      "snippet": "Thanks, the invoice is attached.",
      "thread_id": "18abc123def456"
    }
  ],
  "count": 1,
  "has_more": false
}

List drafts

List your Gmail drafts, newest first, with who each is to and its subject.

Inputs

Search queryqtext
Only drafts that match this Gmail search (for example, to:sam@example.com). Leave blank for every draft.
Limitlimitnumber
The most to list, up to 100. Defaults to 20.From 1 to 100.

Outputs

countnumber
How many drafts came back.
draftslist
The drafts, newest first.
has_moretrue/false
True when there are more drafts than were listed.
Example output
{
  "count": 1,
  "drafts": [
    {
      "draft_id": "r-1234567890",
      "message_id": "18abc123def456",
      "snippet": "Hi Sam, here is the quote we talked about",
      "subject": "Your quote",
      "thread_id": "18abc123def456",
      "to": "sam@example.com"
    }
  ],
  "has_more": false
}

List emails

List the emails that match a Gmail search, with each one's sender, subject and text.

Inputs

Limitlimitnumber
Maximum number of emails to return
Search queryqtext
What to search for, using Gmail's search format (for example, from:foo@example.com)
Unread onlyunread_onlytrue/false
If true, only return unread emailsDefault: false.
In inboxin_inboxtrue/false
If true, only return emails in the inboxDefault: true.

Outputs

List of Gmail emails under `emails`

countnumber
Beta. How many emails came back
emailslist
Example output
{
  "count": 1,
  "emails": [
    {
      "body": "Hello there, this is the full email body content.",
      "from": "sender@example.com",
      "id": "18abc123def456",
      "received": "2024-01-15T14:20:00+00:00",
      "reply_body": "Hello there, this is the full email body content.",
      "sender": "sender@example.com",
      "snippet": "Hello there",
      "subject": "Hello",
      "thread_id": "18abc123def456"
    }
  ]
}

List labels

List every label in the mailbox: your own labels first, then Gmail's own, such as Inbox and Starred.

Inputs

None.

Outputs

countnumber
How many labels there are.
labelslist
The mailbox's labels.
Example output
{
  "count": 2,
  "labels": [
    {
      "label_id": "Label_123",
      "name": "Invoices",
      "type": "user"
    },
    {
      "label_id": "INBOX",
      "name": "INBOX",
      "type": "system"
    }
  ]
}

Mark as read

Mark an email as read.

Inputs

Emailmessage_idtextRequired
The email, such as the one that started the run.

Outputs

No return value

Example output
{}

Mark as unread

Mark an email as unread, so it shows as new in Gmail again.

Inputs

Emailmessage_idtextRequired
The email, such as the one that started the run.

Outputs

message_idtext
Message ID
thread_idtext
Thread ID
Example output
{
  "message_id": "18abc123def456",
  "thread_id": "18abc123def456"
}

Remove label from conversation

Remove a label from every email in a conversation.

Inputs

Conversationthread_idtextRequired
The conversation, such as the thread ID of the email that started the run. Any email in it works too.
Labellabel_nametextRequired
The name of the label to remove, such as Follow up.

Outputs

label_idtext
Label ID
label_nametext
The label that was removed
thread_idtext
The conversation's ID
Example output
{
  "label_id": "Label_123",
  "label_name": "Follow up",
  "thread_id": "18abc123def456"
}

Remove label from email

Remove a label from an email.

Inputs

Emailmessage_idtextRequired
The email, such as the one that started the run.
Labellabel_nametextRequired
The label to take off the email

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"
}

Reply to email

Send a reply to an email, in the same conversation.

Inputs

Email to reply tomessage_idtextRequired
The ID of the email to reply to. For an email you sent, such as the ID Send email gives back, the reply goes to the people it was sent to: a follow-up in the same conversation.
Subjectsubjecttext
Email subject line. Leave blank to reuse the original email's subject with a 'Re:' prefix.
BodybodytextRequired
The body of the reply: plain text, or HTML, which is sent as a formatted email
Attachmentsattachmentslist
Files to attach to the reply. Upload a file or reference a document (or list of documents) from an earlier step.
CCcctext
Optional Cc recipients. Separate multiple addresses (including variables) with commas.
BCCbcctext
Optional Bcc recipients. Separate multiple addresses (including variables) with commas.

Outputs

message_idtext
The sent email's ID: give it to Reply to email to send a follow-up in the same conversation
thread_idtext
The ID of the conversation the email is in
Example output
{
  "message_id": "18abc123def789",
  "thread_id": "18abc123def456"
}

Restore conversation

Bring a conversation's emails back out of Gmail's trash, where they were before.

Inputs

Conversationthread_idtextRequired
The conversation's ID, such as the thread_id of an email or what Trash conversation gave.

Outputs

thread_idtext
The conversation's ID.
trashedtrue/false
True when the conversation is now in the trash.
Example output
{
  "thread_id": "18abc123def456",
  "trashed": false
}

Send email

Send an email.

Inputs

TototextRequired
Recipient email address(es). Separate multiple recipients (including variables) with commas.
SubjectsubjecttextRequired
Email subject line
BodybodytextRequired
The body of the email: plain text, or HTML (such as a table made with the HTML step), which is sent as a formatted email
Attachmentsattachmentslist
Files to attach to the email. Upload a file or reference a document (or list of documents) from an earlier step.
CCcctext
Optional Cc recipients. Separate multiple addresses (including variables) with commas.
BCCbcctext
Optional Bcc recipients. Separate multiple addresses (including variables) with commas.
Replies go toreply_totext
Beta. Where the recipient's reply goes instead of this mailbox, such as the person who filled in a web form when their message is passed on to a team. Leave empty for replies to come back to this mailbox.

Outputs

message_idtext
The sent email's ID: give it to Reply to email to send a follow-up in the same conversation
thread_idtext
The ID of the conversation the email is in
Example output
{
  "message_id": "18abc123def789",
  "thread_id": "18abc123def456"
}

Trash conversation

Move every email in a conversation to Gmail's trash. Gmail deletes it for good after 30 days; until then Restore conversation brings it back.

Inputs

Conversationthread_idtextRequired
The conversation, such as the thread ID of the email that started the run. Any email in it works too.

Outputs

thread_idtext
The conversation's ID.
trashedtrue/false
True when the conversation is now in the trash.
Example output
{
  "thread_id": "18abc123def456",
  "trashed": true
}

On this page