Send cold emails
This flow automates the mass and personalized sending of promotions. First, it merges product information (manual entry) with a contacts database from Google Sheets. Subsequently, it starts a processing loop where, for each
graph TD
%%{init: {'theme': 'mc','layout': 'elk'}}%%
GSheetCellComponent-1ujen[Sheet Cells ]
style GSheetCellComponent-1ujen stroke:#a170ff
GoogleGenerativeAIModel-30xv3[Gemini]
style GoogleGenerativeAIModel-30xv3 stroke:#a170ff
GmailMesageComponent-0c0un[<div><img alt="logo" src="/_astro/gmail.CLxyIGOu.svg" style="height: 20px !important;width: 20px !important"/></div>Gmail Message]
style GmailMesageComponent-0c0un stroke:#a170ff
Prompt-dufy4[<div><img alt="logo" src="/_astro/square-terminal.BMOXc-nZ.svg" style="height: 20px !important;width: 20px !important"/></div>Prompt]
style Prompt-dufy4 stroke:#a170ff
Loop-x4kgp[Loop]
style Loop-x4kgp stroke:#a170ff
CreateData-lk556[Create Data]
style CreateData-lk556 stroke:#a170ff
Switch-4pxix[Switch]
style Switch-4pxix stroke:#a170ff
GSheetCellComponent-lry71[Sheet Cells 2]
style GSheetCellComponent-lry71 stroke:#a170ff
TextInput-qh2y0[<div><img alt="logo" src="/_astro/type.Dy26vmDy.svg" style="height: 20px !important;width: 20px !important"/></div>Text Input]
style TextInput-qh2y0 stroke:#a170ff
GoogleGenerativeAIModel-z1mmi[Gemini2]
style GoogleGenerativeAIModel-z1mmi stroke:#a170ff
Prompt-eyrkb[<div><img alt="logo" src="/_astro/square-terminal.BMOXc-nZ.svg" style="height: 20px !important;width: 20px !important"/></div>Prompt2]
style Prompt-eyrkb stroke:#a170ff
ParseData-z3lo1[<div><img alt="logo" src="/_astro/braces.Djq0PW4_.svg" style="height: 20px !important;width: 20px !important"/></div>dirección]
style ParseData-z3lo1 stroke:#a170ff
ParseData-sg4v4[<div><img alt="logo" src="/_astro/braces.Djq0PW4_.svg" style="height: 20px !important;width: 20px !important"/></div>Fin]
style ParseData-sg4v4 stroke:#a170ff
ParseData-e32rl[<div><img alt="logo" src="/_astro/braces.Djq0PW4_.svg" style="height: 20px !important;width: 20px !important"/></div>dirección2]
style ParseData-e32rl stroke:#a170ff
LoopEnd-96ajm[Loop End]
style LoopEnd-96ajm stroke:#a170ff
CreateData-lk556 -.- Loop-x4kgp
linkStyle 0 stroke:#a170ff
GSheetCellComponent-1ujen -.- Switch-4pxix
linkStyle 1 stroke:#a170ff
Switch-4pxix -.- GSheetCellComponent-lry71
linkStyle 2 stroke:#a170ff
GSheetCellComponent-lry71 -.- CreateData-lk556
linkStyle 3 stroke:#a170ff
TextInput-qh2y0 -.- CreateData-lk556
linkStyle 4 stroke:#a170ff
Loop-x4kgp -.- ParseData-z3lo1
linkStyle 5 stroke:#a170ff
Loop-x4kgp -.- ParseData-sg4v4
linkStyle 6 stroke:#a170ff
GoogleGenerativeAIModel-30xv3 -.- Prompt-eyrkb
linkStyle 7 stroke:#a170ff
Prompt-eyrkb -.- GoogleGenerativeAIModel-z1mmi
linkStyle 8 stroke:#a170ff
GoogleGenerativeAIModel-30xv3 -.- GmailMesageComponent-0c0un
linkStyle 9 stroke:#a170ff
GoogleGenerativeAIModel-z1mmi -.- GmailMesageComponent-0c0un
linkStyle 10 stroke:#a170ff
ParseData-z3lo1 -.- GmailMesageComponent-0c0un
linkStyle 11 stroke:#a170ff
Loop-x4kgp -.- ParseData-e32rl
linkStyle 12 stroke:#a170ff
ParseData-e32rl -.- Prompt-dufy4
linkStyle 13 stroke:#a170ff
Prompt-dufy4 -.- GoogleGenerativeAIModel-30xv3
linkStyle 14 stroke:#a170ff
GmailMesageComponent-0c0un -.- LoopEnd-96ajm
linkStyle 15 stroke:#a170ff
LoopEnd-96ajm -.- Loop-x4kgp
linkStyle 16 stroke:#a170ff
📄 Send Cold Emails – Workflow Documentation
🧩 Overview
The workflow automates the mass dispatch of personalised promotional emails.
It first merges a manually entered product description with a contact list stored in Google Sheets.
Then, for each unsent contact, the system generates an attractive subject line and a persuasive email body using Gemini, sends the message via Gmail, and updates the spreadsheet to mark the contact as processed.
⚙️ Main Features
- Data preparation – Combines user‑defined product details with contact information from Google Sheets.
- Conditional routing – Filters contacts that have not yet been emailed.
- AI‑powered content – Generates a subject line and HTML body with Gemini.
- Automated email delivery – Sends personalised messages through Gmail.
- State persistence – Marks each contact as sent in the spreadsheet to avoid duplicates.
🔄 Workflow Steps
| Component Name | Role in the Workflow | Key Inputs | Key Outputs |
|---|---|---|---|
| Text Input | Provides the product description used for all emails. | User‑entered product JSON. | Product text. |
| Create Data | Builds a record containing the product and a placeholder for the recipient email. | Product text. | Data object for the loop. |
| Sheet Cells | Reads the contact list from a Google Sheet. | Spreadsheet file path. | List of rows (contacts). |
| Switch | Filters rows where the “enviado” flag is no. | List of rows. | Sub‑list of unsent contacts. |
| Sheet Cells | Updates the “enviado” flag to si for each processed contact. | Current row. | Updated row (sent flag). |
| Loop | Iterates over each unsent contact. | List of unsent contacts. | Current contact row (item). |
| Parse Data (Recipient) | Extracts the recipient email address from the current row. | Current row. | Recipient email address. |
| Parse Data (Product) | Extracts the product description from the current row. | Current row. | Product text. |
| Prompt (Body) | Formats the prompt for generating the email body. | Product text. | Prompt text. |
| Gemini | Generates the HTML body of the email. | Prompt text. | Email body (HTML). |
| Prompt (Subject) | Formats the prompt for generating the subject line. | Generated email body. | Prompt text. |
| Gemini (Subject) | Generates the subject line. | Prompt text. | Subject text. |
| Gmail Message | Sends the personalised email. | Recipient address, subject, body. | Confirmation of send. |
| Loop End | Concludes the current iteration and returns to the loop start. | Confirmation of send. | Loop continuation trigger. |
🧠 Notes
- The workflow requires valid Google Sheets and Gmail credentials to access the spreadsheet and send emails.
- Gemini models are used twice: once for the email body (Gemini) and once for the subject line (Gemini 2).
- The “Switch” component ensures that each contact is emailed only once by checking the
enviadoflag. - After sending, the spreadsheet is updated to mark the contact as sent, preventing duplicate emails in subsequent runs.
- The workflow runs in batch mode, processing each contact sequentially within a single loop execution.
- All text outputs are plain strings; no code or configuration details are included.