Auto-enrich new HubSpot companies with Similarweb traffic
The moment a new HubSpot contact lands, pull their company's monthly visits, top country, and top marketing channels from Similarweb and write it back to the company record.
Build a code workflow that auto-enriches HubSpot companies with Similarweb traffic data the moment a new contact is created. This mirrors the immediate-enrichment pattern Similarweb's official HubSpot CRM integration uses, rebuilt deterministically on our side.
Trigger: an incoming webhook from HubSpot on new contact creation. The HubSpot webhook payload gives us the new contact's ID.
Step 1. Call HubSpot Get Contact for the contact ID, requesting the companies association. Read the primary associated company ID off the response. If the contact has no associated company, end the run cleanly without an error.
Step 2. Call HubSpot Get Company on that company ID and read the company's domain property. If the domain is missing or empty, end the run cleanly.
Step 3. Normalize the domain before sending it to Similarweb. Lowercase it, strip any http:// or https:// prefix, strip a leading www., and drop anything after the first slash. Similarweb rejects domains that include casing, www, or paths.
Step 4. Pick the most recent complete month in YYYY-MM format (Similarweb data lags by about one month; if today is in May, use the previous month). Use country=world and granularity=monthly. Then make three Similarweb calls against the normalized domain for that month:
- Similarweb Visits (Total & Desktop): read the total visits for the month.
- Similarweb Geography (Traffic by Country): read the traffic share per country and pick the top country with its share.
- Similarweb Marketing Channel Visits (Desktop): read desktop visits broken down by channel (Search, Social, Direct, Display Ads, Email, Referrals) and pick the top three channels by share.
If any Similarweb call returns Data Not Found (HTTP 401 in their API) for the domain, end the run cleanly and write nothing. Never partial-write.
Step 5. Call HubSpot Update Company on the same company ID and write structured properties back. Use stable, snake_case property names so sales reps can build HubSpot list views and filters on top of them:
- similarweb_monthly_visits (number): total visits for the month.
- similarweb_top_country (string): 2-letter ISO country code of the top traffic country.
- similarweb_top_country_share (number): traffic share for the top country, as a percent (e.g. 42.3).
- similarweb_top_channel_1, similarweb_top_channel_2, similarweb_top_channel_3 (string): channel names in rank order.
- similarweb_top_channel_1_share, similarweb_top_channel_2_share, similarweb_top_channel_3_share (number): matching channel shares as percents.
- similarweb_enriched_at (datetime): ISO 8601 timestamp of this run, so we can tell when the data was last refreshed.
Keep the property names exactly as listed. Surface a one-time setup note in the workflow that lists the HubSpot company properties to create (with types) before the workflow is enabled.
Reference: Similarweb officially documents this CRM enrichment workflow for HubSpot at https://support.similarweb.com/hc/en-us/articles/23659518990877-Hubspot-Enrichment.
Additional information
What does this prompt do?
- Listens for new contacts created in HubSpot and instantly enriches the company they belong to.
- Pulls last month's total visits, top traffic country, and the top three marketing channels from Similarweb.
- Writes the numbers back to clean, named fields on the HubSpot company so reps can sort, filter, and route on them.
- Quietly skips contacts with no company or no website, so your CRM stays tidy.
What do I need to use this?
- A HubSpot account where you can create webhooks and add company properties.
- A Similarweb account on a plan that includes API access (only an admin can generate the API key).
- A website domain on each company record so Similarweb has something to look up.
How can I customize it?
- Add more enriched fields like bounce rate, average visit duration, or top referring sites.
- Skip enrichment for companies under a visit threshold, or for free-email-only contacts.
- Re-enrich every quarter instead of every new contact, or only when the existing data is older than 30 days.
Frequently asked questions
Will this re-enrich a company every time a new contact comes in?
What if Similarweb has no data for the domain?
Do I need to create new HubSpot properties for this?
Will this overwrite my existing CRM data?
Can I run this on companies I already have, not just new contacts?
Related templates
The moment a new contact lands in HubSpot, we check their email against known data breaches and flag the high-risk ones so your team can act fast.
The moment a new Help Scout conversation arrives, we check the customer in your CRM, flag high-value accounts, and post a priority alert to Slack before anyone touches it.
Every time a new company lands in HubSpot, we look it up on the UK register, save a due-diligence summary to the record, and alert your team to any red flags.
Each weekday morning, spot UK companies registered the day before in your target sectors, add the best fits to HubSpot, and recap them in Slack.
Every time you add a contact in HubSpot, we automatically create or update their Gladly profile so support always sees up-to-date customer details.
Every morning we scan each new company's domain, rate its external security exposure, log the findings to the CRM record, and alert your team when a vendor looks risky.
Stop sizing up accounts by hand.
Connect HubSpot and Similarweb once, and every new contact lights up their company with real traffic data within seconds.