Clasificador de Correo Inteligente
Sistema de automatización inteligente que utiliza el modelo Gemini para analizar el contenido de los correos entrantes y categorizarlos automáticamente. Mediante un procesamiento de lenguaje natural, eYour Business Conversations.
graph TD
%%{init: {'theme': 'mc','layout': 'elk'}}%%
GmailMesageComponent-hy2ma[<div><img src="/_astro/gmail.CLxyIGOu.svg" style="height: 20px !important;width: 20px !important"/></div>Gmail Message]
style GmailMesageComponent-hy2ma stroke:#a170ff
GoogleGenerativeAIModel-vgbbh[Gemini]
style GoogleGenerativeAIModel-vgbbh stroke:#a170ff
GmailMesageComponent-b2dd1[<div><img src="/_astro/gmail.CLxyIGOu.svg" style="height: 20px !important;width: 20px !important"/></div>VENTA]
style GmailMesageComponent-b2dd1 stroke:#a170ff
Prompt-yx16c[<div><img src="/_astro/square-terminal.BMOXc-nZ.svg" style="height: 20px !important;width: 20px !important"/></div>Prompt]
style Prompt-yx16c stroke:#a170ff
Switch-ml52o[Switch]
style Switch-ml52o stroke:#a170ff
GmailMesageComponent-dzaho[<div><img src="/_astro/gmail.CLxyIGOu.svg" style="height: 20px !important;width: 20px !important"/></div>IMPORTANTE]
style GmailMesageComponent-dzaho stroke:#a170ff
GmailMesageComponent-gsepm[<div><img src="/_astro/gmail.CLxyIGOu.svg" style="height: 20px !important;width: 20px !important"/></div>URGENTE]
style GmailMesageComponent-gsepm stroke:#a170ff
GmailMesageComponent-imh3h[<div><img src="/_astro/gmail.CLxyIGOu.svg" style="height: 20px !important;width: 20px !important"/></div>NORMAL]
style GmailMesageComponent-imh3h stroke:#a170ff
CreateData-j2wcd[Create Data]
style CreateData-j2wcd stroke:#a170ff
Prompt-yx16c -.- GoogleGenerativeAIModel-vgbbh
linkStyle 0 stroke:#a170ff
Switch-ml52o -.- GmailMesageComponent-dzaho
linkStyle 1 stroke:#a170ff
Switch-ml52o -.- GmailMesageComponent-gsepm
linkStyle 2 stroke:#a170ff
Switch-ml52o -.- GmailMesageComponent-imh3h
linkStyle 3 stroke:#a170ff
GoogleGenerativeAIModel-vgbbh -.- CreateData-j2wcd
linkStyle 4 stroke:#a170ff
CreateData-j2wcd -.- Switch-ml52o
linkStyle 5 stroke:#a170ff
Switch-ml52o -.- GmailMesageComponent-b2dd1
linkStyle 6 stroke:#a170ff
GmailMesageComponent-hy2ma -.- Prompt-yx16c
linkStyle 7 stroke:#a170ff
Clasificador de Correo Inteligente
🧩 Overview
This workflow automates the intelligent classification of incoming emails in a Gmail account. It leverages the Gemini AI model to analyze email content and automatically assign one of four priority-based labels. This process helps streamline email management by sorting communications into actionable categories without manual intervention, ensuring important messages are highlighted and organized efficiently.
⚙️ Main Features
- Automatically fetches unlabeled emails from a connected Gmail account on a scheduled basis.
- Analyzes the full text of each email using the Gemini AI model to determine its context and intent.
- Classifies emails into four distinct categories: VENTA (Sales), IMPORTANTE (Important), URGENTE (Urgent), and NORMAL (Normal).
- Dynamically routes each email to the appropriate labeling action based on the AI's classification.
- Applies the corresponding Gmail label and a universal "ETIQUETADO" (Labeled) tag to each processed email.
🔄 Workflow Steps
| Component Name | Role in the Workflow | Key Inputs | Key Outputs |
|---|---|---|---|
| Gmail Message | Email Ingestion: Fetches a batch of emails from the connected Gmail account that do not have the "ETIQUETADO" label. | Gmail query to filter unlabeled emails. | A list of email data, including the message body and unique ID. |
| Prompt | Instruction Preparation: Formats the email text into a structured prompt with clear instructions for the AI model. | The raw text content of each email. | A prepared prompt message ready for the AI model. |
| Gemini | Content Analysis: Processes the prompt using the Gemini model to evaluate the email's context and assign a single category. | The formatted prompt containing the email text. | A text output containing only the assigned category keyword (e.g., VENTA, URGENTE). |
| Create Data | Data Structuring: Packages the AI's classification result with the original email ID into a structured data object. | The AI-generated category and the original email ID. | A structured data record linking the email ID to its suggested label. |
| Switch | Conditional Routing: Acts as a logical router, inspecting the suggested label in each data record and directing the flow to the corresponding output path. | The structured data record containing the email ID and label. | Routes the data to one of four outputs based on the label value. |
| Gmail Message (VENTA) | Label Application (Sales): Applies the "VENTA" and "ETIQUETADO" labels to emails routed from the corresponding Switch case. | The email ID for messages classified as sales-related. | Confirmation of the label update operation in Gmail. |
| Gmail Message (IMPORTANTE) | Label Application (Important): Applies the "IMPORTANTE" and "ETIQUETADO" labels to emails routed from the corresponding Switch case. | The email ID for messages classified as important. | Confirmation of the label update operation in Gmail. |
| Gmail Message (URGENTE) | Label Application (Urgent): Applies the "URGENTE" and "ETIQUETADO" labels to emails routed from the corresponding Switch case. | The email ID for messages classified as urgent. | Confirmation of the label update operation in Gmail. |
| Gmail Message (NORMAL) | Label Application (Normal): Applies the "NORMAL" and "ETIQUETADO" labels to emails routed from the corresponding Switch case. | The email ID for messages classified as normal/routine. | Confirmation of the label update operation in Gmail. |
🧠 Notes
- The workflow is designed to run in batch mode, processing multiple emails in parallel for efficiency.
- It requires valid credentials for both Google Gmail (to access emails) and the Google AI API (for the Gemini model).
- The classification logic is defined within the Prompt component's instructions, which enforce a strict, single-keyword response from the AI.
- The system skips emails already tagged with "ETIQUETADO," preventing re-processing of the same messages.
- The priority order for classification, as defined in the prompt, is: URGENTE > IMPORTANTE > VENTA > NORMAL.