← View All Guides
Customer.io logo
Integration Guide

How to Send Referral Triggered Emails with Customer.io + GrowSurf

Create event-driven referral emails in Customer.io triggered by GrowSurf referral program events.

Customer.io's event-driven architecture is purpose-built for the kind of real-time, contextual messaging that referral programs need. Instead of batch campaigns, Customer.io lets you trigger individual emails based on specific actions β€” making it ideal for instant referral notifications, personalized milestone celebrations, and timely re-engagement prompts.

This guide covers connecting GrowSurf referral events to Customer.io, building triggered campaigns for each stage of the referral journey, and using Customer.io's segmentation and A/B testing features to optimize your referral email performance.

Integration Steps

Step 1: Set Up GrowSurf Events in Customer.io

Send GrowSurf referral events to Customer.io so they can trigger campaigns and workflows.

  • Use Customer.io's Track API to send events from your webhook handler
  • Events to track:
    • referral_program_joined
    • referral_made
    • referral_converted
    • referral_reward_earned
  • Include event attributes: referral_code, referrer_email, referral_count, reward_type
  • Also update customer attributes: referral_link, referral_status, total_referrals

Step 2: Build the Referral Welcome Campaign

Create a Customer.io campaign that welcomes new referral program participants.

  • Go to Campaigns > Create Campaign
  • Trigger: Event "referral_program_joined" is received
  • Email 1 (Immediate): Welcome with referral link, reward explanation, sharing tips
  • Delay 2 days
  • Branch: Check attribute total_referrals > 0
  • True: Exit (they're already active)
  • False: Email 2 β€” "Your friends are waiting" with easy sharing CTAs
  • Delay 5 days β†’ Email 3: "Last reminder" with urgency and social proof

Step 3: Create Real-Time Referral Notification Emails

Send instant notifications when referral events happen.

  • Create a campaign triggered by "referral_made" event
  • Send to the referrer (use the referrer's email from event attributes)
  • Subject: "{{friend_name}} just signed up through your link!"
  • Body: congratulations, updated referral count, progress toward next reward
  • Send within seconds of the event for maximum impact

Step 4: Build Milestone Celebration Messages

Trigger celebration emails when referrers hit specific milestones.

  • Create campaigns for each milestone:
    • First referral: special congratulations + next reward preview
    • 5th referral: "Power Referrer" status + upgraded perks
    • 10th referral: "Champion" status + personal thank-you from CEO
  • Use event-triggered campaigns with attribute conditions on total_referrals
  • Include dynamic content showing their referral stats and leaderboard position

Step 5: Set Up Referred Friend Drip Campaign

Create a targeted email sequence for people who were referred.

  • Trigger: "referral_program_joined" where referred_by attribute is set
  • Email 1 (Immediate): "{{referrer_name}} thought you'd love this" β€” personalized welcome
  • Email 2 (Day 1): Product highlights and exclusive referred-friend offer
  • Email 3 (Day 3): Urgency β€” "Your exclusive offer expires soon"
  • Filter out contacts already in regular welcome campaigns to avoid overlap

Step 6: Optimize with A/B Testing and Analytics

Use Customer.io's analytics to measure and improve referral email performance.

  • A/B test subject lines: personal referral mention vs. reward-focused vs. curiosity-driven
  • Test send timing: immediate vs. 1-hour delay for notification emails
  • Track downstream metrics: email open β†’ click β†’ actual referral sharing activity
  • Use Customer.io's conversion tracking to measure if emails lead to more referral activity

Code Snippets

// Send GrowSurf events to Customer.io Track API
const { TrackClient, RegionUS } = require('customerio-node');
const cio = new TrackClient(
  process.env.CIO_SITE_ID,
  process.env.CIO_API_KEY,
  { region: RegionUS }
);

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

  // Identify/update the participant in Customer.io
  await cio.identify(participant.email, {
    email: participant.email,
    first_name: participant.firstName || '',
    last_name: participant.lastName || '',
    referral_code: participant.referralCode,
    referral_link: participant.shareUrl,
    referral_status: 'active',
    total_referrals: participant.referralCount || 0,
    referred_by: referrer?.email || '',
    referral_program_join_date: Math.floor(Date.now() / 1000)
  });

  // Track the referral event
  const eventMap = {
    'PARTICIPANT_CREATED': 'referral_program_joined',
    'PARTICIPANT_REFERRED': 'referral_made',
    'CAMPAIGN_REFERRAL_CONVERTED': 'referral_converted',
    'PARTICIPANT_REACHED_REWARD': 'referral_reward_earned'
  };

  const cioEvent = eventMap[event];
  if (cioEvent) {
    await cio.track(participant.email, {
      name: cioEvent,
      data: {
        referral_code: participant.referralCode,
        referrer_email: referrer?.email,
        referrer_name: referrer?.firstName,
        referral_count: participant.referralCount || 0,
        timestamp: Math.floor(Date.now() / 1000)
      }
    });
  }

  // Also update the referrer's profile if applicable
  if (referrer) {
    await cio.identify(referrer.email, {
      total_referrals: referrer.referralCount || 0,
      last_referral_date: Math.floor(Date.now() / 1000)
    });
  }

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

Tips

Use Customer.io's Liquid Templates for Dynamic Referral Content

Customer.io supports Liquid templating in emails. Use it to show dynamic referral stats: You've referred {{customer.total_referrals}} friends so far! and conditional content based on referral tier. This creates personalized emails without needing separate templates for each tier.

Set Up Conversion Goals for Referral Campaigns

Define conversion goals in Customer.io (e.g., "made a referral within 7 days of receiving email") to measure actual email impact on referral behavior. This is more meaningful than open/click rates because it tells you if the email actually drove the desired action.

Use Customer.io's Segment Integration for Unified Events

If you're already using Segment for your data pipeline, connect Segment as a Customer.io source. This means your GrowSurf events flow through Segment to Customer.io automatically, without building a separate integration. One event pipeline powers both analytics and email.

FAQ

How is Customer.io different from Mailchimp or Klaviyo for referral emails?

Customer.io is event-driven by design β€” every email is triggered by a specific action, not sent to a batch list. This makes it ideal for referral programs where you need instant, contextual emails ("Your friend just signed up!"). Mailchimp is better for campaign-style emails to segments. Klaviyo is strong for e-commerce and also supports events well.

Can I trigger Customer.io campaigns from GrowSurf events without code?

You can use Zapier to connect GrowSurf to Customer.io without coding. Set up a Zap that triggers on GrowSurf events and uses Customer.io's Zapier actions to track events and update customer profiles. This is simpler than custom code but may have a slight delay compared to direct API integration.

How do I handle email suppression for contacts in multiple referral campaigns?

Use Customer.io's campaign-level suppression and frequency capping. Set rules like "don't send if already received a referral email in the last 24 hours" to prevent email fatigue. You can also use segments to exclude contacts who are currently active in another campaign.

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