Overview
The Node.js SDK enables seamless integration of Flock referral and rewards into your backend services. Effortlessly build powerful referral programs, track customer engagement, and manage rewards programmatically.- Identify and manage customers
- Ingest checkpoints to trigger rewards at key milestones
- Webhook event verification
- Fetch live campaigns
- Create and manage referrals
- Officially supported by the Flock team
Installation
Install the SDK using npm or yarn:Quick Start
Initialize the SDK
Your service access key should be kept secure and never exposed in client-side code. This SDK is designed for server-side use only.
Core Features
1. Ingest Checkpoints
Trigger checkpoints to record key milestones in your user journey and/or trigger rewards. See Checkpoints for more details.2. Customer Management
Identify customersCheckpoints are the recommended way to trigger rewards. Configure which checkpoints trigger rewards in the Flock dashboard.
3. Campaign Management
Fetch live campaign details.4. Referral Management
Sometimes, you may want to validate and create a referral from your backend.5. Webhook Verification
Verify webhook events sent from Flock to ensure they are legitimate and secure:6. Direct reward trigger (not recommended)
Trigger rewards programmatically:Best Practices
- Keep your access key secure - Never expose it in client-side code
- Identify users early - Call
identify()before other operations - Use checkpoints for rewards - Configure reward triggers in the dashboard
Support
- Email: support@withflock.com