What This Agent Does
This intelligent workflow automates the process of generating and tracking personalized cold emails for your sales leads. It reads lead information from a Google Sheet, uses AI to craft compelling, customized email content and subject lines for each prospect, and automatically updates your spreadsheet with the generated content and tracking information. The entire process runs hands-free once configured, ensuring consistent outreach quality while eliminating hours of manual email writing.
Key benefits include:
-
Save 10+ hours per week on email composition and lead tracking
-
Improve response rates with AI-generated, personalized messaging tailored to each prospect
-
Maintain perfect records with automatic tracking of email content, subject lines, and send dates
-
Scale your outreach effortlessly without sacrificing personalization quality
-
Prevent duplicate sends with built-in processing checks
Perfect for: Sales teams managing cold outreach campaigns, business development professionals nurturing lead pipelines, marketing teams running personalized email sequences, and entrepreneurs building their customer base through direct outreach.
Who Is It For
This workflow is designed for sales professionals, business development teams, and marketers who need to send personalized cold emails at scale. Whether you're a solo entrepreneur reaching out to 50 prospects or a sales team managing hundreds of leads, this automation handles the heavy lifting of email composition while maintaining the personal touch that drives responses.
It's particularly valuable if you:
- Spend hours each week writing similar but personalized cold emails
- Struggle to maintain consistency in your outreach messaging
- Need to track which leads have been contacted and when
- Want to leverage AI for better email copy without losing your brand voice
- Manage lead lists in Google Sheets and need seamless integration
No coding experience required—just follow the setup steps and let the automation work for you.
Required Integrations
Google Sheets
Why it's needed: Google Sheets serves as your lead database, storing prospect information and tracking all outreach activity. The workflow reads lead data from your sheet and writes back the generated emails, subject lines, and timestamps.
Setup steps:
-
Create a Google Cloud Project (if you don't have one):
- Visit the Google Cloud Console
- Click "Select a Project" → "New Project"
- Name your project (e.g., "TaskAGI Email Automation")
- Click "Create"
-
Enable the Google Sheets API:
- In your project, navigate to "APIs & Services" → "Library"
- Search for "Google Sheets API"
- Click on it and press "Enable"
-
Create Service Account Credentials:
- Go to "APIs & Services" → "Credentials"
- Click "Create Credentials" → "Service Account"
- Name it "TaskAGI Sheets Access" and click "Create"
- Skip optional permissions and click "Done"
- Click on your new service account
- Go to the "Keys" tab → "Add Key" → "Create New Key"
- Choose "JSON" format and click "Create"
- Save the downloaded JSON file securely
-
Share Your Google Sheet:
- Open your leads spreadsheet
- Click "Share" in the top-right corner
- Paste the service account email (found in the JSON file as
client_email)
- Grant "Editor" permissions
- Click "Send"
Configuration in TaskAGI:
- Navigate to Integrations in TaskAGI
- Click "Add Integration" → "Google Sheets"
- Upload your JSON credentials file or paste the contents
- Name the connection (e.g., "Leads Database")
- Click "Connect" to verify
OpenAI
Why it's needed: OpenAI's GPT models power the intelligent email generation, creating personalized email bodies and compelling subject lines based on your lead information and instructions.
Setup steps:
-
Create an OpenAI Account:
-
Generate an API Key:
- Click on your profile icon → "API Keys"
- Click "Create new secret key"
- Name it "TaskAGI Email Generator"
- Copy the key immediately (you won't see it again)
- Store it securely
-
Add Billing Information:
- Navigate to "Settings" → "Billing"
- Add a payment method
- Set up usage limits to control costs (recommended: $10-20/month for moderate use)
Configuration in TaskAGI:
- Go to Integrations in TaskAGI
- Click "Add Integration" → "OpenAI"
- Paste your API key in the "API Key" field
- Name the connection (e.g., "Email AI Generator")
- Click "Connect" to verify
Cost considerations: This workflow uses the gpt-4o-mini model, which costs approximately $0.15 per 1,000 emails generated—extremely cost-effective for the value provided.
Configuration Steps
Step 1: Prepare Your Google Sheet
Before configuring the workflow, structure your Google Sheet with these required columns:
-
Column A (Name): Lead's full name
-
Column B (Company): Company name
-
Column C (Email): Contact email address
-
Column D (Email Sent): Generated email body (leave blank initially)
-
Column E (Subject Line): Generated subject (leave blank initially)
-
Column F (Date Sent): Timestamp (leave blank initially)
-
Column G (Status): Processing status indicator (leave blank initially)
Add your lead data starting from row 2 (row 1 contains headers).
Step 2: Configure the Manual Trigger
The Manual Trigger node allows you to start the workflow on-demand:
- No configuration needed—this node is ready to use
- Click "Run" whenever you want to process new leads
- Consider scheduling this workflow to run automatically (available in workflow settings)
Step 3: Set Up Read Lead Data
The Read Lead Data node connects to your Google Sheet:
- Click on the "Read Lead Data" node
- In the
sheet_url field, paste your complete Google Sheets URL
- Example:
https://docs.google.com/spreadsheets/d/1ABC...XYZ/edit
- Select your connected Google Sheets integration
- Specify the sheet name (usually "Sheet1" unless you renamed it)
- Set the range to read all data:
A1:G (adjust if you have more columns)
Step 4: Configure Parse Sheet Data
The Parse Sheet Data node transforms raw sheet data into structured format:
- This node uses a custom function to convert sheet rows into usable objects
-
Default configuration works out-of-the-box—no changes needed
- The function maps each row to an object with properties:
name, company, email, emailSent, subjectLine, dateSent, status
Step 5: Set Up Loop Through Leads
The Loop Through Leads node processes each lead individually:
- Configure the loop to iterate over:
{{nodes.3903.result}}
- This references the parsed data from the previous step
- Each iteration processes one lead at a time
- The loop automatically handles rate limiting and prevents overwhelming APIs
Step 6: Configure Check If Needs Processing
The Check If Needs Processing node prevents duplicate processing:
- Set the condition to check if the lead hasn't been processed yet
- Recommended condition:
{{item.emailSent}} is empty OR {{item.status}} is not equal to "Sent"
- This ensures only unprocessed leads receive generated emails
- Leads that already have content are skipped automatically
Step 7: Set Up Generate Email Body
The Generate Email Body node creates personalized email content:
- Select your OpenAI integration
- Choose model:
gpt-4o-mini (optimal balance of quality and cost)
- Configure the prompt (customize this to match your brand voice):
You are writing a simple, direct cold email as an [YOUR ROLE] reaching out to {{item.name}} at {{item.company}}.
Context:
- Recipient: {{item.name}}
- Company: {{item.company}}
- Your value proposition: [DESCRIBE YOUR OFFERING]
Write a concise cold email (150-200 words) that:
- Opens with a personalized observation about their company
- Clearly states how you can help solve a specific problem
- Includes one concrete benefit or result
- Ends with a simple, low-pressure call to action
Tone: Professional but conversational, helpful not salesy.
Do not include a subject line or signature.
- Set Temperature to
0.7 for creative but consistent output
- Set Max Tokens to
300 to control email length
Step 8: Configure Generate Subject Line
The Generate Subject Line node creates compelling subject lines:
- Select your OpenAI integration
- Choose model:
gpt-4o-mini
- Configure the prompt:
Generate a compelling email subject line for an AI automation platform reaching out to {{item.name}} at {{item.company}}.
The email discusses how we can help them automate repetitive tasks and save time.
Requirements:
- 6-10 words maximum
- Personalized with company name or industry insight
- Curiosity-driven but not clickbait
- Professional tone
- No emojis or excessive punctuation
Return ONLY the subject line, nothing else.
- Set Temperature to
0.8 for more creative variety
- Set Max Tokens to
50
Step 9: Set Up Prepare Update Data
The Prepare Update Data node organizes information for sheet updates:
- This node structures the generated content and metadata
- Configure it to create an object with:
-
emailBody: {{nodes.3906.content}}
-
subjectLine: {{nodes.3907.content}}
-
currentDate: {{$now}} (automatically generates timestamp)
-
rowIndex: {{nodes.3904.index + 2}} (adds 2 to account for header row and 0-based indexing)
Step 10: Configure Update Email Sent Column
The Update Email Sent Column node writes the generated email back to your sheet:
- Select your Google Sheets integration
- Set
sheet_url to: {{nodes.3902.config.sheet_url}} (references the original sheet URL)
- Specify the sheet name (same as Step 3)
- Set the cell range:
D{{nodes.3908._dynamic.rowIndex}}
- Set the value to:
{{nodes.3908._dynamic.emailBody}}
Step 11: Configure Update Subject Column
Similar to Step 10, this node updates the subject line:
- Select your Google Sheets integration
- Set
sheet_url to: {{nodes.3902.config.sheet_url}}
- Specify the sheet name
- Set the cell range:
E{{nodes.3908._dynamic.rowIndex}}
- Set the value to:
{{nodes.3908._dynamic.subjectLine}}
Step 12: Configure Update Date Sent Column
This node records when processing occurred:
- Select your Google Sheets integration
- Set
sheet_url to: {{nodes.3902.config.sheet_url}}
- Specify the sheet name
- Set the cell range:
F{{nodes.3908._dynamic.rowIndex}}
- Set the value to:
{{nodes.3908._dynamic.currentDate}}
Step 13: Set Up Rate Limit Delay
The Rate Limit Delay node prevents API throttling:
- Set delay duration to
2000 milliseconds (2 seconds)
- This ensures you stay within OpenAI's rate limits
- Adjust based on your API tier (higher tiers can use shorter delays)
- For large lead lists, consider increasing to 3-5 seconds for safety
Testing Your Agent
Running Your First Test
-
Prepare test data: Add 2-3 test leads to your Google Sheet with real-looking information
-
Click "Run" on the Manual Trigger node in TaskAGI
-
Monitor execution: Watch the workflow progress through each node in real-time
-
Check for errors: Green checkmarks indicate successful execution; red X's indicate issues
Verification Checklist
After the workflow completes, verify:
✅ Google Sheet updated correctly:
- Column D contains personalized email body text
- Column E contains a compelling subject line
- Column F shows the current date/time
- No data appears in wrong columns
✅ Email quality check:
- Emails reference the correct lead name and company
- Content is relevant and personalized (not generic)
- Tone matches your brand voice
- No obvious AI artifacts or awkward phrasing
✅ Subject lines are compelling:
- Appropriate length (6-10 words)
- Include personalization elements
- Create curiosity without being clickbait
✅ No duplicate processing:
- Run the workflow again
- Previously processed leads should be skipped
- Only new leads (empty columns) get processed
Expected Results
Successful execution looks like:
- Processing time: 5-10 seconds per lead
- All update nodes show green status
- Sheet contains well-formatted, personalized content
- No error messages in the execution log
Performance benchmarks:
- 10 leads: ~1-2 minutes
- 50 leads: ~5-8 minutes
- 100 leads: ~10-15 minutes
Troubleshooting
Common Issues and Solutions
Problem: "Failed to read Google Sheet"
-
Cause: Service account doesn't have access to the sheet
-
Solution: Verify you shared the sheet with the service account email from your JSON credentials file. Check that you granted "Editor" permissions, not just "Viewer."
Problem: "OpenAI API authentication failed"
-
Cause: Invalid or expired API key
-
Solution: Generate a new API key in OpenAI dashboard. Ensure you copied the entire key without extra spaces. Verify your OpenAI account has billing enabled.
Problem: "Rate limit exceeded"
-
Cause: Processing leads too quickly
-
Solution: Increase the delay in the Rate Limit Delay node to 3-5 seconds. If using a free OpenAI tier, consider processing leads in smaller batches.
Problem: "Cell update failed - invalid range"
-
Cause: Row index calculation error
-
Solution: Check that your Prepare Update Data node correctly calculates
rowIndex as {{nodes.3904.index + 2}}. Verify your sheet has headers in row 1.
Problem: "Generated emails are too generic"
-
Cause: Insufficient context in the prompt
-
Solution: Enhance your Generate Email Body prompt with more specific details about your value proposition, target pain points, and desired outcomes. Include industry-specific language.
Problem: "Workflow processes already-sent leads"
-
Cause: Condition in Check If Needs Processing is incorrect
-
Solution: Verify the condition checks for empty
emailSent field. Consider adding a "Status" column with explicit "Sent" values for more reliable tracking.
Problem: "Some leads are skipped unexpectedly"
-
Cause: Data formatting issues in the sheet
-
Solution: Ensure all required columns (Name, Company, Email) contain data. Remove any hidden characters or extra spaces. Check that the sheet range in Read Lead Data captures all rows.
Error Message Decoder
-
"Invalid credentials": Re-upload your Google Sheets JSON file or re-enter your OpenAI API key
-
"Quota exceeded": You've hit your OpenAI usage limit; add more credits or wait for quota reset
-
"Timeout error": Network issue or slow API response; try running the workflow again
-
"Undefined variable": A node is referencing data from a node that didn't execute; check your workflow connections
Next Steps
Immediate Actions After Setup
-
Process your full lead list: Run the workflow on your complete database of prospects
-
Review generated content: Read through several examples to ensure quality meets your standards
-
Refine prompts: Adjust the email and subject line prompts based on the initial results
-
Set up scheduling: Configure the workflow to run automatically (daily or weekly) to process new leads as you add them
Optimization Suggestions
Improve personalization:
- Add more columns to your sheet (industry, pain point, company size) and reference them in prompts
- Create multiple prompt variations for different lead segments
- Include recent company news or achievements in the email context
Enhance tracking: