Docs
Apps
Gmail Node

Gmail Node

Loading node sections...

Overview

The Gmail Node is an email automation component that provides both event triggering and action capabilities for Gmail integration. This node enables automated email monitoring, sending, and management within flows, supporting real-time email processing and automated email operations.

logic.png

Node Type Information

TypeDescriptionStatus
Batch TriggerStarts the flow on a schedule or batch event. Ideal for periodic data processing.❌ False
Event TriggerStarts the flow based on external events (e.g., webhook, user interaction).✅ True
ActionExecutes a task or logic as part of the flow (e.g., API call, transformation).✅ True

This node is both an Event Trigger and Action node that provides email automation capabilities for monitoring, sending, and managing emails.

This node combines Event Trigger and Action capabilities to provide comprehensive email automation within your workflows.

Features

Key Functionalities
  1. Event Trigger - On New Email: Automatically triggers workflows when new emails are received, enabling real-time email processing and automation.
  2. Action - Send Email: Composes and sends emails with customizable content, recipients, and attachments (including URL-based attachments).
  3. Action - Create Email Draft: Creates email drafts with support for attachments via URL, CC/BCC, and extra recipients.
  4. Action - Fetch Email: Retrieves specific emails or email threads based on search criteria and filters with enhanced options including composite queries, max results, and page tokens.
  5. Action - List Labels: Retrieves all Gmail labels for the authenticated account.
  6. Action - Fetch Message by Thread ID: Retrieves a specific message by its thread ID.
  7. Action - List Threads: Lists email threads with filtering and pagination support.
  8. Action - Reply to Thread: Replies to an existing email thread with support for attachments via URL, CC/BCC, and extra recipients.
Benefits
  1. Real-time Email Monitoring: Automatically responds to incoming emails without manual intervention.
  2. Automated Email Communication: Streamlines email sending processes with customizable templates and dynamic content.
  3. Advanced Email Management: List and filter threads, fetch messages by thread ID, and manage Gmail labels programmatically.
  4. Thread-based Conversations: Reply to threads to maintain conversation context and continuity.
  5. Flexible Attachments: Support for URL-based attachments in sends, drafts, and replies with name and MIME type specification.
  6. Enhanced Email Retrieval: Composite queries, pagination, and filtering options for efficient email data extraction.
  7. Calendar Integration: Seamlessly converts email content into calendar events for better scheduling.

Prerequisites

Before using Gmail Node, ensure the following:

  • Gmail Account: A valid Gmail account with proper authentication setup.

Setup

Step 1: Set Up Gmail API Access

  1. Set Up Google Drive Access
    • Set up Google OAuth credentials for Gmail access |

Step 2: Set Up Lamatic Flow

  1. Create a Custom Flow for Gmail automation:
    • Configure the Gmail node based on your use case
    • Set up event triggers for email monitoring
    • Define action parameters for email operations

Configuration Reference

Event Trigger Configuration

ParameterDescriptionRequiredExample
NameDisplay name for the nodeGmail Monitor
CredentialsGmail authentication details required to access the accountmy-gmail-credentials
Trigger TypeType of email event to monitorOn New Email

Action Configuration

Send Email Action

ParameterDescriptionRequiredExample
NameDisplay name for the actionSend Email
CredentialsGmail authentication details required to send emailsmy-gmail-credentials
ActionActions for GmailSend Email, Create Email Draft, Fetch Email, List Labels, etc.
Recipient EmailRecipient email addresses (comma-separated)[email protected]
SubjectEmail subject lineAutomated Response
BodyEmail body content (supports HTML and plain text)Hello, this is an automated email.
CCCC recipient email addresses (comma-separated)[email protected]
BCCBCC recipient email addresses (comma-separated)[email protected]
Is Content HTML?Set to true if the email body is HTML.true, false
Attachment URLsArray of attachment objects with url, name, and mimeType (comma-separated)https://example.com/file.pdf, document.pdf, application/pdf

Fetch Email Action

ParameterDescriptionRequiredExample
NameDisplay name for the actionFetch Email
CredentialsGmail authentication details required to fetch emailsmy-gmail-credentials
Max ResultsMaximum number of emails to retrieve10
From UserIf provided, only emails from the specified user(s) will be fetched. If not provided, all emails will be fetched.[email protected]
To UserIf provided, only emails to the specified user(s) will be fetched. If not provided, all emails will be fetched.[email protected]
QueryComposite Gmail search query (supports Gmail search syntax)from:example.com is:unread
Page TokenToken for pagination to retrieve next page of resultsCAESFQoI...

Create Email Draft Action

