Referral links
getReferralLink — create and share the current user's referral link for a campaign
getReferralLink
Returns the current user's referral link for a campaign, creating it on first call. Works for anonymous users too — the link re-binds automatically on identify.
| Parameter | Type | Description |
|---|---|---|
campaignId | string | The campaign to generate a link for (a campaign UUID, from the dashboard or API). |
Returns a ReferralLink — { id, url, code, campaignId }; id is a UUID, and the shareable pieces are e.g. https://mycompany.refr.link/a1b2c3 with code a1b2c3.
invitebase.getReferralLink(campaignId: string): Promise<ReferralLink>const link = await invitebase.getReferralLink('7e1f8a3b-4c26-49d0-b591-0d8e2f6a3c15');
await navigator.share({
title: 'Get a free month of Mycompany',
url: link.url,
});Invitebase.getReferralLink(campaignId: String) async throws -> ReferralLinklet link = try await Invitebase.getReferralLink(campaignId: "7e1f8a3b-4c26-49d0-b591-0d8e2f6a3c15")
let activityVC = UIActivityViewController(
activityItems: [link.url],
applicationActivities: nil
)
present(activityVC, animated: true)suspend fun Invitebase.getReferralLink(campaignId: String): ReferralLinklifecycleScope.launch {
val link = Invitebase.getReferralLink("7e1f8a3b-4c26-49d0-b591-0d8e2f6a3c15")
val share = Intent(Intent.ACTION_SEND).apply {
type = "text/plain"
putExtra(Intent.EXTRA_TEXT, "Get a free month of Mycompany: ${link.url}")
}
startActivity(Intent.createChooser(share, null))
}getReferralLink(campaignId: string): Promise<ReferralLink>import { Share } from 'react-native';
const invitebase = useInvitebase();
const link = await invitebase.getReferralLink('7e1f8a3b-4c26-49d0-b591-0d8e2f6a3c15');
await Share.share({ message: `Get a free month of Mycompany: ${link.url}` });In components, prefer the useReferralLink hook — fetched once, cached, re-bound after identify.
static Future<ReferralLink> Invitebase.getReferralLink(String campaignId)import 'package:share_plus/share_plus.dart';
final link = await Invitebase.getReferralLink('7e1f8a3b-4c26-49d0-b591-0d8e2f6a3c15');
await Share.share('Get a free month of Mycompany: ${link.url}');What's next
handleInbound, resolveReferral, and applyCode — how codes reach the SDK.
Eventstrack — record the events qualification gates evaluate.
Campaigns & progressgetCampaignInfo and getReferrerProgress — the offer and current standing.
RewardsgetRewards, hasReward, and claimReward — the reward ledger.