
HubSpot Industry Classifier with Gemini
An automated workflow that classifies HubSpot companies into industry groups using Google Gemini and sends uncertain records for human review.
n8n Automations AI Agents- n8n
- HubSpot
- Gemini
Overview
This project uses n8n and Google Gemini Flash to automatically classify company records in HubSpot. The workflow runs every hour, retrieves companies from a designated HubSpot list, and checks whether their industry group is already assigned. Gemini analyzes company information and suggests an industry based on the categories available in HubSpot.
To maintain CRM data quality, the workflow validates every suggested category and checks its confidence score before updating a record. Companies that cannot be classified reliably are marked as Needs R&D for human review. A dry-run mode also allows the team to test the workflow without changing live CRM records.
The Problem
Many HubSpot company records may have missing or inconsistent industry classifications. Updating these records manually takes time and can lead to inconsistent categories.
Using AI without proper checks also creates risks, such as invented industry groups, unreliable classifications, and repeated processing of companies that have already been classified.
How It Works
- Scheduled Execution: n8n starts the workflow every hour and loads its configuration, including the company limit, confidence threshold, and dry-run setting.
- Retrieve Company Records: The workflow retrieves companies from a designated HubSpot list, collecting up to 100 records per run.
- Check Company Information: It retrieves each company's name, domain, website, and existing industry group. Already classified companies and records without usable information are skipped.
- AI Classification: Google Gemini Flash analyzes the available company information and returns a suggested industry group, confidence score, exclusion flag, and reasoning.
- Validate the Result: n8n checks whether the suggested industry exists in HubSpot's allowed options. It also applies a minimum confidence threshold of 0.6 and limits confidence to 0.65 for companies without a domain.
- Update or Flag Records: Valid classifications are written to HubSpot with relevant classification details. Uncertain or excluded companies are marked as Needs R&D for human review.
- Control Updates: Dry-run mode prevents changes to live records during testing. A Wait node also separates updates to help manage HubSpot API rate limits.

The Result
The workflow provides an automated and controlled process for classifying HubSpot company records. It uses Gemini to suggest categories while HubSpot provides the approved industry options. Validation rules, confidence checks, and human-review routing help prevent unreliable classifications from being accepted automatically.
Workflow Configuration Metrics
| Metric | Result |
|---|---|
| n8n workflow nodes | 22 |
| Execution schedule | Every hour |
| Maximum companies per run | 100 |
| Confidence threshold | 0.6 |
| No-domain confidence cap | 0.65 |
| AI model | Google Gemini Flash |
Note: These figures describe the workflow configuration. Actual companies processed, classification accuracy, human-review rate, and time saved have not yet been measured.
Tech Stack
- n8n: Runs the scheduled automation and manages the classification process.
- HubSpot: Provides company records, approved industry groups, and the destination for validated updates.
- Google Gemini Flash: Analyzes company information and suggests industry classifications with confidence scores and reasoning.
Where This Pattern Applies
- CRM Management Teams: Keep company industry fields consistent across large CRM databases.
- Sales Teams: Organize company records for better segmentation and reporting.
- Marketing Teams: Group companies into relevant industries for targeted campaigns.
- Business Data Teams: Automate data enrichment while routing uncertain records for manual review.
This pattern is useful for businesses that need to enrich large datasets with AI while maintaining control over data quality and ensuring uncertain results receive human review.