Automate HubSpot Deal Assignments with n8n Workflow

This n8n workflow automates the assignment of unassigned HubSpot deals based on region and company size, saving sales teams hours of manual work and ensuring timely follow-up. It streamlines deal distribution by automatically allocating leads to the right sales rep according to specific criteria.
scheduleTrigger
httpRequest
switch
+3
Workflow Identifier: 2042
NODES in Use: Schedule Trigger, HTTP Request, Split Out, Filter, Switch, HubSpot

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

Visit through Desktop for Best experience

Streamlining Sales Pipeline Management: Maria’s HubSpot Deal Assignment Puzzle

Maria manages a growing sales team for a tech startup using HubSpot CRM. Every day, unassigned deals pile up, creating bottlenecks as her team wastes precious hours manually sorting deals based on region and company size. Mistakes often happen, with deals slipping through the cracks or going to the wrong sales rep, leading to lost revenue and frustrated prospects. Maria knows that if she could automate the assignment process, her team could focus more on closing deals than organizing them.

This specific challenge, where deals must be assigned dynamically based on geographic location and company size, is exactly what this n8n workflow solves.

What This Automation Does 🔧

When the workflow runs, it automatically fetches unassigned HubSpot deals and processes the assignment with precise business logic. Here’s what happens:

  • Retrieves all unassigned deals from HubSpot CRM every 2 days at 7 AM.
  • Filters out deals without an assigned owner.
  • Enriches each deal with associated contact and company information.
  • Sorts deals by region (United States or Germany mainly).
  • Assigns deals to specific sales reps based on company size within that region.
  • Ensures that no deal is left unassigned; fallback assignment or notification can be added.

This automation saves Maria’s team hours weekly by eliminating manual deal sorting and routing, reducing human error and speeding up customer outreach.

Prerequisites ⚙️

  • HubSpot account with access to deals, contacts, and companies data.
  • n8n account (cloud or self-hosted). For self-hosting, consider options like Hostinger.
  • Configured HubSpot OAuth2 credentials in n8n for API access.

Step-by-Step Guide to Build This Workflow

Step 1: Create a Schedule Trigger to Run Automatically
Navigate to Triggers in n8n, select Schedule Trigger, and set it to run every 2 days at 7 AM.
You’ll see a box with interval settings — configure as shown: daysInterval = 2, triggerAtHour = 7.
This ensures your workflow runs regularly without manual intervention.
Common mistake: forgetting to set the interval properly, so the workflow runs too often or not at all.

Step 2: Fetch Deals from HubSpot with HTTP Request
Add an HTTP Request node and configure it to GET deals from HubSpot’s API endpoint: https://api.hubapi.com/crm/v3/objects/deals?properties=dealname,amount,hubspot_owner_id&associations=contacts.
Use your HubSpot OAuth2 credentials for authentication.
You should see JSON data with deals when you test this node.
Common mistake: not using proper authentication or missing required deal properties.

Step 3: Split Deals into Individual Items
Add a Split Out node and configure it to split the “results” array from the previous HTTP request.
This allows the workflow to handle one deal at a time, making further processing easier.
After running, you should see single deal items instead of arrays.
Common mistake: forgetting to specify “results” as the field to split out.

Step 4: Filter Only Unassigned Deals
Add a Filter node named “Unassigned Deals”.
Set a condition to check if the deal’s hubspot_owner_id property is empty.
This filters out deals that already have owners.
You should see only deals without owners pass through.
Common mistake: incorrect property path (make sure it matches your HubSpot response).

Step 5: Fetch Associated Contact for Each Deal
Add an HTTP Request node “Get contact for deals”.
Use the dynamic URL: https://api.hubapi.com/crm/v3/objects/contacts/{{ $json.associations.contacts.results[0].id }}?associations=company.
This fetches the primary contact for a deal and includes associated company data.
Authenticate using HubSpot OAuth2.
Test and confirm contact data is returned.
Common mistake: deals without contacts might cause errors; add checks in production.

Step 6: Retrieve Company Details
Add another HTTP Request node “Get company of contact(s)”.
URL to call: https://api.hubapi.com/crm/v3/objects/companies/{{ $json.associations.companies.results[0].id }}?properties=name,domain,city,country,numberofemployees.
This step enriches the workflow with company size, country, and other important data.
You’ll need the company’s id from the contact associations.
Common mistake: company data might be missing; consider fallback logic.

Step 7: Assign Deals by Region Using Switch Node
Insert a Switch node named “Assign by Region”.
Set rules for country property:
– Output “US” if country equals “United States”
– Output “DE” if country equals “Germany”
– Fallback output for any other country
This step helps route the deals appropriately.
Common mistake: typos in country names causing unmatched rules.

Step 8: Assign US Deals by Company Size
Use a Switch node “Assign US deals by company size” to split companies into size categories:
– John receives deals for companies with ≤ 50 employees
– Max for companies ≤ 499 employees
– Eeden for companies ≥ 500 employees
Connect outputs to HubSpot nodes to assign the deal owner accordingly.
Common mistake: improper number comparisons in switch conditions.

Step 9: Assign DE Deals by Company Size
Similarly, use another Switch node “Assign DE deals by company size” with customized size groups tailored for German deals:
– Michael, Suka, and Eeden get assigned based on employee count.
Same connection to HubSpot deal update nodes.
Common mistake: mixing up size thresholds between US and DE nodes.

