Global AI Network
Agent Template v1.0.0

Smart Lead Routing and Qualification with HubSpot

21+
Deployments
5m
Setup Time
Free
Pricing

Need custom configuration?

Our solution engineers can help you adapt this agent to your specific infrastructure and requirements.

Enterprise Grade Best Practices Production Optimized

INTEGRATED_MODULES

Google Sheets
Google Sheets
HubSpot
HubSpot
Slack
Slack
Step by Step

Setup Tutorial

mission-briefing.md

What This Agent Does

This Lead Qualification and Nurturing Agent automatically processes incoming leads through a sophisticated qualification pipeline, enriching their data and routing them to appropriate follow-up workflows. The agent captures leads via webhook, validates their information using Hunter.io email verification and Abstract API company enrichment, scores them based on custom logic, and intelligently segments them into qualified or nurture tracks within HubSpot—all while logging activity to Google Sheets and alerting your team via Slack.

Key benefits and time savings:

  • Eliminate manual lead qualification – Automatically score and categorize leads in seconds instead of hours
  • Reduce invalid contact data – Email verification prevents wasted outreach efforts
  • Enrich prospect intelligence – Gain company insights automatically without manual research
  • Smart lead routing – Qualified leads go straight to sales; nurture leads enter automated sequences
  • Complete audit trail – Every lead interaction logged to Google Sheets for compliance and analysis
  • Real-time team visibility – Slack alerts keep your team informed of qualified opportunities

Target use cases:

  • SaaS companies capturing leads from website forms or landing pages
  • B2B service providers qualifying inbound inquiries
  • Marketing teams automating lead scoring workflows
  • Sales organizations implementing lead qualification standards

Who Is It For

This agent is ideal for sales and marketing teams who want to:

  • Automate repetitive lead qualification tasks
  • Ensure consistent qualification criteria across all leads
  • Reduce time-to-first-contact for qualified prospects
  • Maintain detailed records of lead interactions
  • Scale lead processing without adding headcount

You'll benefit most if you're currently manually reviewing leads, using spreadsheets to track qualification status, or losing qualified leads due to slow response times.


Required Integrations

HubSpot

Why it's needed: HubSpot serves as your central CRM repository, storing qualified and nurture contacts with their enriched data and scoring information for downstream sales and marketing workflows.

Setup steps:

  1. Log into your HubSpot account (create one at hubspot.com if needed)
  2. Navigate to Settings → Integrations → Private Apps
  3. Click Create private app and name it TaskAGI Lead Agent
  4. Under Scopes, enable:
    • crm.objects.contacts.read
    • crm.objects.contacts.write
  5. Click Create app and copy the Private App Token
  6. In TaskAGI, go to Integrations → HubSpot
  7. Paste your token in the API Key field
  8. Click Test Connection to verify

Configuration in TaskAGI: Store your HubSpot Private App Token as {{HUBSPOT_API_KEY}} in your workflow environment variables.


Hunter.io

Why it's needed: Hunter.io verifies email addresses in real-time, ensuring you're only creating contacts with valid, deliverable email addresses and reducing bounce rates.

Setup steps:

  1. Visit hunter.io and sign up for a free or paid account
  2. Navigate to Account Settings → API
  3. Copy your API Key
  4. In TaskAGI, go to Integrations → HTTP Request
  5. Create a new HTTP request node for Hunter.io
  6. Set Base URL to https://api.hunter.io/v2
  7. Add your API key to the request headers or query parameters as domain={{lead_domain}}&email={{lead_email}}&domain_search=true

Configuration in TaskAGI: Store your Hunter.io API key as {{HUNTER_API_KEY}}. The "Verify Email" node will use this to validate each lead's email address before proceeding.


Abstract API

Why it's needed: Abstract API enriches company information (industry, employee count, location) automatically, giving your sales team context without manual research.

