Gmail Write Labels
Create, modify, and manage Gmail labels programmatically
Node Type
Action
Category
Gmail Integration
Icon
Gmail
Overview
The Gmail Write Labels node allows you to create, update, and manage Gmail labels programmatically. This powerful automation tool integrates with Gmail's API to provide intelligent email organization capabilities.
Key Features
- • Dynamic Label Creation: Create labels based on workflow logic
- • Custom Styling: Set background and text colors for visual organization
- • Smart Visibility: Control how labels appear in Gmail interface
- • Error Handling: Built-in success/failure tracking
- • Real-time Updates: Labels are created instantly in your Gmail account
Prerequisites
Google Integration
Must be connected to access Gmail API
Required Scopes
https://www.googleapis.com/auth/gmail.labels
https://www.googleapis.com/auth/gmail.modify
Node Configuration
Required Fields
labelName
Name of the label to create or modify. Use descriptive names for better organization.
labelType
Type of label to create. User labels are customizable, system labels are predefined.
Optional Fields
backgroundColor
Hex color code for the label background (e.g., "#4285f4" for Google Blue).
textColor
Hex color code for the label text (e.g., "#ffffff" for white).
messageListVisibility
Controls whether the label is visible in the message list.
labelListVisibility
Controls whether the label appears in the label list sidebar.
Examples & Use Cases
Basic Label Creation
Create a simple label with default settings
{
"labelName": "Work",
"labelType": "user",
"backgroundColor": "#4285f4",
"textColor": "#ffffff"
}
Creates a blue "Work" label that will be visible in both the message list and label sidebar.
Dynamic Label Based on Email Content
Create labels based on AI analysis of email content
{
"labelName": "{{aiAnalysis.isImportant ? 'Important' : 'Regular'}}",
"labelType": "user",
"backgroundColor": "{{aiAnalysis.isImportant ? '#ea4335' : '#34a853'}}",
"textColor": "#ffffff",
"messageListVisibility": "show",
"labelListVisibility": "labelShow"
}
Creates either an "Important" (red) or "Regular" (green) label based on AI analysis results.
Domain-Based Labeling
Create labels based on email sender domain
{
"labelName": "{{emailTrigger.senderDomain}}",
"labelType": "user",
"backgroundColor": "#9c27b0",
"textColor": "#ffffff"
}
Creates a label named after the sender's domain (e.g., "gmail.com", "company.com").
Workflow Examples
Auto-label Important Emails
Complete workflow for intelligent email organization
Workflow Structure
Step-by-Step Configuration
- Email Trigger: Configure to trigger on new email arrival
- AI Analysis: Analyze email content for importance indicators
- Gmail Write Labels: Create appropriate label based on analysis
- Conditional Logic: Handle success/failure scenarios
Project-Based Email Organization
Organize emails by project or client automatically
Use Case
Automatically create and apply project-specific labels based on email content, sender information, or keywords in the subject line.
Implementation
- Extract project keywords from email content
- Create dynamic label names (e.g., "Project-ProjectName")
- Use consistent color coding for project categories
- Apply labels to organize related emails
Best Practices
Do's
- • Use consistent naming conventions
- • Implement a logical color scheme
- • Always check the success output field
- • Handle errors gracefully
- • Use descriptive label names
- • Consider label hierarchy and organization
Don'ts
- • Don't create labels in rapid succession
- • Avoid overly long label names
- • Don't ignore API rate limits
- • Avoid creating duplicate labels
- • Don't use special characters in names
- • Avoid creating too many labels
Troubleshooting
Common Issues
Authentication Errors
Symptoms: Node fails with permission denied errors
Solution: Ensure Google integration is properly connected and Gmail labels scope is granted
Label Already Exists
Symptoms: Node succeeds but label isn't created
Solution: Check if label exists before creating, or handle gracefully in your workflow
API Rate Limits
Symptoms: Node fails intermittently with quota exceeded errors
Solution: Implement delays between label creation operations and monitor API usage