ParameterDescriptionRequiredExample
NameDisplay name for the actionCreate Email Draft
CredentialsGmail authentication details required to create draftsmy-gmail-credentials
ActionActions for GmailCreate Email Draft
Recipient EmailRecipient email addresses (comma-separated)[email protected]
SubjectEmail subject lineDraft Email
BodyEmail body content (supports HTML and plain text)This is a draft email.
CCCC recipient email addresses (comma-separated)[email protected]
BCCBCC recipient email addresses (comma-separated)[email protected]
Is Content HTML?Set to true if the email body is HTML.true, false
Attachment URLsArray of attachment objects with url, name, and mimeType (comma-separated)https://example.com/file.pdf, document.pdf, application/pdf

List Labels Action

ParameterDescriptionRequiredExample
NameDisplay name for the actionList Labels
CredentialsGmail authentication details required to list labelsmy-gmail-credentials
ActionActions for GmailList Labels

Fetch Message by Thread ID Action

ParameterDescriptionRequiredExample
NameDisplay name for the actionFetch Message by Thread ID
CredentialsGmail authentication details required to fetch messagesmy-gmail-credentials
ActionActions for GmailFetch Message by Thread ID
Thread IDThe Gmail thread ID to fetch messages from18c0f0a1a2b3c4d5

List Threads Action

ParameterDescriptionRequiredExample
NameDisplay name for the actionList Threads
CredentialsGmail authentication details required to list threadsmy-gmail-credentials
ActionActions for GmailList Threads
QueryGmail search query to filter threads (supports Gmail search syntax)from:example.com is:unread
Max ResultsMaximum number of threads to retrieve10
Page TokenToken for pagination to retrieve next page of resultsCAESFQoI...

Reply to Thread Action

ParameterDescriptionRequiredExample
NameDisplay name for the actionReply to Thread
CredentialsGmail authentication details required to reply to threadsmy-gmail-credentials
ActionActions for GmailReply to Thread
Thread IDThe Gmail thread ID to reply to18c0f0a1a2b3c4d5
BodyReply body content (supports HTML and plain text)Thank you for your email.
CCCC recipient email addresses (comma-separated)[email protected]
BCCBCC recipient email addresses (comma-separated)[email protected]
Is Content HTML?Set to true if the reply body is HTML.true, false
Attachment URLsArray of attachment objects with url, name, and mimeType (comma-separated)https://example.com/file.pdf, document.pdf, application/pdf

Low-Code Example

Event Trigger Example

triggerNode:
  nodeId: triggerNode_1
  nodeType: gmailNode
  nodeName: Gmail
  values:
    credentials: Gmail OAuth VJS
    action: GMAIL_NEW_GMAIL_MESSAGE
  modes: {}

Action Examples

Send Email Action

nodes:
  - nodeId: gmailNode_397
    nodeType: gmailNode
    nodeName: Gmail
    values:
      credentials: Gmail OAuth VJS
      action: GMAIL_SEND_EMAIL
      recipient_email: ''
      cc: ''
      bcc: ''
      subject: ''
      body: ''
      is_html: false
      attachment_urls: ''
    modes: {}
    needs:
      - triggerNode_1

Create Email Draft Action

nodes:
  - nodeId: gmailNode_397
    nodeType: gmailNode
    nodeName: Gmail
    values:
      credentials: Gmail OAuth VJS
      action: GMAIL_CREATE_EMAIL_DRAFT
      recipient_email: ''
      cc: ''
      bcc: ''
      subject: ''
      body: ''
      is_html: false
      attachment_urls: ''
    modes: {}
    needs:
      - triggerNode_1

Fetch Email Action

nodes:
  - nodeId: gmailNode_397
    nodeType: gmailNode
    nodeName: Gmail
    values:
      credentials: Gmail OAuth VJS
      action: GMAIL_FETCH_EMAILS
      recipient_email: ''
      cc: ''
      bcc: ''
      subject: ''
      body: ''
      is_html: false
      max_results: 10
      from_user: ''
      to_user: ''
      query: 'from:example.com is:unread'
      page_token: ''
    modes: {}
    needs:
      - triggerNode_1

List Labels Action

nodes:
  - nodeId: gmailNode_398
    nodeType: gmailNode
    nodeName: Gmail
    values:
      credentials: Gmail OAuth VJS
      action: GMAIL_LIST_LABELS
    modes: {}
    needs:
      - triggerNode_1

Fetch Message by Thread ID Action

nodes:
  - nodeId: gmailNode_399
    nodeType: gmailNode
    nodeName: Gmail
    values:
      credentials: Gmail OAuth VJS
      action: GMAIL_FETCH_MESSAGE_BY_THREAD_ID
      thread_id: '18c0f0a1a2b3c4d5'
    modes: {}
    needs:
      - triggerNode_1