Setup steps:

  1. Visit abstractapi.com and create a free account
  2. Navigate to Dashboard → API Keys
  3. Copy your API Key
  4. In TaskAGI, go to Integrations → HTTP Request
  5. Create a new HTTP request node for Abstract API
  6. Set Base URL to https://companyenrich.abstractapi.com/v1
  7. Add your API key: api_key={{ABSTRACT_API_KEY}}&domain={{company_domain}}

Configuration in TaskAGI: Store your Abstract API key as {{ABSTRACT_API_KEY}}. The "Enrich Company" node will use this to pull company details for lead scoring context.


Slack

Why it's needed: Slack notifications alert your sales team immediately when qualified leads enter the pipeline, enabling faster response times and competitive advantage.

Setup steps:

  1. Open your Slack workspace (create one at slack.com if needed)
  2. Go to Workspace Settings → Manage Apps
  3. Search for TaskAGI or create a custom bot:
    • Click Build → Create New App
    • Choose From scratch and name it TaskAGI Alerts
  4. Under OAuth & Permissions, add these Bot Token Scopes:
    • chat:write
    • chat:write.public
  5. Click Install to Workspace and copy your Bot Token
  6. In TaskAGI, go to Integrations → Slack
  7. Paste your Bot Token in the API Key field
  8. Select your target Channel (e.g., #sales-leads)

Configuration in TaskAGI: Store your Slack Bot Token as {{SLACK_BOT_TOKEN}} and set your channel as {{SLACK_CHANNEL}}.


Google Sheets

Why it's needed: Google Sheets provides a searchable, shareable audit log of all lead processing activity for compliance, analysis, and team transparency.

Setup steps:

  1. Create a new Google Sheet at sheets.google.com
  2. Add column headers: Timestamp, Lead Name, Email, Company, Lead Score, Status, Notes
  3. Right-click the sheet and select Share
  4. Grant Editor access to your TaskAGI service account email
  5. Copy the Sheet URL from your browser
  6. In TaskAGI, go to Integrations → Google Sheets
  7. Authenticate with your Google account
  8. Paste your Sheet URL as {{GOOGLE_SHEET_URL}}

Configuration in TaskAGI: Store your sheet URL as {{GOOGLE_SHEET_URL}} in environment variables. The "Log to Google Sheets" node will append a row after each lead is processed.


Configuration Steps

Step 1: Webhook Trigger Setup

The workflow starts with a Webhook Trigger that receives incoming lead data.

Configuration:

  1. Click the Webhook Trigger node
  2. Copy the generated Webhook URL
  3. In your lead source (website form, landing page, API), set the POST destination to this URL
  4. Expected payload structure:
{
  "first_name": "John",
  "last_name": "Doe",
  "email": "john@acmecorp.com",
  "company_name": "Acme Corp",
  "company_domain": "acmecorp.com",
  "phone": "555-0123"
}

Step 2: Extract Lead Data

The Extract Lead Data function normalizes incoming webhook data.

Configuration:

  1. Map incoming fields to standard variables:
    • {{lead_first_name}}first_name
    • {{lead_email}}email
    • {{lead_company}}company_name
    • {{lead_domain}}company_domain
  2. This ensures consistent data handling regardless of source format

Step 3: Email Verification (Hunter.io)

The Verify Email HTTP request validates email deliverability.

Configuration:

  1. Set Method to GET
  2. Set URL to:
https://api.hunter.io/v2/email-verifier?domain={{lead_domain}}&email={{lead_email}}&api_key={{HUNTER_API_KEY}}
  1. Store response as {{hunter_result}}
  2. Expected response includes result field: valid, invalid, or unknown

Step 4: Company Enrichment (Abstract API)

The Enrich Company HTTP request pulls company intelligence.

Configuration:

  1. Set Method to GET
  2. Set URL to:
https://companyenrich.abstractapi.com/v1?domain={{lead_domain}}&api_key={{ABSTRACT_API_KEY}}
  1. Store response as {{company_data}}
  2. Extract key fields: industry, employees, founded_year, location

Step 5: Lead Scoring Logic

The Lead Scoring Logic function calculates a qualification score (0-100).

Scoring criteria example:

  • Email valid: +30 points
  • Company has 50+ employees: +25 points
  • Industry matches target list: +20 points
  • Phone number provided: +15 points
  • Company founded before 2015: +10 points

Configuration:

  1. Create a function that evaluates {{hunter_result}}, {{company_data}}, and lead fields
  2. Output {{lead_score}} (numeric value 0-100)
  3. Example threshold: scores ≥70 are "qualified," <70 are "nurture"

Step 6: Conditional Routing

The Check Lead Score if-condition routes leads based on their score.

Configuration:

  1. Set condition: {{lead_score}} >= 70
  2. True path → Create Qualified Contact (HubSpot)
  3. False path → Create Nurture Contact (HubSpot)

Step 7: Create Qualified/Nurture Contacts

Both HubSpot contact creation nodes use the same structure with different properties.

Qualified Contact configuration:

  1. Email: {{lead_email}}
  2. First Name: {{lead_first_name}}
  3. Last Name: {{lead_last_name}}
  4. Company: {{lead_company}}
  5. Phone: {{lead_phone}}
  6. Lead Status: Qualified
  7. Lead Score: {{lead_score}}
  8. Company Industry: {{company_data.industry}}

Nurture Contact configuration:

  • Same fields as above, but set Lead Status to Nurture

Step 8: Wait and Recheck

The Wait for Follow-up node pauses for 7 days, then Recheck HubSpot Nurture Leads queries for leads ready for re-engagement.

Configuration:

  1. Set wait duration to 7 days
  2. Recheck node uses HubSpot API to find nurture leads with no recent activity
  3. Re-score and potentially promote to qualified status

Step 9: Logging and Alerts

Send Slack Alert and Log to Google Sheets execute in parallel after processing.

Slack message example:

🎯 New Qualified Lead!
Name: John Doe
Company: Acme Corp
Score: 85/100
Email: john@acmecorp.com

Google Sheets appends: timestamp, lead name, email, company, score, status, and any notes.


Testing Your Agent

Test Execution

  1. Send a test webhook request:

    • Use Postman or curl to POST test data to your webhook URL
    curl -X POST https://your-webhook-url \
      -H "Content-Type: application/json" \
      -d '{"first_name":"Jane","last_name":"Smith","email":"jane@testcorp.com","company_name":"Test Corp","company_domain":"testcorp.com","phone":"555-9999"}'
    
  2. Monitor execution:

    • In TaskAGI, open Workflow Runs and select your test execution
    • Watch each node complete in real-time

Verification Checklist

  • Webhook Trigger: Receives payload successfully
  • Extract Lead Data: All fields mapped correctly
  • Hunter.io: Email validation returns valid/invalid result
  • Abstract API: Company data populated (industry, employees, etc.)
  • Lead Scoring: Score calculated between 0-100
  • Conditional Routing: Lead routed to correct HubSpot contact type
  • HubSpot: Contact created with all enriched data
  • Slack Alert: Message posted to your channel
  • Google Sheets: Row appended with complete lead information

Expected Results

Qualified lead (score ≥70):

  • HubSpot contact created with "Qualified" status
  • Slack alert sent immediately
  • Google Sheets logged with green status indicator

Nurture lead (score <70):

  • HubSpot contact created with "Nurture" status
  • No immediate Slack alert (optional)
  • Google Sheets logged with yellow status indicator
  • Automatically rechecked after 7 days

Success indicators:

  • All test leads appear in HubSpot within 30 seconds
  • Slack notifications arrive in real-time
  • Google Sheets updates reflect all lead activity
  • No errors in workflow execution logs

Your lead qualification agent is now ready to scale your sales pipeline! 🚀