Skip to main content

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
ToEmailβœ…Recipient email address
SubjectStringβœ…Email subject line
BodyStringβœ…Email content (HTML supported)
CCEmail❌Carbon copy recipients
BCCEmail❌Blind 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 ResultsNumber❌Maximum emails to retrieve (default: 10)
LabelString❌Gmail label to filter (e.g., "INBOX", "UNREAD")
QueryString❌Gmail 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 IDStringβœ…The 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 IDStringβœ…The thread to reply to
Message IDStringβœ…The specific message to reply to
BodyStringβœ…Reply content
Reply AllBoolean❌Reply 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
QueryStringβœ…Gmail search query
Max ResultsNumber❌Maximum 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 IDStringβœ…The 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
ToEmailβœ…Recipient email
SubjectStringβœ…Email subject
BodyStringβœ…Email content
CCEmail❌Carbon copy
BCCEmail❌Blind carbon copy
Thread IDString❌For 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 ResultsNumber❌Maximum 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 IDStringβœ…The 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 IDStringβœ…The draft to delete

πŸ“‚ Get Email Thread​

Retrieve a complete email conversation thread.

Configuration​

FieldTypeRequiredDescription
Thread IDStringβœ…The 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