
Capstone Part 2: The Lead & CRM Engine
Hands-on implementation. Build the first module of Nexus-One: A high-performance lead capture system with deduplication and HubSpot integration.
Capstone Part 2: The Lead & CRM Engine
In Part 2, we build the "Sales" heart of Nexus-One. We will handle incoming webhooks, normalize the data, and update HubSpot without creating duplicates.
1. The Intake Node
Add a Webhook node.
- Method: POST
- Path:
new-lead - Output: JSON containing
first_name,email, andcompany.
2. Normalization (Review Module 4)
Add a Set node.
- Expression:
{{ $json.email.toLowerCase().trim() }}. - Why?: This ensures that
JOHN@DOE.COMandjohn@doe.comare treated as the same person.
3. The Deduping Search (Review Module 8)
Add a HubSpot node.
- Operation: Search.
- Query: Find where
Emailmatches your normalized email.
4. The Branching Logic (Review Module 5)
Add an IF node.
- Check:
{ $node["HubSpot"].json["total"] > 0 }. - TRUE (Update): HubSpot Node -> Update Contact.
- FALSE (Create): HubSpot Node -> Create Contact.
5. Summary of the Flow
New Lead -> Clean Data -> Search HubSpot -> Update or Create.
Exercise: The Lead Builder
- Trigger your webhook using Postman or Curl.
- Verify that your Set node is actually lowercasing the email.
- Check your HubSpot dashboard. Did the contact appear with the correct details?
- What happens if the
companyfield is empty? How would you add a "Fallback" value like"Unknown"? (Hint: Use an Expression). - Research: How would you add a "Slack Notification" ONLY if the lead is brand new (the FALSE branch)?
Summary
You have built the first "Module" of your business assistant. This engine is resilient, clean, and ensures that your CRM data remains a "Single Source of Truth."
Next Lesson: Part 3: Integrating AI and Summarization.