LOW / CODEBlueprints
salesai

AI Lead Qualifier & Enrichment

When a new lead comes in, use Claude AI to analyze their company and role, score their fit, and enrich the CRM record automatically. High-scoring leads trigger a Slack notification to your sales team.

Intermediate~25 minn8nMake.com 475 downloads 756 views

Setup Instructions

1. Create a new workflow in n8n triggered by a HubSpot "New Contact" webhook. Configure the HubSpot trigger to fire whenever a new contact is created. 2. Add an HTTP Request node to fetch additional company data from HubSpot's Company API using the contact's associated company ID. 3. Add an HTTP Request node to call the Claude API (POST https://api.anthropic.com/v1/messages). Set the headers: x-api-key to your Anthropic API key, anthropic-version to 2023-06-01, and content-type to application/json. 4. In the Claude API request body, set the model to "claude-sonnet-4-20250514" and max_tokens to 1024. Craft a prompt that passes the lead's name, email domain, job title, and company info, asking Claude to return a JSON object with a fit_score (0-100), reasoning, and enrichment fields (industry, company_size_estimate, key_talking_points). 5. Add a Function node to parse Claude's JSON response. Extract the fit_score and enrichment data. Route high-scoring leads (score >= 70) to the enrichment path and low-scoring leads to the nurture path using an IF node. 6. On the high-score path, add a HubSpot node to update the contact record with the enrichment fields and lead score. Follow it with a Slack node that posts a summary to your #sales channel. 7. On the low-score path, add a HubSpot node to tag the contact for nurture sequences. 8. Test with a sample contact. Verify Claude's response parses correctly, the CRM record is enriched, and the Slack notification fires. Adjust the prompt if the scoring is too generous or too strict.
Troubleshooting
**Claude API returns 401 Unauthorized:** Double-check your Anthropic API key in the HTTP Request node headers. Ensure the key starts with "sk-ant-" and has not been revoked. Verify the anthropic-version header is set to "2023-06-01". **Claude response is not valid JSON:** Add explicit instructions in your prompt like "Respond ONLY with a valid JSON object, no markdown or explanation." Use a try/catch in your Function node to handle malformed responses gracefully. **Token limit exceeded on large company descriptions:** If the company data is too long, truncate it before sending to Claude. Set max_tokens appropriately (1024 is usually enough for scoring). Consider summarizing the input data before passing it to the prompt. **HubSpot contact not updating:** Verify your HubSpot API key has "Contacts: Write" scope. Ensure the custom properties (lead_score, industry, etc.) exist in HubSpot before trying to write to them. Check the property internal names match exactly.

Need a custom version?

We can build a tailored automation workflow for your specific needs.

New blueprints weekly

Get notified when we publish new automation workflows.