@wflock/node-flock
v0.0.8
Published
Node.js SDK for Flock Referrals
Downloads
480
Maintainers
Readme
Installation
npm install --save @flock/node-flock
Usage
import { createServerClient } from '@flock/node-flock';
const flock = createServerClient({
serviceAccessKey: 'YOUR_ACCESS_KEY', // Replace YOUR_ACCESS_KEY with your public access key
});
const { campaignId, referrerUserId, referralCode } = await flock.getCampaignMetadata(request);
import { createBrowserClient } from '@flock/node-flock';
const flock = await createBrowserClient({
publicAccessKey: 'YOUR_ACCESS_KEY', // Replace YOUR_ACCESS_KEY with your public access key
campaignId: 'YOUR_CAMPAIGN_ID', // Replace YOUR_CAMPAIGN_ID with your campaign ID
});
flock.identify({
userId: 'USER_ID', // Replace USER_ID with the variable you use to capture the user's ID
email: 'USER_EMAIL', // Optional. Replace USER_EMAIL with the variable you use to capture the user's email
name: 'USER_NAME' // Optional. Replace USER_NAME with the variable you use to capture the user's name
});