Перейти к основному содержимому

Gmail Actions

Automate your email workflows with comprehensive Gmail actions. Send emails, manage drafts, search your inbox, and handle email threads — all within SmartFlow.

Gmail SmartFlow Actions


Prerequisites

Before using Gmail actions, you must:

  1. Connect your Gmail account in Channels → Gmail
  2. Authorize the required permissions via Google OAuth

See Gmail Channel Setup for detailed connection instructions.


Available Triggers

📥 Gmail AI Draft

Trigger Type: CHAT_SERVICE

Triggered when a user sends an email to your connected Gmail instance. Use this to automatically process incoming emails with AI.

FieldDescription
ChannelGmail
EventNew email received

Example Workflow:

Gmail AI Draft (Trigger)

AI Request (Analyze email content)

Create Gmail Draft (Generate AI response)

Available Actions

ActionCodeDescription
📤 Send Gmail EmailGMAIL_SEND_EMAILSend a new email directly
📬 Read Gmail EmailsGMAIL_READ_EMAILSFetch emails from your inbox
📧 Get Gmail EmailGMAIL_GET_EMAILGet a specific email by ID
↩️ Reply to Gmail EmailGMAIL_REPLYReply to an existing email thread
🔍 Search Gmail EmailsGMAIL_SEARCHSearch emails with Gmail query syntax
Mark Gmail Email as ReadGMAIL_MARK_READMark an email as read
📝 Create Gmail DraftGMAIL_CREATE_DRAFTCreate a new email draft
📋 List Gmail DraftsGMAIL_LIST_DRAFTSList all drafts in your account
📨 Send Gmail DraftGMAIL_SEND_DRAFTSend an existing draft
🗑️ Delete Gmail DraftGMAIL_DELETE_DRAFTDelete a draft
📂 Get Email ThreadGMAIL_GET_THREADRetrieve full email conversation

📤 Send Gmail Email

Send a new email directly from your connected Gmail account.

Configuration

FieldTypeRequiredDescription
ToEmailRecipient email address
SubjectStringEmail subject line
BodyStringEmail content (HTML supported)
CCEmailCarbon copy recipients
BCCEmailBlind carbon copy recipients

Output Variables

VariableTypeDescription
messageIdStringUnique ID of sent email
threadIdStringThread ID for replies

Example

Action: Send Gmail Email
To: "{{customer_email}}"
Subject: "Your order #{{order_id}} has shipped!"
Body: |
Hi {{customer_name}},

Great news! Your order has shipped.

Tracking number: {{tracking_number}}

Best regards,
The Team

📬 Read Gmail Emails

Fetch recent emails from your inbox with optional filtering.

Configuration

FieldTypeRequiredDescription
Max ResultsNumberMaximum emails to retrieve (default: 10)
LabelStringGmail label to filter (e.g., "INBOX", "UNREAD")
QueryStringGmail search query

Output Variables

VariableTypeDescription
emailsArrayList of email objects
emails[].idStringEmail ID
emails[].subjectStringEmail subject
emails[].fromStringSender email
emails[].snippetStringEmail preview
emails[].dateStringReceived date

Example

Action: Read Gmail Emails
Max Results: 5
Label: "UNREAD"
Query: "from:support@example.com"

📧 Get Gmail Email

Retrieve a specific email by its ID with full content.

Configuration

FieldTypeRequiredDescription
Email IDStringThe Gmail message ID

Output Variables

VariableTypeDescription
emailObjectFull email object
email.idStringEmail ID
email.threadIdStringThread ID
email.subjectStringEmail subject
email.fromStringSender
email.toStringRecipients
email.bodyStringFull email body
email.dateStringDate received
email.attachmentsArrayList of attachments

↩️ Reply to Gmail Email

Reply to an existing email, maintaining the thread context.

Configuration

FieldTypeRequiredDescription
Thread IDStringThe thread to reply to
Message IDStringThe specific message to reply to
BodyStringReply content
Reply AllBooleanReply to all recipients (default: false)

Output Variables

VariableTypeDescription
messageIdStringID of the reply
threadIdStringThread ID

Example

Action: Reply to Gmail Email
Thread ID: "{{email.threadId}}"
Message ID: "{{email.id}}"
Body: |
{{ai_response}}

---
This is an AI-assisted response.

🔍 Search Gmail Emails

Search your Gmail using Gmail's powerful query syntax.

Configuration

FieldTypeRequiredDescription
QueryStringGmail search query
Max ResultsNumberMaximum results (default: 10)

