Introduction

Grow your user-base with referrals

Create a campaign

Refir uses campaigns to give you a workspace for each of your applications. You may create as many projects as you want and organize them however you want.

A campaign is created for you when you create an account, this campaign is named "New Campaign", you can edit this campaign by clicking on the "Campaign" button in Settings.

To get started, create a campaign by clicking on the "+Create Campaign" button in the sidebar and entering a name for your project. For example, you could name your project "my-saas."

API Key

API Keys are used to authenticate your requests to Refir. An API key is created for every campaign.

To check your API key, head to the Campaign page under Settings, then copy the new API key.

Add your first user

With our example campaign and API key, we can now start adding user an event by making a POST request to the Refir API like the following.

npm install refir
# or
yarn add refir
const Refir = require("refir");

const refir = new Refir();
refir.configure({ apiKey: "your-api-key" });

const user = {
  userId: "unique-user-id",
  name: "John Doe",
  email: "johndoe@example.com",
};

const success = await refir.addUser(user);

if (success) {
  console.log("User added successfully.");
} else {
  console.error("Failed to add user.");
}

Once you've made the request, you should see the user appear in the Refir dashboard under the Users page in the "my-saas" project, all in real-time!

Webhook

Referral Webhooks provide a way for you to receive real-time notifications when new users are added to their referral program or when referrals occur. To integrate the Referral Webhook into your project.

Read the Docs on Webhooks

Last updated