Unwanted thread processor as waste
Based on the incoming emails, unwanted threads are disassembled.
+3
graph TD
%%{init: {'theme': 'mc','layout': 'elk'}}%%
GmailMesageComponent-2262z[<div><img alt="logo" src="/_astro/gmail.CLxyIGOu.svg" style="height: 20px !important;width: 20px !important"/></div>Obtener Mensajes]
style GmailMesageComponent-2262z stroke:#a170ff
ParseData-dkr4x[<div><img alt="logo" src="/_astro/braces.Djq0PW4_.svg" style="height: 20px !important;width: 20px !important"/></div>Obtener Datos 1]
style ParseData-dkr4x stroke:#a170ff
Prompt-qroxz[<div><img alt="logo" src="/_astro/square-terminal.BMOXc-nZ.svg" style="height: 20px !important;width: 20px !important"/></div>Consulta 1]
style Prompt-qroxz stroke:#a170ff
OpenAIModel-iocjj[<div><img alt="logo" src="/_astro/openAI.BhmuxEs3.svg" style="height: 20px !important;width: 20px !important"/></div>OpenAI]
style OpenAIModel-iocjj stroke:#a170ff
GmailThreadComponent-siyju[<div><img alt="logo" src="/_astro/gmail.CLxyIGOu.svg" style="height: 20px !important;width: 20px !important"/></div>Declarar hilo como deshecho]
style GmailThreadComponent-siyju stroke:#a170ff
ParseData-9csmb[<div><img alt="logo" src="/_astro/braces.Djq0PW4_.svg" style="height: 20px !important;width: 20px !important"/></div>Obtener Datos 2]
style ParseData-9csmb stroke:#a170ff
Prompt-k0mn8[<div><img alt="logo" src="/_astro/square-terminal.BMOXc-nZ.svg" style="height: 20px !important;width: 20px !important"/></div>Consulta 2]
style Prompt-k0mn8 stroke:#a170ff
OpenAIModel-544uh[<div><img alt="logo" src="/_astro/openAI.BhmuxEs3.svg" style="height: 20px !important;width: 20px !important"/></div>OpenAI2]
style OpenAIModel-544uh stroke:#a170ff
ChatOutput-aamor[<div><img alt="logo" src="/_astro/messages-square.BaSDmT6g.svg" style="height: 20px !important;width: 20px !important"/></div>Chat Output]
style ChatOutput-aamor stroke:#a170ff
TextInput-qers6[<div><img alt="logo" src="/_astro/type.Dy26vmDy.svg" style="height: 20px !important;width: 20px !important"/></div>Tema a comprobar]
style TextInput-qers6 stroke:#a170ff
GmailMesageComponent-2262z -.- ParseData-dkr4x
linkStyle 0 stroke:#a170ff
ParseData-dkr4x -.- Prompt-qroxz
linkStyle 1 stroke:#a170ff
Prompt-qroxz -.- OpenAIModel-iocjj
linkStyle 2 stroke:#a170ff
GmailThreadComponent-siyju -.- ParseData-9csmb
linkStyle 3 stroke:#a170ff
ParseData-9csmb -.- Prompt-k0mn8
linkStyle 4 stroke:#a170ff
Prompt-k0mn8 -.- OpenAIModel-544uh
linkStyle 5 stroke:#a170ff
OpenAIModel-544uh -.- ChatOutput-aamor
linkStyle 6 stroke:#a170ff
OpenAIModel-iocjj -.- GmailThreadComponent-siyju
linkStyle 7 stroke:#a170ff
TextInput-qers6 -.- Prompt-qroxz
linkStyle 8 stroke:#a170ff
đź§© Overview
This workflow automatically identifies and discards unwanted email threads from a Gmail inbox. It retrieves recent messages, extracts the thread ID of a specified topic, applies a “Trash” label to the thread, and then presents a concise list of the discarded emails. The process is fully automated, requiring only a single input from the user to specify the topic.
⚙️ Main Features
- Retrieves the latest emails from a Gmail inbox.
- Converts raw email data into a readable text format.
- Generates a prompt that queries the thread ID for a user‑specified topic.
- Uses an OpenAI model to obtain the thread ID and then marks that thread as unwanted.
- Re‑parses the modified thread to list all discarded messages.
- Generates a formatted list of discarded emails with an OpenAI model.
- Displays the final list in a chat‑style interface.
🔄 Workflow Steps
| Component Name | Role in the Workflow | Key Inputs | Key Outputs |
|---|---|---|---|
| Gmail Message Component | Retrieves recent emails from Gmail. | Credential, number of emails, label filter | Raw email data (messages) |
| Parse Data 1 | Formats raw email data into plain text. | Raw email data | Textual representation of emails |
| Text Input | Supplies the topic to be searched. | User‑provided text | Topic text |
| Prompt 1 | Builds a prompt that lists the emails and requests the thread ID for the specified topic. | Email text, topic text | Prompt message |
| OpenAI Model 1 | Generates the thread ID that matches the requested topic. | Prompt message | Thread ID text |
| Gmail Thread Component | Marks the identified thread as unwanted by applying a “Trash” label. | Thread ID, label settings | Updated thread data |
| Parse Data 2 | Re‑formats the updated thread data for further processing. | Updated thread data | Textual representation of the updated thread |
| Prompt 2 | Creates a prompt that lists all emails that have been discarded. | Updated thread text | Prompt message |
| OpenAI Model 2 | Produces a concise list of discarded emails. | Prompt message | List of discarded emails text |
| Chat Output | Presents the final list to the user in a chat‑style interface. | Discarded emails text | Displayed chat message |
Note – The two Parse Data components are identical in function; they simply operate on different data streams (raw messages vs. modified thread).
đź§ Notes
- The workflow requires valid Gmail credentials with permission to read and modify threads.
- An OpenAI API key is needed to access the language model for prompt generation and list extraction.
- The Gmail Thread Component can only modify existing threads; it does not create new ones.
- The “Trash” label is applied by the component; the user can later restore or permanently delete threads through Gmail.
- The system handles only text‑based prompts; attachments or images are ignored unless additional processing components are added.
- The workflow assumes the Gmail inbox contains at least the number of emails requested; otherwise it will process what is available.
- The chat‑style output is designed for the playground interface and may need adaptation for other UI contexts.