← View All Guides
HubSpot logo
Integration Guide

How to Track Referrals in HubSpot CRM with GrowSurf

Sync referral data to HubSpot CRM contacts and track the full referral journey from click to customer.

HubSpot CRM is where your sales and marketing teams live β€” so your referral data should be there too. By integrating GrowSurf with HubSpot, you can automatically sync referral participant data to HubSpot contacts, giving your team complete visibility into which leads came from referrals and who referred them.

This guide walks you through connecting GrowSurf referral events to HubSpot CRM using webhooks and HubSpot's API. You'll learn how to create custom contact properties for referral data, automatically update contacts when they're referred, and build HubSpot lists and reports filtered by referral source. The result is a unified view of your referral program's impact on your sales pipeline.

Integration Steps

Step 1: Create Custom Contact Properties in HubSpot

Before syncing data, create custom properties in HubSpot to store referral information on contact records.

  • Go to Settings > Properties in HubSpot
  • Create these custom properties under a "Referral Program" group:
    • referral_source (Single-line text) β€” stores "growsurf"
    • referred_by_email (Single-line text) β€” the referrer's email
    • referral_code (Single-line text) β€” the participant's unique referral code
    • referral_status (Dropdown) β€” options: Participant, Referred, Converted
    • referral_date (Date picker) β€” when the referral occurred
    • total_referrals_made (Number) β€” count of successful referrals

Step 2: Set Up GrowSurf Webhooks for Contact Sync

Configure GrowSurf to send webhook events when participants are created, referrals happen, and conversions occur.

  • In GrowSurf, go to Campaign > Settings > Webhooks
  • Add your webhook endpoint URL
  • Enable events: PARTICIPANT_CREATED, PARTICIPANT_REFERRED, CAMPAIGN_REFERRAL_CONVERTED
  • Note the webhook secret for signature verification

Step 3: Build the Webhook Handler for HubSpot Sync

Create a server-side endpoint that receives GrowSurf events and creates or updates HubSpot contacts with referral data.

  • Parse the GrowSurf webhook payload for participant details
  • Use HubSpot's Contacts API to search for existing contacts by email
  • Create new contacts or update existing ones with referral properties
  • Handle each event type differently (new participant vs. referral vs. conversion)

Step 4: Map GrowSurf Data to HubSpot Properties

Define the data mapping between GrowSurf participant fields and HubSpot contact properties.

  • Map participant.email to HubSpot contact email (primary identifier)
  • Map participant.referralCode to referral_code
  • Map participant.referredBy to referred_by_email
  • Map referral count to total_referrals_made
  • Set referral_status based on the event type

Step 5: Build HubSpot Lists for Referral Segments

Create active lists in HubSpot that automatically segment contacts by their referral activity.

  • Create a list for "All Referral Participants" (where referral_source = growsurf)
  • Create a list for "Referred Leads" (where referred_by_email is known)
  • Create a list for "Top Referrers" (where total_referrals_made > 5)
  • Use these lists for targeted email campaigns and sales outreach

Step 6: Create Referral Attribution Reports in HubSpot

Build custom reports in HubSpot to visualize referral program performance alongside your other marketing channels.

  • Create a custom report showing deals by referral_source
  • Build a funnel report tracking referral leads through your sales pipeline
  • Compare referral lead conversion rates to other lead sources
  • Set up a dashboard widget showing monthly referral lead volume

Code Snippets

// Sync GrowSurf referral data to HubSpot CRM
const hubspot = require('@hubspot/api-client');
const hubspotClient = new hubspot.Client({ accessToken: process.env.HUBSPOT_TOKEN });

app.post('/api/growsurf-to-hubspot', async (req, res) => {
  const { event, participant, referrer } = req.body;

  const contactProperties = {
    email: participant.email,
    firstname: participant.firstName || '',
    lastname: participant.lastName || '',
    referral_source: 'growsurf',
    referral_code: participant.referralCode,
    referral_date: new Date().toISOString().split('T')[0]
  };

  if (event === 'PARTICIPANT_REFERRED' && referrer) {
    contactProperties.referred_by_email = referrer.email;
    contactProperties.referral_status = 'Referred';
  } else if (event === 'CAMPAIGN_REFERRAL_CONVERTED') {
    contactProperties.referral_status = 'Converted';
  } else {
    contactProperties.referral_status = 'Participant';
  }

  try {
    // Try to update existing contact
    await hubspotClient.crm.contacts.basicApi.update(
      participant.email,
      { properties: contactProperties, idProperty: 'email' }
    );
  } catch (e) {
    if (e.code === 404) {
      // Create new contact
      await hubspotClient.crm.contacts.basicApi.create({
        properties: contactProperties
      });
    }
  }

  // Update referrer's referral count
  if (referrer) {
    const referralCount = referrer.referralCount || 1;
    await hubspotClient.crm.contacts.basicApi.update(
      referrer.email,
      { properties: { total_referrals_made: referralCount.toString() }, idProperty: 'email' }
    );
  }

  res.json({ success: true });
});

Tips

Use HubSpot Workflows to Nurture Referred Leads

Create HubSpot workflows triggered by the referral_status property changing to "Referred." Send a personalized welcome email that acknowledges they were referred and highlights special onboarding offers β€” referred leads convert better when they feel the personal connection.

Sync Bidirectionally for Complete Data

Don't just push data from GrowSurf to HubSpot β€” also update GrowSurf when HubSpot deal stages change. This lets GrowSurf trigger reward fulfillment when a referred contact becomes a customer in your HubSpot pipeline.

Tag Referral Sources in HubSpot's Attribution Reports

Set the hs_analytics_source property to a custom value for referral contacts so they appear correctly in HubSpot's built-in attribution reports alongside organic, paid, and social sources.

FAQ

Can I use HubSpot's native integration instead of webhooks?

GrowSurf offers a native HubSpot integration that handles basic contact syncing automatically. However, building a custom webhook integration gives you more control over which fields are synced, how data is mapped, and when updates occur. Use the native integration for simple setups and custom webhooks for advanced requirements.

How do I avoid creating duplicate contacts in HubSpot?

Always search for an existing contact by email before creating a new one. HubSpot's API returns a 409 conflict error if a contact with that email exists. Use the update-or-create pattern shown in the code example to handle both cases gracefully.

Can I track which referral campaign a contact came from if I run multiple campaigns?

Yes. Include the GrowSurf campaign ID in the contact properties. Create a custom property called referral_campaign_id and populate it from the webhook payload's campaign data. This lets you segment contacts by specific referral campaigns.

Set up your refer a friend program with customer referral and affiliate program software that lowers your acquisition costs, increases customer loyalty, and saves you gobs of time.

Trusted by marketing and product teams at fast-growing B2C, fintech, and SaaS companies