Global AI Network

B2B Lead Follow up AI Agent

Automatically follow up with B2B leads using AI-generated reminder emails in Gmail based on Google Sheets tracking, ensuring no prospect falls through the cracks.

722+
Total Deployments
15 min
Setup Time
v1.0
Version

Need Help Getting Started? Our AI Specialists Will Set It Up For Free

1-Click Deployment 5-Min Setup Free Expert Support
Technology Partners

Required Integrations

This agent works seamlessly with these platforms to deliver powerful automation.

Gmail

Gmail

Send, receive, and manage Gmail messages with full email automation capabilities

Google Sheets

Google Sheets

Read / Write data from / to Google Sheets

OpenAI

OpenAI

Leverage OpenAI's powerful language models to generate text, answer questions, a...

Step by Step

Setup Tutorial

mission-briefing.md

What This Agent Does

This intelligent workflow automates your B2B email follow-up process by monitoring leads in a Google Sheet, identifying which prospects need reminder emails, and automatically generating personalized follow-up messages using AI. The agent checks your lead database, determines who hasn't responded within your specified timeframe, crafts contextually appropriate reminder emails using GPT-4, and sends them as replies to the original email threads—all while keeping your spreadsheet updated with the latest status.

Key benefits include:

  • Save 5-10 hours per week on manual follow-up tracking and email composition
  • Never miss a follow-up opportunity with automated reminder scheduling
  • Maintain personalized communication through AI-generated, context-aware emails
  • Keep your team synchronized with real-time Google Sheets updates
  • Improve response rates with timely, professionally crafted reminder messages

Perfect use cases: Sales prospecting follow-ups, partnership outreach campaigns, client onboarding sequences, investor relations, recruitment communications, and any B2B scenario requiring systematic follow-up management.

Who Is It For

This workflow is designed for sales professionals, business development representatives, marketing teams, and entrepreneurs who regularly conduct email outreach campaigns and need to maintain consistent follow-up without the manual overhead.

You'll find this particularly valuable if you:

  • Manage 20+ active leads or prospects simultaneously
  • Struggle to remember who needs follow-up and when
  • Spend significant time crafting similar-but-personalized reminder emails
  • Use Google Sheets to track your outreach efforts
  • Want to maintain a professional, timely presence without constant manual monitoring
  • Need to scale your outreach without sacrificing personalization

Technical skill level required: Beginner to intermediate. You should be comfortable with Google Sheets, basic email operations, and following step-by-step setup instructions. No coding knowledge required.

Required Integrations

Google Sheets

Why it's needed: Google Sheets serves as your central lead database, tracking contact information, email history, reminder dates, and response status. The workflow reads lead data from your sheet and updates it with the latest follow-up information.

