· Benjamin Grec · AI Automation  · 6 min read

How to Build an AI Lead Research Agent With n8n and Claude

The "AI agent that auto-enriches every new lead" is one of the most requested workflows we see. Here is exactly how to build it on n8n and Claude — and what your CRM record looks like when it is done.

The "AI agent that auto-enriches every new lead" is one of the most requested workflows we see. Here is exactly how to build it on n8n and Claude — and what your CRM record looks like when it is done.

One of the highest-leverage automations a B2B sales team can run is deceptively simple in concept: every time a new lead enters your CRM, an AI agent researches the company, enriches the contact record, and drafts an opening context note so the rep who picks it up already knows what they are walking into.

In practice, most teams either buy an expensive enrichment SaaS subscription (Clay, ZoomInfo Copilot, Apollo AI) or do it manually, which means it does not happen consistently.

This post shows you how to build this workflow yourself using n8n, the Claude API, and SuiteCRM — for roughly $0.002 per lead in API costs.

What the Workflow Does

When a new contact is created in SuiteCRM, the workflow:

  1. Pulls the contact’s company name, domain, and title from the CRM record
  2. Fetches the company’s homepage and “About” page via HTTP request
  3. Passes that content to Claude with a structured research prompt
  4. Receives a JSON response with enriched fields: company size estimate, primary business model, likely pain points, ICP fit score, and a suggested opening angle
  5. Writes all of that back to the SuiteCRM contact record as a structured note

Total execution time: 15–30 seconds. Cost per execution: under half a cent at current Claude pricing.

Prerequisites

  • n8n instance (self-hosted or n8n Cloud)
  • Anthropic API key
  • SuiteCRM with REST API enabled
  • Basic familiarity with n8n canvas (no code required)

Step 1: Set Up the SuiteCRM Trigger

In n8n, create a new workflow and add a SuiteCRM trigger node (or a webhook trigger if you prefer a push model over polling).

Configure it to fire on Contacts object, event: Created.

If you are on a self-hosted SuiteCRM instance, you will need to:

  1. Enable the REST API under Admin → OAuth2 Clients
  2. Create an OAuth client and note the client ID and secret
  3. Add those credentials to n8n’s credential manager under “SuiteCRM”

Test the trigger by creating a dummy contact — you should see the webhook fire and return the contact object in the n8n execution log.

Step 2: Extract the Company Domain

Add an Edit Fields node (or a Set node in older n8n versions) to extract and clean the fields you will use:

  • company_name: from {{ $json.name }} on the Account relation, or the account_name field on the contact
  • domain: ideally from the contact’s email domain ({{ $json.email.split('@')[1] }}) or a dedicated website field
  • contact_title: from {{ $json.title }}

If the contact’s email is missing or from a generic domain (gmail, hotmail), add an IF node to route those records to a “manual review” branch instead of feeding them to the AI — you will not get useful enrichment on personal email domains.

Step 3: Fetch the Company Homepage

Add an HTTP Request node configured as:

  • Method: GET
  • URL: https://{{ $json.domain }}
  • Response format: Text
  • Timeout: 10 seconds
  • Continue on error: enabled (many sites block bots; you want the workflow to continue even if the fetch fails)

Add a second HTTP Request node for /about or /about-us:

  • URL: https://{{ $json.domain }}/about

Use an If node to check whether each fetch returned a non-empty body. If both fail, pass an empty string to the next step — Claude will still produce useful output from company name and contact title alone, just with lower confidence.

Step 4: Write the Research Prompt

Add an Anthropic node (available in n8n natively as of v1.45) or an HTTP Request node pointed at https://api.anthropic.com/v1/messages.

Set your API key as a credential.

The model: claude-sonnet-4-6 (fast, inexpensive, sufficient for structured extraction)

For the prompt, use a system message that establishes the output format and a user message that passes the scraped content:

System:

You are a B2B sales research assistant. Given information about a company, produce a structured JSON object with the following fields:

- company_size_estimate: "1-10", "11-50", "51-200", "201-1000", or "1000+"
- business_model: one sentence describing what the company sells and to whom
- primary_pain_points: array of 2-3 pain points this type of company commonly experiences
- icp_fit_score: integer 1-10 estimating fit for a B2B CRM/sales automation consultancy
- icp_fit_reason: one sentence explaining the score
- suggested_opening_angle: one sentence — a specific, non-generic conversation starter for a cold outreach to this company

Return only valid JSON. No markdown fencing. No explanation outside the JSON object.

User:

Company name: {{ $json.company_name }}
Contact title: {{ $json.contact_title }}
Domain: {{ $json.domain }}

Homepage content (truncated to 3000 characters):
{{ $json.homepage_content.slice(0, 3000) }}

About page content (truncated to 2000 characters):
{{ $json.about_content.slice(0, 2000) }}

Step 5: Parse the Response

Add a Code node (JavaScript) to parse Claude’s response:

const raw = $input.first().json.content[0].text;
try {
  return [{ json: JSON.parse(raw) }];
} catch (e) {
  return [{ json: {
    company_size_estimate: 'unknown',
    business_model: 'Could not parse',
    primary_pain_points: [],
    icp_fit_score: 0,
    icp_fit_reason: 'Parse error',
    suggested_opening_angle: ''
  }}];
}

The error fallback ensures a parse failure does not crash the workflow — it produces a blank enrichment record instead.

Step 6: Write Back to SuiteCRM

Add a SuiteCRM node configured for the Create Note action, linked to the contact’s ID.

Set the note body to a formatted string:

=== AI Lead Enrichment ===
Company size: {{ $json.company_size_estimate }}
Business model: {{ $json.business_model }}
ICP fit: {{ $json.icp_fit_score }}/10 — {{ $json.icp_fit_reason }}

Likely pain points:
{{ $json.primary_pain_points.join('\n') }}

Suggested opening angle:
{{ $json.suggested_opening_angle }}

You can also update specific custom fields on the Contact or Account record directly if you have created them in SuiteCRM (ICP score, business model, etc.) — that enables filtering and list segmentation by AI-enriched attributes later.

What Reps See When They Open the Record

When a rep pulls up the contact, they see a timestamped note attached to the record with everything above. Before they make a single call, they know:

  • What the company does and who it sells to
  • Why this contact might care about CRM or automation improvement
  • A specific conversation angle that is not “I noticed you’re in sales”

Average time reps save per lead: 8–12 minutes of manual research. At 20 new leads per week per rep, that is 3–4 hours of selling time returned per week, per rep.

Extending the Workflow

Once this base workflow is running, common extensions include:

  • LinkedIn enrichment: add a Prospeo, Hunter, or RocketReach HTTP node to pull LinkedIn company data before the Claude step
  • Slack notification: post a summary to a #new-leads channel so the team sees high-ICP leads in real time
  • Territory routing: use the ICP score to automatically assign ownership in SuiteCRM
  • Sequence enrollment: if ICP score ≥ 7, enroll the contact in Mautic’s outbound drip sequence automatically

Each extension is another n8n node. None require custom code beyond occasional JSON parsing.


The workflow described here takes about 3–4 hours to build and test for someone with moderate n8n experience. We build this as part of every managed stack engagement — and we can have it running on your leads within the first week of onboarding. Book a strategy call if you want us to scope it for your specific CRM and lead sources.

Back to Blog

Related Posts

View All Posts »