Auto-enrich new HubSpot companies with Similarweb traffic

By General Input

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.

Integrations

  • HubSpot
  • Similarweb

Type

Deterministic Code

Categories

  • Sales
  • Marketing

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.

Related prompts

Explore more prompts
Turn Mailjet email clicks into ranked HubSpot follow-upsiMessage campaign console with pre-flight checks and delivery boardA searchable RFP answer library your bid team drafts fromSee which target accounts just started advertising on LinkedInAccount health board that puts product usage next to your CRMLook up a customer's full chat history mid conversationLusha prospecting workbench with credit-safe revealsWhich companies your LinkedIn ads reach, matched to your CRMLead response desk with a running clock on every new leadApprove Lusha enrichment field by field before HubSpot saves it