AI & Automation

Marq - MQL Qualification Agent

A Slack bot that automatically researches and qualifies new marketing leads in real time, so the marketing team knows which ones are worth pursuing before a rep even looks.

Client: Marq

Key Metrics

4 APIs Integrated
3 Lead Routing Rules
24/7 Availability
Testing Status
n8n workflow diagram for AI-powered MQL qualification and routing agent

Project Details

Marq's marketing team had been running a Python script on a single laptop to research and qualify inbound MQL notifications from HubSpot, meaning leads only got processed when that machine was powered on. I migrated the full pipeline to an n8n workflow running 24/7 on Marq's automation instance, using Claude Sonnet with web search to research each lead in real time, route them to the correct account executive tier, and post a formatted qualification summary as a Slack thread reply - complete with ICP fit assessment, company verification, discovery brief, and HubSpot contact history.

Challenge

Marq's marketing development rep had built a Python-based Slack bot that listened for HubSpot MQL notifications and automatically researched and qualified each lead using Claude with web search. The problem: it ran locally on her laptop via a persistent WebSocket connection. Leads only got qualified when her machine was on and the script was actively running - no coverage on nights, weekends, or whenever she stepped away.

Beyond uptime, the setup had no error handling, no execution logs, and no easy way for anyone else on the team to modify or monitor the pipeline. If the script crashed or the laptop went to sleep, MQLs sat in the Slack channel with no qualification until someone noticed and restarted it.

The marketing team needed the same qualification pipeline running 24/7 on infrastructure the whole team could access, without rewriting the core logic from scratch.

Approach

  • Reviewed the existing Python codebase module by module (parser, router, qualifier, HubSpot lookup, Slack output) and documented the full pipeline before writing any n8n nodes
  • Mapped each Python module to its n8n equivalent: Slack Trigger for the socket listener, Code nodes for parsing and routing logic, HTTP Request for the Claude API call, HubSpot nodes for contact history, and a Slack node for the thread reply
  • Kept Claude Sonnet with web search as the qualification LLM - the Anthropic API handles web search server-side in a single call, so no multi-turn orchestration was needed from n8n
  • Preserved the existing AE routing rules exactly: Corporate tier for companies up to 1,000 employees, Enterprise for 1,001+, with a special threshold for real estate brokerages (under 501 = Corporate, 501+ = Enterprise)
  • Structured delivery in three milestones: M1 (review and plan), M2 (build the full workflow), M3 (test with real MQLs and iterate with Natalie)

How It Works

The n8n workflow triggers on every new message in Marq's MQL Slack channel:

  1. Slack listener - an n8n Slack Trigger node monitors the channel for HubSpot inbound routing messages containing new MQL notifications
  2. Lead parsing - a Code node extracts structured fields from the Slack message text: contact owner, company name, job title, employee count, industry, lead source, and UTM parameters
  3. AE routing - a Code node determines the correct account executive tier based on employee count and industry rules, with special handling for real estate brokerages that use a lower threshold
  4. AI qualification - an HTTP Request node calls the Anthropic API with Claude Sonnet and web search enabled, sending the parsed lead data as context. Claude researches the person and company in real time, checks ICP fit, flags red and yellow signals, identifies competitor usage, and generates talking points
  5. HubSpot contact history - HubSpot API calls pull the contact's prior activity: previous deals, logged calls, email threads, and booked meetings from the last 12 months
  6. Slack thread reply - a Slack node posts a formatted summary back to the original MQL thread with: qualification status (green/yellow/red), role and authority assessment, company size verification, AE routing assignment, flags and signals, a discovery brief for the rep, recommended next steps, and a summary of past HubSpot communications

Deliverables

  • Production-ready n8n workflow deployed on Marq's 24/7 automation instance, replacing a laptop-dependent Python script
  • Claude Sonnet integration with web search for real-time lead research and ICP qualification in a single API call
  • Three-tier AE routing logic (Corporate, Enterprise, and a real estate brokerage exception) ported directly from the original Python rules
  • HubSpot API v3 integration pulling contact history including deals, calls, emails, and meetings
  • Formatted Slack thread replies with color-coded status indicators, structured qualification assessment, and actionable next steps for the assigned rep
  • Milestone-based delivery: M1 codebase review and workflow planning, M2 full build, M3 testing and iteration with the marketing team

Results

  • Eliminated dependency on a single laptop for lead qualification - pipeline now runs 24/7 on Marq's n8n instance with built-in error handling and execution logs
  • Leads researched and qualified in real time as soon as they appear in Slack, rather than waiting for the next time someone starts the script
  • AE routing automated with consistent rule application across all leads, including the real estate brokerage edge case
  • Marketing team gets structured, actionable qualification summaries directly in the Slack thread without switching tools or waiting for manual review
  • Currently in testing and review phase with the marketing team before full production activation

Tools Used

n8n, Slack API, Anthropic API (Claude Sonnet with web search), HubSpot API v3, Claude Code

AI n8n HubSpot Anthropic Claude automation marketing-ops Slack lead-qualification

Get Started

Looking to Hire?

I bring 15+ years of cross-functional experience to every role. Connect on LinkedIn to learn more.

Need a Consultant?

Whether it's a short sprint or a long-term engagement, I'm ready to help your team deliver better results.