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_idtext
thread_idtext
fromtext
totext
subjecttext
datetext
bodytext

Actions

ActionWhat it does
Add label to messageAdd a label to a Gmail message.
Archive emailArchive a Gmail message so it no longer appears in the inbox.
Create draftCreate an email draft in Gmail.
Create labelCreate a new Gmail label.
Create reply messageCreate a reply message in a thread.
Delete emailMove a Gmail message to the trash.
Download attachmentsDownload all attachments from a Gmail message.
Find emailFind the first Gmail email that matches your search.
Get message headersGet the header details of a Gmail message, such as From, To, Subject, and Date.
Get most recent emailGet the most recently received email from your Gmail inbox.
List emailsList emails matching filters and return message details.
Mark as readMark a Gmail message as read.
Remove label from messageRemove a label from a Gmail message.
Send messageSend an email message or reply to a thread.

Add label to message

Add a label to a Gmail message.

Inputs

Message IDmessage_idtextRequired
Gmail message ID
Label namelabel_nametextRequired
Name of the label to add
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 a Gmail message so it no longer appears in the inbox.

Inputs

Message IDmessage_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

Tototext
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.
Subjectsubjecttext
Email subject line. Required unless 'Reply to message' is set, when leaving it blank reuses that email's subject with a 'Re:' prefix.
BodybodytextRequired
Plain text body of the 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 messagereply_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

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

Create reply message

Create a reply message in a thread.

Inputs

Message to reply tomessage_idtextRequired
The ID of the email to reply to
Subjectsubjecttext
Email subject line. Leave blank to reuse the original email's subject with a 'Re:' prefix.
BodybodytextRequired
Plain text body of the reply
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

No return value

Example output
{}

Delete email

Move a Gmail message to the trash.

Inputs

Message IDmessage_idtextRequired
Gmail message ID

Outputs

No return value

Download attachments

Download all attachments from a Gmail message.

Inputs

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

Get message headers

Get the header details of a Gmail message, such as From, To, Subject, and Date.

Inputs

Message IDmessage_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

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`

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 IDmessage_idtextRequired
Gmail message ID

Outputs

No return value

Remove label from message

Remove a label from a Gmail message.

Inputs

Message IDmessage_idtextRequired
Gmail message ID
Label namelabel_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

TototextRequired
Recipient email address(es). Separate multiple recipients (including variables) with commas.
SubjectsubjecttextRequired
Email subject line
BodybodytextRequired
Plain text body of the 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.

Outputs

No return value

Example output
{}

On this page