Route new HubSpot leads to the right sales territory
When a new contact lands in HubSpot, we work out where they are connecting from, note the company behind it, and post them to the right territory channel.
Whenever a new contact is created in HubSpot, look up where that lead is connecting from, save what I learn back onto the contact, and route them to the right sales territory channel in Slack. Use a poll trigger on HubSpot for newly created contacts.
HubSpot records the visitor IP address on the contact, so the new contact from the trigger already carries what the lookup needs and there is no extra fetch. Read the IP address from the contact. If the contact has no IP address, or the address is a private or non routable one, skip that contact and do nothing.
Run the IPinfo Get Full IP Details operation on that address to resolve the city, region, country and timezone.
Then run the IPinfo Core / Plus IP Lookup on the same address to surface the company and network owner behind it, along with the privacy and network type flags that say whether this is a residential ISP connection or a datacenter or hosting range.
If the lookup shows the address belongs to a VPN, a proxy, a Tor exit node, or a hosting or datacenter provider, do not assign a territory. The location is not trustworthy enough to route on. Flag the lead for manual review instead: post it to the manual review channel in Slack with the contact details, the raw location, the network owner, and the reason it was held back. Do not post it to a territory channel.
For every other lead, write the resolved country, region, timezone and network owner back onto the contact with the HubSpot Update Contact operation.
Then run HubSpot Search Companies on the organisation name behind the IP to check whether that account already exists in my CRM, so we do not open a duplicate account. Treat a confident name match as an existing account and anything else as net new. Do not create a company record either way; this step is only a check.
Finally, post to the Slack channel for the matching sales territory using the Slack Bot Send a Message operation. Map the resolved country to a territory: Europe, the Middle East and Africa go to the EMEA channel, North and South America go to the AMER channel, and Asia Pacific countries go to the APAC channel. If the country does not map cleanly to one of the three, send it to the manual review channel rather than guessing.
Each territory message should name the contact and their email, the city, region and country the lead is connecting from, the inferred company and network owner, and whether that organisation is an existing account or net new. Keep it to a short readable summary a rep can act on, and link to the HubSpot contact record where possible.
Additional information
What does this prompt do?
- Watches HubSpot for new contacts and works out where each one is connecting from, including city, region, country and time zone.
- Identifies the company or network behind the connection and checks whether that organisation is already an account in your CRM.
- Saves the location and network owner onto the contact record, then posts the lead to the matching territory channel in Slack: EMEA, AMER or APAC.
- Flags leads connecting through a VPN or a hosting provider for manual review, because their location is not reliable enough to assign a territory.
What do I need to use this?
- A HubSpot account where new contacts are created, with the visitor IP address recorded on the contact record.
- An IPinfo account. A free account covers the basic location lookup; the company details and VPN detection come with a paid plan.
- A Slack workspace with a channel for each sales territory you route to, plus one channel for leads held back for manual review.
How can I customize it?
- Change the territory map. The default splits EMEA, AMER and APAC by country, but you can route by region or by individual country, or add more territories.
- Choose which channel each territory posts to, and where flagged leads go for manual review.
- Decide which details get saved onto the contact. Country, region, time zone and network owner are the defaults.
FAQs
Will this work on HubSpot Free?
Where does the location actually come from?
What happens if someone is browsing through a VPN?
Is location from an IP address accurate enough to assign a territory?
Will it create duplicate companies in my CRM?
Related templates
Every weekday, find every unpaid JobNimbus invoice, email each customer one reminder that gets firmer as it ages, and post a receivables summary to Slack.
Every weekday at 7am, your active courses are checked for missing work, silent logins, and slipping grades, with a ranked list sent to your advising channel.
Every hour, find the tickets closest to breaching, leave a nudge on each one, and post a ranked at-risk list to your support channel.
Every weekday afternoon, each student who is behind gets a warm, personal message in their Canvas inbox listing exactly what they owe.
Every Monday at 8am, see exactly which assignments have work waiting, sorted worst first, posted to Slack and logged to a spreadsheet.
Every weekday morning we compare your password vault against your HR records and suspend access for anyone who has already left.
Stop guessing which rep owns an inbound lead.
Every new contact lands in the right territory channel, already enriched and checked against your CRM.