Quick overview
This workflow captures inbound form submissions, cleans and enriches the lead data, uses Google Gemini to score fit against your ideal customer profile, upserts the contact in HubSpot, and emails the sales owner via Gmail only when the lead meets a defined “hot” threshold.
How it works
- Receives a new inbound lead submission from an n8n Form trigger.
- Normalizes the lead details by validating and lowercasing the email, extracting the company domain, detecting free email providers, and backfilling company/website when missing.
- Sends the cleaned lead plus your ICP description to Google Gemini to return a JSON verdict with a fit score, segment, reasoning, and a suggested email opener.
- Parses the model response defensively, calculates whether the lead is “hot” based on the score threshold, disqualification flag, and email validity, and falls back to a safe default if the response is unreadable.
- If the email is valid, creates or updates the contact in HubSpot (matched by email) and writes the lead’s message, score, segment, and lifecycle stage to the contact properties.
- If the lead is hot, builds an HTML alert and sends it to the configured sales owner via Gmail; otherwise it finishes without sending an alert.
Setup
- Create a HubSpot Private App token with
crm.objects.contacts.read and crm.objects.contacts.write scopes and add it to an n8n HubSpot credential.
- Add credentials for Google Gemini (Chat Model) and Gmail, and select the correct account for sending alerts.
- In the configuration step, set
sales_owner_email, hot_score_threshold, and your icp_description to match your routing rules.
- Ensure your HubSpot account has the contact properties used in the upsert mapping (for example message, lead status, lifecycle stage, website, company, and phone).