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

Prerequisitesβ
Before using Gmail actions, you must:
- Connect your Gmail account in Channels β Gmail
- 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.
| Field | Description |
|---|---|
| Channel | Gmail |
| Event | New email received |
Example Workflow:
Gmail AI Draft (Trigger)
β
AI Request (Analyze email content)
β
Create Gmail Draft (Generate AI response)
Available Actionsβ
| Action | Code | Description |
|---|---|---|
| π€ Send Gmail Email | GMAIL_SEND_EMAIL | Send a new email directly |
| π¬ Read Gmail Emails | GMAIL_READ_EMAILS | Fetch emails from your inbox |
| π§ Get Gmail Email | GMAIL_GET_EMAIL | Get a specific email by ID |
| β©οΈ Reply to Gmail Email | GMAIL_REPLY | Reply to an existing email thread |
| π Search Gmail Emails | GMAIL_SEARCH | Search emails with Gmail query syntax |
| β Mark Gmail Email as Read | GMAIL_MARK_READ | Mark an email as read |
| π Create Gmail Draft | GMAIL_CREATE_DRAFT | Create a new email draft |
| π List Gmail Drafts | GMAIL_LIST_DRAFTS | List all drafts in your account |
| π¨ Send Gmail Draft | GMAIL_SEND_DRAFT | Send an existing draft |
| ποΈ Delete Gmail Draft | GMAIL_DELETE_DRAFT | Delete a draft |
| π Get Email Thread | GMAIL_GET_THREAD | Retrieve full email conversation |
π€ Send Gmail Emailβ
Send a new email directly from your connected Gmail account.
Configurationβ
| Field | Type | Required | Description |
|---|---|---|---|
| To | β | Recipient email address | |
| Subject | String | β | Email subject line |
| Body | String | β | Email content (HTML supported) |
| CC | β | Carbon copy recipients | |
| BCC | β | Blind carbon copy recipients |
Output Variablesβ
| Variable | Type | Description |
|---|---|---|
messageId | String | Unique ID of sent email |
threadId | String | Thread 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β
| Field | Type | Required | Description |
|---|---|---|---|
| Max Results | Number | β | Maximum emails to retrieve (default: 10) |
| Label | String | β | Gmail label to filter (e.g., "INBOX", "UNREAD") |
| Query | String | β | Gmail search query |
Output Variablesβ
| Variable | Type | Description |
|---|---|---|
emails | Array | List of email objects |
emails[].id | String | Email ID |
emails[].subject | String | Email subject |
emails[].from | String | Sender email |
emails[].snippet | String | Email preview |
emails[].date | String | Received 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β
| Field | Type | Required | Description |
|---|---|---|---|
| Email ID | String | β | The Gmail message ID |
Output Variablesβ
| Variable | Type | Description |
|---|---|---|
email | Object | Full email object |
email.id | String | Email ID |
email.threadId | String | Thread ID |
email.subject | String | Email subject |
email.from | String | Sender |
email.to | String | Recipients |
email.body | String | Full email body |
email.date | String | Date received |
email.attachments | Array | List of attachments |
β©οΈ Reply to Gmail Emailβ
Reply to an existing email, maintaining the thread context.
Configurationβ
| Field | Type | Required | Description |
|---|---|---|---|
| Thread ID | String | β | The thread to reply to |
| Message ID | String | β | The specific message to reply to |
| Body | String | β | Reply content |
| Reply All | Boolean | β | Reply to all recipients (default: false) |
Output Variablesβ
| Variable | Type | Description |
|---|---|---|
messageId | String | ID of the reply |
threadId | String | Thread 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β
| Field | Type | Required | Description |
|---|---|---|---|
| Query | String | β | Gmail search query |
| Max Results | Number | β | Maximum results (default: 10) |
Gmail Query Syntaxβ
| Query | Description |
|---|---|
from:email@example.com | Emails from specific sender |
to:email@example.com | Emails to specific recipient |
subject:keyword | Subject contains keyword |
is:unread | Unread emails only |
is:starred | Starred emails |
has:attachment | Emails with attachments |
after:2025/01/01 | Emails after date |
before:2025/12/31 | Emails before date |
label:important | Emails 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β
| Field | Type | Required | Description |
|---|---|---|---|
| Email ID | String | β | 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β
| Field | Type | Required | Description |
|---|---|---|---|
| To | β | Recipient email | |
| Subject | String | β | Email subject |
| Body | String | β | Email content |
| CC | β | Carbon copy | |
| BCC | β | Blind carbon copy | |
| Thread ID | String | β | For draft replies |
Output Variablesβ
| Variable | Type | Description |
|---|---|---|
draftId | String | ID of created draft |
messageId | String | Message 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β
| Field | Type | Required | Description |
|---|---|---|---|
| Max Results | Number | β | Maximum drafts to list |
Output Variablesβ
| Variable | Type | Description |
|---|---|---|
drafts | Array | List of draft objects |
drafts[].id | String | Draft ID |
drafts[].message | Object | Draft message preview |
π¨ Send Gmail Draftβ
Send an existing draft from your Gmail.
Configurationβ
| Field | Type | Required | Description |
|---|---|---|---|
| Draft ID | String | β | The draft to send |
Output Variablesβ
| Variable | Type | Description |
|---|---|---|
messageId | String | ID of sent message |
threadId | String | Thread ID |
ποΈ Delete Gmail Draftβ
Delete a draft from your Gmail account.
Configurationβ
| Field | Type | Required | Description |
|---|---|---|---|
| Draft ID | String | β | The draft to delete |
π Get Email Threadβ
Retrieve a complete email conversation thread.
Configurationβ
| Field | Type | Required | Description |
|---|---|---|---|
| Thread ID | String | β | The thread to retrieve |
Output Variablesβ
| Variable | Type | Description |
|---|---|---|
thread | Object | Full thread object |
thread.id | String | Thread ID |
thread.messages | Array | All messages in thread |
thread.historyId | String | History 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.