List Threads Action

nodes:
  - nodeId: gmailNode_400
    nodeType: gmailNode
    nodeName: Gmail
    values:
      credentials: Gmail OAuth VJS
      action: GMAIL_LIST_THREADS
      query: 'from:example.com is:unread'
      max_results: 10
      page_token: ''
    modes: {}
    needs:
      - triggerNode_1

Reply to Thread Action

nodes:
  - nodeId: gmailNode_401
    nodeType: gmailNode
    nodeName: Gmail
    values:
      credentials: Gmail OAuth VJS
      action: GMAIL_REPLY_TO_THREAD
      thread_id: '18c0f0a1a2b3c4d5'
      body: 'Thank you for your email.'
      cc: ''
      bcc: ''
      is_html: false
      attachment_urls: ''
    modes: {}
    needs:
      - triggerNode_1

Output

Event Trigger Output

  • emailId: String identifier for the email
  • from: String containing the sender's email address
  • to: String containing the recipient's email address
  • subject: String containing the email subject
  • body: String containing the email body content
  • timestamp: String containing the email timestamp
  • labels: Array of strings containing Gmail labels
  • attachments: Array of attachment objects (if any)

Action Output

Send Email Output

  • messageId: String identifier for the sent email
  • threadId: String identifier for the email thread
  • success: Boolean indicating if the email was sent successfully
  • timestamp: String containing the send timestamp

Create Event Draft Output

  • eventId: String identifier for the created event
  • eventLink: String containing the link to the event
  • success: Boolean indicating if the event was created successfully
  • attendees: Array of attendee objects with their response status

Fetch Email Output

  • emails: Array of email objects containing:
    • emailId: String identifier for the email
    • from: String containing the sender's email address
    • to: String containing the recipient's email address
    • subject: String containing the email subject
    • body: String containing the email body content
    • timestamp: String containing the email timestamp
    • labels: Array of strings containing Gmail labels
    • attachments: Array of attachment objects (if any)
  • totalCount: Number indicating the total number of emails found
  • nextPageToken: String token for pagination (if applicable)

Create Email Draft Output

  • draftId: String identifier for the created draft
  • messageId: String identifier for the draft message
  • threadId: String identifier for the email thread (if replying)
  • success: Boolean indicating if the draft was created successfully
  • timestamp: String containing the draft creation timestamp

List Labels Output

  • labels: Array of label objects containing:
    • id: String identifier for the label
    • name: String containing the label name
    • type: String indicating the label type (system, user)
    • messageListVisibility: String indicating message list visibility
    • labelListVisibility: String indicating label list visibility
    • color: Object containing label color information (if applicable)

Fetch Message by Thread ID Output

  • threadId: String identifier for the thread
  • messages: Array of message objects containing:
    • messageId: String identifier for the message
    • threadId: String identifier for the thread
    • from: String containing the sender's email address
    • to: Array of strings containing recipient email addresses
    • subject: String containing the email subject
    • body: String containing the email body content
    • timestamp: String containing the email timestamp
    • labels: Array of strings containing Gmail labels
    • attachments: Array of attachment objects (if any)
  • historyId: String containing the history ID for the thread

List Threads Output

  • threads: Array of thread objects containing:
    • threadId: String identifier for the thread
    • historyId: String containing the history ID
    • snippet: String containing a preview snippet of the thread
    • messages: Array of message objects (if expanded)
  • totalCount: Number indicating the total number of threads found
  • nextPageToken: String token for pagination (if applicable)

Reply to Thread Output

  • messageId: String identifier for the reply message
  • threadId: String identifier for the email thread
  • success: Boolean indicating if the reply was sent successfully
  • timestamp: String containing the reply send timestamp

Troubleshooting

Common Issues

ProblemSolution
Authentication ErrorsVerify that the Gmail OAuth credentials are valid and have the correct scopes
Permission DeniedEnsure the Gmail API is enabled and the account has proper permissions
Email Not TriggeringCheck the filter criteria and ensure the monitored label exists
Send Email FailsVerify recipient email addresses and ensure the account has sending permissions
Calendar Access IssuesConfirm that Calendar API is enabled and the account has calendar permissions
Rate LimitingImplement appropriate delays between API calls to avoid hitting rate limits

Debugging

  • Check Gmail API logs for detailed error messages
  • Verify OAuth token validity and refresh if necessary
  • Test email filters using Gmail's search syntax
  • Monitor API quota usage to avoid rate limiting
  • Validate email addresses and calendar event parameters
  • Check network connectivity and firewall settings
  • Review Gmail API documentation for specific error codes

Was this page useful?

Questions? We're here to help

Subscribe to updates