Skip to Content
ChannelsHubspotHubSpot — Channel Overview

HubSpot — Channel Overview

Researched: May 2026


Why This Channel

HubSpot is the most widely used CRM + marketing automation platform in the SMB and mid-market space globally (200,000+ customers). Unlike Zoho CRM which serves Indian SMBs, HubSpot targets international clients and SaaS companies — a different slice of the Leadmetrics customer base.

Connecting HubSpot closes the content-to-revenue loop: Leadmetrics generates content → content drives traffic → traffic becomes HubSpot contacts → contacts become deals → deal revenue is visible in Leadmetrics. This is the attribution story that makes content marketing defensible in a CFO review.

HubSpot also exposes email sequences, form submissions, and page visit data — all of which can inform the content agents about what language converts.


Auth Mechanism

OAuth 2.0 (standard authorization code flow with token refresh).

  • Auth URL: https://app.hubspot.com/oauth/authorize
  • Token URL: https://api.hubapi.com/oauth/v1/token
  • Scopes: crm.objects.contacts.read crm.objects.contacts.write crm.objects.deals.read forms
  • Token refresh: access token expires in 6 hours; refresh token long-lived

No sub-channel selection needed — one HubSpot portal (account) per connection. The portal ID is stored in subChannelInfo.id.


What It Enables

CapabilityDetail
Contact importSync HubSpot contacts into Leadmetrics Lead + LeadContact tables
Deal pipelinePull deal stages + amounts to measure content → revenue attribution
Form submissionsWhich landing pages generated form fills (closes the landing page ROI loop)
Email performanceOpen rates, click rates for HubSpot sequences (Phase 2)
Content attributionTag which blog post, landing page, or social post drove each contact
Insight workerLead volume trend; top content-to-lead sources; deal conversion rate

Workers Needed

WorkerQueueTrigger
hubspot-sync.worker.ts (new)agent__hubspot-syncOn channel connect + nightly cron 0 1 * * *
hubspot-insights.worker.ts (new)agent__hubspot-insightsWeekly

Insight Worker Output (ChannelInsight)

  • New contacts this month vs last month
  • Top 3 traffic sources (which content types drive HubSpot contacts)
  • Deal pipeline value attributed to Leadmetrics content
  • Form submissions per landing page (last 30 days)
  • Average lead-to-customer conversion time
  • Suggested: content topics correlated with highest-value deals

Channel Detail Page — HubSpotChannelDetail.tsx

Tabs:

  1. Overview — portal name, total contacts, deals this month
  2. Attribution — table of Leadmetrics content → contacts generated
  3. Deals — pipeline stage distribution; value by content source
  4. Insights — AI-generated attribution summary
  5. Suggestions — action items from insight worker

Implementation Plan

Phase 1 — Connect + Contact Sync

  1. Create packages/providers/hubspot/src/index.ts:

    • getAuthUrl(callbackUrl, channelId) — auth URL + state
    • exchangeCode(code, callbackUrl) — returns tokens + hubId (portal ID)
    • refreshAccessToken(refreshToken) — returns new access token
    • getContacts(accessToken, after?)GET /crm/v3/objects/contacts paginated
    • getDeals(accessToken, after?)GET /crm/v3/objects/deals with stage + amount
    • getFormSubmissions(accessToken, formId)GET /form-integrations/v1/submissions/forms/:id
    • verify()GET /oauth/v1/access-tokens/:token
  2. Add OAuth routes to apps/api/src/routers/channel-connect.ts:

    • GET /hubspot/connect → return auth URL
    • GET /hubspot/callback → exchange code, extract hub_id from token, store + close popup
  3. Create packages/agents/src/workers/hubspot-sync.worker.ts:

    • Fetch contacts (incremental via lastmodifieddate filter)
    • Upsert into Lead + LeadContact; set source: "hubspot" + hubspotContactId
    • Fetch deals; store attributed deal value per contact
  4. Add seed entry to packages/db/prisma/seed.ts

  5. Create HubSpotChannelDetail.tsx

Phase 2 — Attribution + Deal Tracking

  1. Attribution logic: when a visitor submits a HubSpot form embedded on a Leadmetrics landing page, pass utm_content=leadmetrics-{activityId} → captured in HubSpot → synced back to attribute the deal to the activity

  2. Add hubspotContactId + source fields to Lead model if not already present

  3. Dashboard widget: “Content Attribution” card on the main dashboard showing leads + deals generated by Leadmetrics content this month

Phase 3 — Email Performance

  1. Pull HubSpot email campaign metrics (open rate, click rate) for sequences tied to leads generated by Leadmetrics content

Seed Entry

// packages/db/prisma/seed.ts — CHANNEL_CATALOGUE { type: "HubSpot", name: "HubSpot", iconKey: "hubspot", description: "Sync contacts and deals from HubSpot to measure content-to-revenue attribution.", authenticationType: "oauth2", requiresUrl: false, isActive: true, categories: ["crm"], },

© 2026 Leadmetrics — Internal use only