Mail reader
This flow is used to format Gmail messages following a template.
graph TD
%%{init: {'theme': 'mc','layout': 'elk'}}%%
GmailMesageComponent-bmwjc[<div><img alt="logo" src="/_astro/gmail.CLxyIGOu.svg" style="height: 20px !important;width: 20px !important"/></div>Google Gmail Message]
style GmailMesageComponent-bmwjc stroke:#a170ff
ParseData-xilwf[<div><img alt="logo" src="/_astro/braces.Djq0PW4_.svg" style="height: 20px !important;width: 20px !important"/></div>Parse Data]
style ParseData-xilwf stroke:#a170ff
Prompt-w8v41[<div><img alt="logo" src="/_astro/square-terminal.BMOXc-nZ.svg" style="height: 20px !important;width: 20px !important"/></div>Prompt]
style Prompt-w8v41 stroke:#a170ff
TextOutput-tafyq[<div><img alt="logo" src="/_astro/type.Dy26vmDy.svg" style="height: 20px !important;width: 20px !important"/></div>Text Output]
style TextOutput-tafyq stroke:#a170ff
GmailMesageComponent-bmwjc -.- ParseData-xilwf
linkStyle 0 stroke:#a170ff
ParseData-xilwf -.- Prompt-w8v41
linkStyle 1 stroke:#a170ff
Prompt-w8v41 -.- TextOutput-tafyq
linkStyle 2 stroke:#a170ff
đź“„ Mail Reader Workflow Documentation
đź§© Overview
This workflow retrieves email messages from a Gmail account, converts the raw data into plain text, constructs a prompt from that text, and then displays the prompt in the playground. It automates the end‑to‑end processing of Gmail messages, enabling quick template‑based summarisation or further AI interactions without manual copy‑paste.
⚙️ Main Features
- Automated Gmail Retrieval – Pulls a configurable number of emails from a Gmail label or query.
- Data Parsing – Transforms email content and metadata into a clean, template‑formatted text block.
- Prompt Construction – Dynamically builds a prompt message that can be fed to downstream AI models.
- Immediate Output – Renders the final prompt text in the playground for instant inspection.
🔄 Workflow Steps
| Component Name | Role in the Workflow | Key Inputs | Key Outputs |
|---|---|---|---|
| Google Gmail Message | Fetches emails from Gmail and supplies raw data to the pipeline. | Gmail credentials, number of emails to read, optional query or label, fetch‑attachments flag, process‑attachments flag, enable‑OCR flag, mapping‑mode toggle. | Raw email data (structured records) |
| Parse Data | Converts the raw email data into a plain‑text representation according to a user‑defined template. | Email data, template string (e.g., {text}), separator character, optional metadata keys and schema. |
Formatted text block; processed data dictionary (metadata included) |
| Prompt | Builds a prompt message by injecting the parsed text into a prompt template. | Parsed text (Message), optional prompt template string. | Prompt message (Message) |
| Text Output | Displays the final prompt in the playground for review. | Prompt message (Message). | Rendered text shown to the user |
đź§ Notes
- The workflow requires a valid Google OAuth credential set for the Gmail account.
- By default it reads ten emails unless the Number of Emails to read is overridden.
- The Fetch Attachments and Process Attachments flags enable optional download and text extraction from attachments (PDF, DOCX, image files if OCR is enabled).
- Mapping mode can be activated to process multiple email records in a batch, producing a separate prompt for each record.
- Metadata keys specified in Metadata keys are added to the processed data output; a JSON schema can rename these keys if desired.
- The prompt template is highly flexible: any placeholders matching keys in the parsed text (e.g.,
{subject},{body}) can be used. - The final text output component simply renders the constructed prompt; no further action is taken within this workflow.