Create Gmail Labels
Automate the creation of intelligent Gmail labels by analyzing email content and patterns for better organization of your inbox.
Last updated
October 1, 2025
Connectors used
Tags
Key Takeaways
- AI-driven label suggestions - GPT-4.1 analyzes your recent emails and suggests relevant, business-focused labels you may not have thought of
- Considers existing labels - The workflow fetches your current Gmail labels and merges them with AI suggestions to avoid redundancy
- Creates labels automatically - New labels are created directly in your Gmail account, ready to use
- Triggered manually - You run this workflow when you want a fresh set of label recommendations based on your latest emails
What This Workflow Does
This workflow reads your recent Gmail messages (up to 60), uses AI to analyze patterns in their subjects and snippets, and suggests a set of business-related labels. It also fetches your existing Gmail labels so the AI can factor them in. A final AI step produces seven unique, lowercase labels, which are then automatically created in your Gmail account.
Use cases:
- Setting up label categories for a new Gmail account or workspace
- Discovering label ideas based on the types of emails you actually receive
- Reorganizing your inbox with labels that reflect your current email patterns
How It Works
| Step | What Happens |
|---|---|
| 1. Manual Trigger | You start the workflow when you want new label suggestions |
| 2. Find Emails | The Gmail Find Email node fetches up to 60 recent emails (subject and snippet only) |
| 3. Filter Emails | A code node filters out specific senders you want to exclude |
| 4. Transform | Extracts subject and snippet from each email for AI analysis |
| 5. AI Suggest Labels | GPT-4.1 analyzes the email content and suggests appropriate labels |
| 6. List Existing Labels | The Gmail List Labels node fetches your current Gmail labels in parallel |
| 7. Merge | Combines the AI suggestions with the existing labels list |
| 8. AI Final Labels | GPT-4.1 considers both inputs and produces a final list of 7 unique, lowercase, business-related labels |
| 9. Transform Parse | Parses the JSON array of label names |
| 10. Create Labels | Each label is created in Gmail via the Create Label node |
Workflow Nodes
| Node | Role |
|---|---|
| Manual Trigger | Starts the workflow on demand |
| Find Email (Gmail) | Fetches up to 60 recent emails, returning subject and snippet |
| Code (Filter) | Filters out specific senders you want to exclude from analysis |
| Transform (Extract) | Extracts subject and snippet fields from each email |
| AI Suggest Labels (GPT-4.1) | Analyzes email content and suggests labels based on patterns (temperature 0.7) |
| List Labels (Gmail) | Fetches existing Gmail labels for comparison |
| Merge | Combines suggested labels with existing labels |
| AI Final Labels (GPT-4.1) | Produces a final list of 7 unique, lowercase business labels (temperature 0.7) |
| Transform Parse | Parses the JSON string into an array of label names |
| Create Label (Gmail) | Creates each label in your Gmail account |
Setup Instructions
- Add the "Create Gmail Labels" template to your Needle workspace
- Connect your Gmail account by creating a Gmail connector and selecting it in the Find Email, List Labels, and Create Label nodes
- Optionally edit the filter code node to exclude or include specific senders
- Run the workflow manually to generate and create labels
Customization
| What You Can Change | How |
|---|---|
| Number of emails analyzed | Adjust the limit in the Find Email node (default: 60) |
| Excluded senders | Edit the code filter node to add or remove sender addresses |
| Number of labels created | Change the AI Final Labels prompt to produce more or fewer than 7 labels |
| Label style | Edit the AI prompts to request nested labels (e.g., "work/projects"), uppercase labels, or different naming conventions |
| Excluded label types | Add unwanted label categories to the exclusion list in the AI Final Labels prompt |
| AI model | Swap the model in either AI node if you prefer a different provider |
FAQ
Q: Will this overwrite my existing Gmail labels? A: No. The workflow only creates new labels. It does not modify or delete existing ones.
Q: Why does it only create 7 labels? A: The default AI prompt asks for 7 unique business-related labels to keep things focused. You can change this number in the AI Final Labels prompt.
Q: Can I run this repeatedly to get fresh suggestions? A: Yes. Each run analyzes your latest emails and existing labels, so suggestions will evolve as your email patterns change. Labels that already exist in Gmail will not be duplicated.
Q: What kinds of labels does the AI suggest? A: The prompt specifically requests business-related identifying labels (like "sales", "product", "appointment") rather than generic status labels. It also excludes categories like "job offer", "order confirmation", and "business" by default.
Want to showcase your own workflows?
Become a Needle workflow partner and turn your expertise into recurring revenue.