Step 10: Update HubSpot Deal Owner Fields
Multiple HubSpot nodes update the dealOwner field for each filtered deal.
Each node must reference the current deal’s ID dynamically: {{ $('Unassigned Deals').item.json.id }}.
Select the correct user ID for the sales rep.
On successful run, the deal owner in HubSpot updates automatically.
Common mistake: incorrect OAuth scopes could cause authorization errors.

Customizations ✏️

  • Adjust Schedule Interval: In the Schedule Trigger node, change the daysInterval and triggerAtHour parameters to run more or less frequently.
  • Add More Regions: Expand the Assign by Region Switch node with additional country rules to cover new territories.
  • Customize Company Size Ranges: Modify the thresholds in the Assign US deals by company size and Assign DE deals by company size switch nodes to fit your sales team’s definition.
  • Add Notifications: Replace the fallback assignment node with a Slack or email notification node to alert managers about unassigned deals.
  • Handle Missing Contacts: Insert an If or Function node after “Unassigned Deals” to check if contacts exist, skipping or logging deals without contacts.

Troubleshooting 🔧

Problem: “HTTP Request node returns 401 Unauthorized”
Cause: OAuth credentials expired or improperly configured.
Solution: Reauthorize HubSpot credentials under Credentials in n8n and test again.

Problem: “No deals pass filter for unassigned deals”
Cause: The filter condition is too strict or property path is incorrect.
Solution: Verify the property hubspot_owner_id matches the API response JSON exactly.

Problem: “Switch node outputs all deals to fallback branch unexpectedly”
Cause: Country names or number types mismatched.
Solution: Double-check exact country spelling and numeric value formats in the switch conditions.

Pre-Production Checklist ✅

  • Have you added and tested your HubSpot OAuth2 credentials in n8n?
  • Does the Get Deals HTTP node fetch deals correctly with expected properties?
  • Did the filter node correctly pass unassigned deals?
  • Are contact and company HTTP requests returning valid data?
  • Test switch nodes with example deals from US and Germany covering different company sizes.
  • Verify all HubSpot update nodes correctly modify the deal owner field.
  • Backup your workflow before activation to restore if needed.

Deployment Guide

Activate your workflow in n8n once setup and testing are complete.
Monitor executions in the n8n dashboard for errors or skipped items.
You can enable email notifications or Slack messages on workflow failure for proactive alerting.
Regularly review HubSpot to confirm deals are assigned as expected.
Adjust any thresholds or user IDs as your sales team changes.

Frequently Asked Questions

Q: Can I assign deals to more than two regions?
A: Yes, add more conditions in the Assign by Region switch node for new countries.

Q: Does this workflow use a lot of API calls?
A: It makes multiple API requests per deal but runs only every 2 days by default, balancing efficiency with real-time needs.

Q: Is my data safe using OAuth2 credentials?
A: Yes, OAuth2 securely authorizes access without exposing your password and can be revoked anytime.

Conclusion

By completing this automation, Maria has transformed her manual deal assignment headache into a seamless, consistent process that matches leads to the right sales rep based on region and company size. What took hours each week now runs automatically every 2 days, boosting team efficiency and closing potential faster.

Next steps could be automating deal follow-ups via email, integrating Slack notifications for new deals, or syncing deal stages with other tools using n8n. Dive in, customize this workflow to your needs, and watch your sales pipeline flow effortlessly!

Promoted by BULDRR AI

Related Workflows

Automate Viral UGC Video Creation Using n8n + Degaus (Beginner-Friendly Guide)

Learn how to automate viral UGC video creation using n8n, AI prompts, and Degaus. This beginner-friendly guide shows how to import, configure, and run the workflow without technical complexity.
Form Trigger
Google Sheets
Gmail
+37
Free

AI SEO Blog Writer Automation in n8n (Beginner Guide)

A complete beginner guide to building an AI-powered SEO blog writer automation using n8n.
AI Agent
Google Sheets
httpRequest
+5
Free

Automate CrowdStrike Alerts with VirusTotal, Jira & Slack

This workflow automates processing of CrowdStrike detections by enriching threat data via VirusTotal, creating Jira tickets for incident tracking, and notifying teams on Slack for quick response. Save hours daily by transforming complex threat data into actionable alerts effortlessly.
scheduleTrigger
httpRequest
jira
+5
Free

Automate Telegram Invoices to Notion with AI Summaries & Reports

Save hours on financial tracking by automating invoice extraction from Telegram photos to Notion using Google Gemini AI. This workflow extracts data, records transactions, and generates detailed spending reports with charts sent on schedule via Telegram.
lmChatGoogleGemini
telegramTrigger
notion
+9
Free

Automate Email Replies with n8n and AI-Powered Summarization

Save hours managing your inbox with this n8n workflow that uses IMAP email triggers, AI summarization, and vector search to draft concise replies requiring minimal review. Automate business email processing efficiently with AI guidance and Gmail integration.
emailReadImap
vectorStoreQdrant
emailSend
+12
Free

Automate Email Campaigns Using n8n with Gmail & Google Sheets

This n8n workflow automates personalized email outreach campaigns by integrating Gmail and Google Sheets, saving hours of manual follow-up work and reducing errors in email sequences. It ensures timely follow-ups based on previous email interactions, optimizing communication efficiency.
googleSheets
gmail
code
+5
Free