Setup steps:

  1. Create a Google Cloud Project (if you don't have one):

    • Visit the Google Cloud Console
    • Click "Select a project" → "New Project"
    • Name it "TaskAGI Integrations" and click "Create"
  2. Enable the Google Sheets API:

    • In your project, navigate to "APIs & Services" → "Library"
    • Search for "Google Sheets API"
    • Click on it and press "Enable"
  3. Create OAuth 2.0 credentials:

    • Go to "APIs & Services" → "Credentials"
    • Click "Create Credentials" → "OAuth client ID"
    • Configure the consent screen if prompted (Internal or External based on your needs)
    • Select "Web application" as application type
    • Add authorized redirect URI: https://app.taskagi.com/oauth/callback (or your TaskAGI instance URL)
    • Save your Client ID and Client Secret
  4. Configure in TaskAGI:

    • Navigate to Settings → Integrations → Google Sheets
    • Click "Add Integration"
    • Enter your Client ID and Client Secret
    • Click "Authorize" and grant permissions to access your Google Sheets
    • Name the connection (e.g., "Lead Tracking Sheets")

Required Sheet Structure: Your Google Sheet should include columns for: Lead Name, Email Address, Last Contact Date, Reminder Date, Status, and any other relevant tracking fields.

OpenAI

Why it's needed: OpenAI's GPT-4 model generates personalized, contextually appropriate reminder emails that sound natural and professional, adapting to each lead's specific situation and your communication style.

Setup steps:

  1. Create an OpenAI account:

  2. Generate an API key:

    • Navigate to your account settings (click your profile icon)
    • Select "API keys" from the menu
    • Click "Create new secret key"
    • Name it "TaskAGI Email Automation"
    • Copy the key immediately (you won't be able to see it again)
    • Store it securely in a password manager
  3. Add billing information:

    • Go to "Billing" in your OpenAI account
    • Add a payment method
    • Set up usage limits to control costs (recommended: $20-50/month for moderate use)
  4. Configure in TaskAGI:

    • Go to Settings → Integrations → OpenAI
    • Click "Add Integration"
    • Paste your API key
    • Name the connection (e.g., "Email AI Assistant")
    • Test the connection to verify it works

Cost consideration: GPT-4 costs approximately $0.03-0.06 per reminder email generated. For 100 reminders/month, expect $3-6 in OpenAI costs.

Gmail

Why it's needed: Gmail integration enables the workflow to search for original email threads, retrieve message details, and send reminder emails as proper replies (maintaining conversation continuity rather than starting new threads).

Setup steps:

  1. Enable Gmail API in Google Cloud:

    • In the same Google Cloud Project you created for Sheets
    • Navigate to "APIs & Services" → "Library"
    • Search for "Gmail API"
    • Click and press "Enable"
  2. Use the same OAuth credentials (or create Gmail-specific ones):

    • The OAuth client you created for Google Sheets can work for Gmail
    • Ensure the consent screen includes Gmail scopes
    • Required scopes: gmail.readonly, gmail.send, gmail.modify
  3. Configure in TaskAGI:

    • Navigate to Settings → Integrations → Gmail
    • Click "Add Integration"
    • Use the same Client ID and Client Secret from Google Sheets setup
    • Click "Authorize" and grant Gmail permissions
    • Important: Authorize with the Gmail account you use for sending outreach emails
    • Name the connection (e.g., "Sales Email Account")

Security note: This integration only accesses emails related to your leads and sends messages you've configured. It cannot read unrelated emails or send unauthorized messages.

Configuration Steps

Step 1: Prepare Your Google Sheet

Before configuring the workflow, set up your lead tracking spreadsheet:

  1. Create a new Google Sheet or use an existing one
  2. Required columns (exact names matter):
    • Lead Name - Full name of the contact
    • Email - Email address
    • Last Contact Date - Date of last email sent (format: YYYY-MM-DD)
    • Reminder Date - When to send reminder (format: YYYY-MM-DD)
    • Status - Current lead status (e.g., "Contacted", "Reminded", "Responded")
    • Original Subject - Subject line of your initial email
  3. Copy the sheet URL from your browser address bar

Step 2: Configure the Manual Trigger

The Manual Trigger node allows you to run this workflow on-demand or schedule it:

  • Leave default settings for manual execution
  • For automation: Click the node → Enable "Schedule" → Set to run daily at your preferred time (e.g., 9:00 AM)
  • Recommended schedule: Once daily during business hours

Step 3: Configure "Get Leads from Sheet"

This node retrieves all leads from your Google Sheet:

  1. Click the Get Leads from Sheet node
  2. In the sheet_url parameter, paste your Google Sheet URL
  3. Set sheet_name to the tab name (usually "Sheet1" or your custom name)
  4. Enable "Include headers" to use column names as field identifiers
  5. Test the node to verify it retrieves your data correctly

Step 4: Set Up the Loop Through Leads

The Loop Through Leads node processes each lead individually:

  1. Click the node and verify the input is connected from "Get Leads from Sheet"
  2. Set loop variable name to current_lead
  3. This makes each lead's data accessible as {{current_lead.Lead Name}}, {{current_lead.Email}}, etc.

Step 5: Configure "Check If Reminder Needed"

This Function node determines whether each lead needs a reminder:

  1. Click the node to open the function editor
  2. Use this logic (example code):
const today = new Date();
const reminderDate = new Date(current_lead['Reminder Date']);
const status = current_lead['Status'];

// Send reminder if: reminder date is today or past, and status isn't "Responded"
const needsReminder = reminderDate <= today && status !== 'Responded' && status !== 'Reminded Today';

return { needsReminder: needsReminder };
  1. This returns true when a reminder should be sent

Step 6: Configure the Conditional Branch

The Needs Reminder? node routes leads based on the function result:

  1. Set condition to: {{nodes.4620.needsReminder}} equals true
  2. True path proceeds to AI generation
  3. False path skips to "No Reminder Needed"

Step 7: Set Up AI Reminder Generation

The Generate Reminder Email node is where the magic happens:

  1. Click the node to open configuration
  2. Select your OpenAI integration
  3. Set model to gpt-4o (optimized for quality and cost)
  4. Configure the prompt parameter with this template:
You are a helpful B2B marketing assistant writing follow-up emails.

Write a brief, professional reminder email to {{current_lead.Lead Name}} at {{current_lead.Email}}.

Context:
- Original email subject: {{current_lead.Original Subject}}
- Last contacted: {{current_lead.Last Contact Date}}
- Days since contact: [calculate this]

Requirements:
- Friendly but professional tone
- Reference the original conversation naturally
- Keep it under 100 words
- Include a clear call-to-action
- Don't be pushy or desperate
- Sign off with just the message body (no signature block)

Generate only the email body text.
  1. Set max_tokens to 300 (sufficient for concise emails)
  2. Set temperature to 0.7 (balanced creativity and consistency)

Step 8: Configure Email Thread Finding

The Find Original Thread node locates the original conversation:

  1. Select your Gmail integration
  2. Set search query to: to:{{current_lead.Email}} subject:"{{current_lead.Original Subject}}"
  3. Set max_results to 1 (we only need the most recent)
  4. Enable "Include thread ID" to get the conversation identifier

Step 9: Set Up Message Details Retrieval

The Get Message Details function extracts the thread ID:

const searchResults = nodes['4624']; // Find Original Thread node
if (searchResults && searchResults.messages && searchResults.messages.length > 0) {
  return {
    threadId: searchResults.messages[0].threadId,
    messageId: searchResults.messages[0].id
  };
}
return { error: "No original thread found" };

Step 10: Configure Reply to Email Thread

The Reply to Email Thread node sends your AI-generated reminder:

  1. Select your Gmail integration
  2. Set threadId to: {{nodes.4625.threadId}}
  3. Set to to: {{current_lead.Email}}
  4. Set body to: {{nodes.4623.choices[0].message.content}} (the AI-generated email)
  5. Enable "Send as reply" to maintain thread continuity

Step 11: Configure Sheet Updates

Three nodes update your Google Sheet with the latest information:

Find Lead Row:

  • Set sheet_url to your Google Sheet URL
  • Set search_column to Email
  • Set search_value to {{current_lead.Email}}

Update Reminder Status:

  • Set sheet_url to your Google Sheet URL
  • Set row to {{nodes.4628.row_number}} (from Find Lead Row)
  • Set column to Status
  • Set value to Reminded Today

Update Reminder Date:

  • Set sheet_url to your Google Sheet URL
  • Set row to {{nodes.4628.row_number}}
  • Set column to Reminder Date
  • Set value to a formula that calculates next reminder date (e.g., 3 days from now)

Update Status Column:

  • Additional status tracking as needed for your workflow

Testing Your Agent

Initial Test Run

  1. Prepare test data: Create 2-3 test leads in your Google Sheet with reminder dates set to today
  2. Use a test email: Ensure at least one test lead uses an email you control
  3. Click "Test Workflow" in the TaskAGI interface
  4. Monitor execution: Watch each node light up as it processes

Verification Checklist

After the test run, verify:

Sheet reading: Check the "Get Leads from Sheet" node output shows all your leads ✅ Loop processing: Confirm the loop iterates through each lead (check loop counter) ✅ Reminder logic: Verify only leads with today's date proceed to AI generation ✅ AI generation: Review the generated email text for quality and appropriateness ✅ Thread finding: Confirm the original email thread was located ✅ Email sending: Check your test email inbox for the reminder (should appear as a reply) ✅ Sheet updates: Verify the Status and Reminder Date columns updated correctly

Success Indicators

  • Execution time: Should complete in 5-15 seconds per lead
  • AI quality: Generated emails should be coherent, professional, and contextually appropriate
  • Thread continuity: Reminder emails appear as replies, not new threads
  • Data accuracy: Sheet updates reflect the correct leads and timestamps

Troubleshooting

Common Configuration Issues

Problem: "Sheet not found" error

  • Cause: Incorrect sheet URL or insufficient permissions
  • Solution: Verify the URL is complete (including /edit#gid=...), ensure the Google account authorized in TaskAGI has access to the sheet, and check that the sheet name matches exactly (case-sensitive)

Problem: No leads being processed

  • Cause: Date format mismatch or incorrect column names
  • Solution: Ensure dates are in YYYY-MM-DD format, verify column names match exactly (including spaces and capitalization), and check that "Include headers" is enabled in the Get Leads node

Problem: AI generates inappropriate or generic emails

  • Cause: Insufficient context in the prompt or wrong model
  • Solution: Enhance your prompt with more specific instructions about tone and style, include more context fields from your sheet (company name, previous conversation points), and ensure you're using gpt-4o not gpt-3.5-turbo

Problem: "Original thread not found" error

  • Cause: Subject line mismatch or email not in Gmail
  • Solution: Verify the Original Subject column exactly matches the email subject (including punctuation), check that the email was sent from the authorized Gmail account, and ensure sufficient time has passed for Gmail to index the message (wait 1-2 minutes after sending)

Problem: Emails sent as new threads instead of replies

  • Cause: Thread ID not properly passed or Gmail API permissions insufficient
  • Solution: Verify the Get Message Details function returns a valid threadId, check that the Reply node receives {{nodes.4625.threadId}} correctly, and re-authorize Gmail integration with full permissions

Problem: Sheet updates fail or update wrong rows

  • Cause: Row finding logic error or concurrent modifications
  • Solution: Ensure the Email column contains unique values, verify the Find Lead Row node returns exactly one result, and avoid manually editing the sheet while the workflow runs

Error Message Explanations

  • "Rate limit exceeded": You've hit OpenAI or Gmail API limits. Wait 60 seconds and retry, or reduce workflow frequency.
  • "Invalid authentication": Your integration credentials expired. Re-authorize the affected integration in Settings.
  • "Quota exceeded": You've reached your daily Gmail sending limit (typically 500/day for standard accounts). Wait until the next day or upgrade to Google Workspace.
  • "Model not found": The OpenAI model name is misspelled. Use exactly gpt-4o (lowercase, no spaces).

Next Steps

After Successful Setup

  1. Start with a small batch: Test with 5-10 real leads before scaling up 2
Similar Solutions

Related Agents

Explore these powerful automation agents that complement your workflow.

B2B SaaS Churn Risk Analysis and Management AI Agent

B2B SaaS Churn Risk Analysis and Management AI Agent

Automatically identify at-risk customers by analyzing engagement across HubSpot, Salesforce, Pipedrive, and Zendesk, the...