ZelaxyDocs
Tool Integrations
Tool

Gmail

Send, read, and search emails through Gmail

Gmail

Full Gmail integration — send emails, read inbox messages, search by query, and manage labels. Uses Google OAuth for secure access to your Gmail account.

Overview

PropertyValue
Typegmail
CategoryTool — Email
AuthOAuth 2.0 (Google)

Operations

OperationDescription
Send EmailCompose and send an email
Read EmailsFetch recent emails from inbox or read a specific email by Message ID
Search EmailsSearch using Gmail query syntax
List LabelsGet all labels/folders

Configuration

SettingTypeDescription
Google AccountOAuthConnect your Gmail
ToShort inputRecipient email(s), comma-separated
SubjectShort inputEmail subject line
BodyLong textEmail body (HTML supported)
CC / BCCShort inputCarbon copy recipients
Message IDShort inputSpecific Gmail message ID to fetch — overrides Label/Folder. Supports variable references like {{loop.currentItem}} or {{webhook.payload.message_id}}
Label / FolderFolder selectorGmail label to read from (ignored when Message ID is provided)
Include AttachmentsSwitchDownload and include attachment data
Search QueryShort inputGmail search query (for search op)
Max ResultsSliderNumber of emails to fetch (1–50)

Outputs

Read Operation

FieldTypeDescription
contentstringEmail body as plain text (HTML is stripped automatically)
metadatajsonEmail metadata object (see below)
attachmentsjsonArray of attachment objects (when Include Attachments is ON)

metadata object fields:

FieldTypeDescription
idstringGmail message ID
threadIdstringConversation thread ID
fromstringSender formatted as "Name <email>"
tostringRecipients formatted as "Name <email>", comma-separated
ccstringCC recipients formatted as "Name <email>", comma-separated
subjectstringEmail subject line
datestringReceived date/time (ISO 8601)
hasAttachmentsbooleanWhether the email has attachments
attachmentCountnumberNumber of attachments
labelsstringEmail labels (comma-separated)

attachments array item fields:

FieldTypeDescription
namestringAttachment filename
mimeTypestringMIME type (e.g., application/pdf)
sizenumberFile size in bytes
dataBufferRaw attachment data
contentstringText content (for text-based attachments only)

Send / Draft Operations

FieldTypeDescription
messagestringStatus message
messageIdstringSent/draft message ID
threadIdstringConversation thread ID

Trigger Mode

When Gmail is used as a trigger (first block), it outputs:

FieldTypeDescription
emailjsonFull email object with id, subject, from, to, bodyText, bodyHtml, attachments, etc.
rawEmailjsonComplete raw Gmail API response (if enabled)

Reading a Specific Email by ID

You can fetch a single email by its Gmail message ID. This is useful when integrating with external platforms that send you message IDs (e.g., via webhook).

How it works:

  1. Leave the Label field empty
  2. Enter the message ID in the Message ID field (or use a variable like {{webhook.payload.message_id}})
  3. Enable Include Attachments if you need attachment data
  4. The tool calls GET /gmail/v1/users/me/messages/{messageId}?format=full directly

When Message ID is provided, the Label/Folder setting is ignored.

Example: Process Selected Emails from External Platform

[Webhook (receives message_ids[])] → [Loop over IDs] → [Gmail: Read by ID] → [Agent: Process] → [API: Send results back]

Gmail Read Config:

  • Message ID: {{loop.currentItem}}
  • Include Attachments: ON
  • Label: (leave empty)

Accessing outputs in downstream blocks:

Email body:    {{gmail.content}}
Subject:       {{gmail.metadata.subject}}
Sender:        {{gmail.metadata.from}}
Recipients:    {{gmail.metadata.to}}
Message ID:    {{gmail.metadata.id}}
Thread ID:     {{gmail.metadata.threadId}}
Attachments:   {{gmail.attachments}}

Example: AI Email Assistant

Goal: Read unread emails, summarize them, and draft replies.

Workflow:

[Starter (schedule: hourly)] → [Gmail: Read] → [Loop] → [Agent: Summarize] → [Gmail: Send Reply]

How it works:

  1. Every hour, Gmail block fetches unread emails
  2. Loop iterates over each email
  3. Agent reads the email and generates a summary + draft reply
  4. Gmail sends the reply (or saves as draft)

Gmail Read Config:

  • Search Query: is:unread category:primary
  • Max Results: 10

Agent Prompt:

Read this email and draft a professional reply:
From: {{loop.currentItem.from}}
Subject: {{loop.currentItem.subject}}
Body: {{loop.currentItem.body}}

Trigger Support

Gmail can trigger workflows when new emails arrive. Configure a webhook trigger that polls for new messages.

Tips

  • Gmail search syntax is powerful: from:boss@company.com after:2024/01/01 has:attachment
  • HTML body — use <b>bold</b> and <br> for formatting
  • Rate limits — Gmail API allows ~250 sends/day for regular accounts
  • Batch with Loop — process multiple emails efficiently