Gmail Query Syntax

QueryDescription
from:email@example.comEmails from specific sender
to:email@example.comEmails to specific recipient
subject:keywordSubject contains keyword
is:unreadUnread emails only
is:starredStarred emails
has:attachmentEmails with attachments
after:2025/01/01Emails after date
before:2025/12/31Emails before date
label:importantEmails with label
"exact phrase"Exact phrase match

Example

Action: Search Gmail Emails
Query: "from:{{customer_email}} is:unread subject:order"
Max Results: 5

✅ Mark Gmail Email as Read

Mark an email as read in Gmail.

Configuration

FieldTypeRequiredDescription
Email IDStringThe email to mark as read

Example

Action: Mark Gmail Email as Read
Email ID: "{{email.id}}"

📝 Create Gmail Draft

Create a draft email for human review before sending.

Configuration

FieldTypeRequiredDescription
ToEmailRecipient email
SubjectStringEmail subject
BodyStringEmail content
CCEmailCarbon copy
BCCEmailBlind carbon copy
Thread IDStringFor draft replies

Output Variables

VariableTypeDescription
draftIdStringID of created draft
messageIdStringMessage ID

Use Case: AI Draft Mode

Trigger: Gmail AI Draft

AI Request:
Prompt: "Generate a professional response to this email"
Input: "{{email.body}}"

Create Gmail Draft:
To: "{{email.from}}"
Subject: "Re: {{email.subject}}"
Body: "{{ai_response}}"

📋 List Gmail Drafts

Retrieve all drafts from your Gmail account.

Configuration

FieldTypeRequiredDescription
Max ResultsNumberMaximum drafts to list

Output Variables

VariableTypeDescription
draftsArrayList of draft objects
drafts[].idStringDraft ID
drafts[].messageObjectDraft message preview

📨 Send Gmail Draft

Send an existing draft from your Gmail.

Configuration

FieldTypeRequiredDescription
Draft IDStringThe draft to send

Output Variables

VariableTypeDescription
messageIdStringID of sent message
threadIdStringThread ID

🗑️ Delete Gmail Draft

Delete a draft from your Gmail account.

Configuration

FieldTypeRequiredDescription
Draft IDStringThe draft to delete

📂 Get Email Thread

Retrieve a complete email conversation thread.

Configuration

FieldTypeRequiredDescription
Thread IDStringThe thread to retrieve

Output Variables

VariableTypeDescription
threadObjectFull thread object
thread.idStringThread ID
thread.messagesArrayAll messages in thread
thread.historyIdStringHistory ID

Example

Action: Get Email Thread
Thread ID: "{{email.threadId}}"

Complete Workflow Examples

Example 1: AI Email Assistant

Automatically process incoming emails and create AI-generated draft responses.

Gmail AI Draft (Trigger)

Get Email Thread (Get full context)

AI Request
- System: "You are a helpful email assistant"
- Input: "{{thread.messages}}"
- Output: Structured (response, sentiment, urgency)

If Condition: urgency == "high"
├── Yes: Send Gmail Email (immediate response)
└── No: Create Gmail Draft (for review)

Example 2: Email Search & Process

Search for specific emails and process them in bulk.

Scheduled Workflow (Daily at 9 AM)

Search Gmail Emails
Query: "is:unread from:customers@* after:yesterday"

For Each: email in emails

AI Request (Categorize email)

If Condition: category == "support"
└── Create JIRA Issue

Example 3: Draft Review Workflow

Create drafts, let humans review, then send.

Gmail AI Draft (Trigger)

AI Request (Generate response)

Create Gmail Draft

Send Slack Message
"New draft ready for review from {{email.from}}"

Best Practices

1. Use Draft Mode for Critical Emails

For customer-facing or sensitive emails, always use Create Gmail Draft instead of Send Gmail Email. This allows human review before sending.

2. Leverage Thread Context

Use Get Email Thread before responding to ensure your AI has full conversation context.

3. Implement Rate Limiting

Gmail has API quotas. For high-volume workflows:

  • Add delays between actions
  • Batch operations when possible
  • Monitor your quota usage

4. Use Smart Search Queries

Combine Gmail query operators for precise filtering:

from:vip-customer@* is:unread subject:(urgent OR critical) after:2025/01/01

5. Handle Errors Gracefully

Use If Condition nodes to check for errors and implement fallback logic.


Ready to elevate your
user experience?

Deploy AI assistants that delight customers and scale with your business.

GDPR Compliant