Skip to main content

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 customers
Checkpoints 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:
Direct reward triggering should only be used when checkpoint-based rewards don’t meet your needs. For most use cases, ingesting checkpoints is the recommended approach.
Trigger rewards programmatically:

Best Practices

  1. Keep your access key secure - Never expose it in client-side code
  2. Identify users early - Call identify() before other operations
  3. Use checkpoints for rewards - Configure reward triggers in the dashboard

Support