Campaigns & progress

getCampaignInfo and getReferrerProgress — the public offer and where the current user stands

Two read methods power referral UI: getCampaignInfo describes the offer (for banners, paywall slots, invite screens), and getReferrerProgress describes the current user's standing (for tier strips and status pages). Both return display-ready formatted strings alongside raw values, so custom UI needs zero math.

getCampaignInfo

The public offer for a campaign: reward values for both sides, tier ladder, qualification summary. Cached with a short TTL, so a home-screen banner does not hammer the network.

ParameterTypeDescription
campaignIdstringThe campaign to describe.

Returns a CampaignInfo with id, name, status (active / paused), referrerReward (formatted, e.g. "$10"), refereeOffer (formatted, e.g. "1 month free", nullable), tiers (threshold + reward), and qualificationSummary (e.g. "Friend starts a paid subscription within 14 days").

invitebase.getCampaignInfo(campaignId: string): Promise<CampaignInfo>
const info = await invitebase.getCampaignInfo('7e1f8a3b-4c26-49d0-b591-0d8e2f6a3c15');
banner.textContent = `Earn ${info.referrerReward.formatted} per friend`;

getReferrerProgress

Where the current user stands as a referrer: referral counts by state (pending / validated), earnings, current tier, and referrals to the next tier. Requires an identified or anonymous user with at least one referral link.

No parameters.

invitebase.getReferrerProgress(): Promise<ReferrerProgress>
type ReferrerProgress = {
  referrals: { pending: number; validated: number };
  earnings: { formatted: string; amount: number; currency: string };
  tier: {
    current: string | null;
    next: string | null;
    referralsToNext: number | null;
  };
};
const progress = await invitebase.getReferrerProgress();
if (progress.tier.referralsToNext !== null) {
  strip.textContent = `${progress.tier.referralsToNext} more referrals to unlock ${progress.tier.next}`;
}

To react the moment progress changes instead of fetching on render, use the change observers.

What's next

On this page