Streamline your inbox management using this advanced n8n workflow. Automatically analyze incoming Gmail messages with OpenAI to apply relevant labels like 'Inquiry' or 'Partnership'. Perfect for efficient n8n templates.
Download this n8n workflow template and start using it instantly.
Managing a high volume of emails requires efficient categorization, but manual labeling is time-consuming. This specialized n8n workflow solves this by integrating a large language model (LLM) to perform the categorization automatically.
When a new email arrives, this n8n automation fetches the content, feeds it to the OpenAI n8n node, and receives a structured categorization (e.g., 'Partnership' or 'Inquiry'). It then uses the resulting label names to find the corresponding Gmail label IDs and applies them to the original message. This results in a clean, categorized inbox without human intervention. This entire process showcases the power of building complex logic using various n8n node types.
This high-utility n8n workflow executes in several distinct phases:
Assign labels for message n8n node (a specialized LLM Chain). This chain is composed of the OpenAI Chat model (gpt-4o-mini) and a structured JSON Parser n8n node.Set n8n node extracts this AI-assigned label array. Simultaneously, a separate Gmail n8n node fetches a complete list of all existing Gmail labels and their corresponding unique IDs.Split Out n8n node to separate the assigned labels into individual items. These are then combined with the list of all available labels using the Merge corresponding labels n8n node, matching the label name with the official Gmail ID.Aggregate n8n node collects all the newly matched Gmail IDs into a final array structure. The workflow concludes by sending this ID array back to a Gmail n8n node, which executes the addLabels operation on the original email message ID, completing the n8n automation cycle.To successfully deploy this powerful n8n workflow, follow these steps:
Gmail trigger and all subsequent Gmail n8n node operations. Ensure these credentials have adequate scopes to read messages and manage labels.OpenAI Chat n8n node.Assign labels for message n8n node and the JSON Schema in the JSON Parser n8n node to customize or confirm the target label names.Gmail trigger to begin automated polling. Gmail trigger: This is the starting n8n node. It monitors your inbox for new incoming messages, providing the initial message metadata.
Get message content (Gmail): Uses the message ID provided by the trigger to fetch the complete body and content of the incoming email, preparing it for AI analysis.
Assign labels for message (Chain LLM): The intelligence core of this n8n workflow. This LangChain n8n node orchestrates the LLM interaction and passes the email text for categorization based on a strict system prompt.
OpenAI Chat: The specific LLM used (configured as gpt-4o-mini) to perform the content classification.
JSON Parser (Output Parser Structured): Ensures the AI's textual output is converted into a reliable, structured JSON object with the required labels array key, enforcing the desired output format for this n8n automation.
Get all labels (Gmail): Fetches all user-defined labels from Gmail, which is necessary to retrieve the unique id required for updating messages.
Merge corresponding labels (Merge): A vital n8n node that matches the AI-assigned label names (strings) with the actual Gmail label IDs (the identifiers required by the Gmail API), enabling the final update step.
Add labels to message (Gmail): The final Gmail n8n node operation. It applies the aggregated list of official Gmail label IDs back to the original message, concluding the n8n workflow.
Automate daily sales reporting using this powerful n8n workflow. Pull data from Google Sheets, generate metrics analysis via Google Gemini, and instantly notify teams via Gmail and Telegram. Perfect for sales operations.

Automate the creation of SEO-optimized product comparison ("vs") pages using this advanced n8n workflow. Combines Google Sheets data, OpenAI content generation, and direct CMS publishing.

Use this powerful n8n workflow to automate LinkedIn content creation. It combines Anthropic (Claude), Perplexity AI for research, and OpenAI for branded image generation, storing and publishing content automatically.

Use this advanced n8n workflow to automatically scrape and like Instagram posts from target profiles via Phantombuster, featuring intelligent cookie rotation via OpenAI and duplicate checking using SharePoint.

This advanced n8n workflow template uses OpenAI to generate dynamic LinkedIn search terms, Phantombuster for automated scraping and liking, and SharePoint for session and history management.








































