Create a loyalty points system like Dream11 Dream Coins using Rehook.ai .
BLOG POST

Part Two of Series: How to Create a Loyalty Points System Like Dream11's 'DreamCoins' Using rehook.ai

In Part Two, we explore how to set up advanced action-based rewards using Rehook.ai. Learn how to leverage event count filters and custom properties to create targeted, personalized rewards that drive user engagement and retention in your loyalty program.

8 months ago
6 min read

Welcome back to our series on creating a loyalty points system like Dream11's DreamCoins using Rehook.ai. In part one, we covered the essential aspects of setting up your Rehook.ai account, creating a wallet, and implementing basic action-based rewards for one-time actions like email verification.

Here's where you can find part one of this series: Creating a Loyalty Points System like Dream11 using rehook.ai

In Part Two, we will dive deeper into advanced action-based rewards, focusing on two critical aspects of a successful loyalty program:

  1. First Withdrawal
  2. First Deposit.

These rewards play a crucial role in encouraging users to complete important actions and fostering trust in your platform.

In this guide, we will also be exploring how to leverage Rehook.ai's powerful features, such as event count filters and custom properties, to create targeted and personalized rewards. By utilizing these advanced options, you can ensure that your loyalty program remains engaging and relevant to your users, driving long-term retention and growth.

Throughout this article, we will walk you through the process of setting up advanced action-based rewards for First Withdrawal and First Deposit, providing step-by-step guidance and best practices. By the end of this guide, you will have the knowledge and tools necessary to create a sophisticated and effective loyalty points system that keeps your users motivated and engaged.

So, let's dive in and discover how to take your loyalty program to the next level with advanced action-based rewards using Rehook.ai!

First Withdrawal Reward:

To set up the one-time action for the first withdrawal, navigate to the "Events" section in the Rehook dashboard. Click on the "Create Event" button to define a new user action. In the "Create an event" modal, enter a descriptive name for the event, such as "withdrawal". Under "Event Properties," add three properties:

  1. "withdrawal_id" of type "string"
  2. "amount" of type "number"
  3. "status" of type "string"

The "status" property can have values such as "created", "processing", and "approved". When the status moves to "approved" and it is the user's first withdrawal, they will receive a reward of 50 DreamCoins.

Next, head to the "Campaigns" section in the Rehook dashboard and select "Action Based Reward Campaign". Click on the "Create" button next to "Action Based Reward Campaign". In the campaign creation process, provide a name for your campaign, like "First Withdrawal".

Under the "Earning Rule" section, select the event you created earlier, "withdrawal," as the trigger for the reward. Set the condition to reward users when the "status" property equals "approved" and the "amount" property is greater than "0".

In the "Rewards" section, select the "DreamCoins" wallet you created earlier. Choose "Flat reward" as the reward type and enter "50" as the number of DreamCoins users will receive for their first withdrawal. Set the "Maximum times a user can be rewarded" to "once"

Here's the Node.js code to send the API request to Rehook.ai for the "withdrawal" event:

const axios = require('axios');

const apiKey = '<your_api_key>';
const apiSecret = '<your_api_secret>';
const userId = '<user_id>';
const withdrawalId = '<withdrawal_id>';
const amount = 200;
const status = 'created'; // created, processing, approved

function run(amount, status = "created", withdrawal_id) {
  const requestBody = {
    event_name: 'withdrawal',
    source_id: userId,
    metadata: {
      amount: amount,
      status: status,
      withdrawal_id: withdrawal_id
    }
  };
  
  const auth = `Basic ${Buffer.from(`${apiKey}:${apiSecret}`).toString('base64')}`;
  
  axios({
    method: 'post',
    url: 'https://api.rehook.ai/events/invoke',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': auth
    },
    data: requestBody
  })
  .then(response => {
    console.log('Event triggered successfully!');
  })
  .catch(error => {
    console.error('Error:', error.response.data);
  });
}

run(amount, status, withdrawalId)

By executing the code multiple times with different status values, you will observe that the reward is only attached when the status is set to "approved" for the first time. Subsequent attempts to trigger the reward with the "approved" status will not result in additional rewards being granted.

First Deposit Reward:

To set up the one-time action for the first deposit, navigate to the "Events" section in the Rehook dashboard. Click on the "Create Event" button to define a new user action. In the "Create an event" modal, enter a descriptive name for the event, such as "deposit". Under "Event Properties," add two properties:

  1. "deposit_id" of type "string"
  2. "amount" of type "number"

When the deposit amount is greater than or equal to 25 and it is the user's first deposit, they will receive a reward of 100 DreamCoins.

Next, head to the "Campaigns" section in the Rehook dashboard and select "Action Based Reward Campaign". Click on the "Create" button next to "Action Based Reward Campaign". In the campaign creation process, provide a name for your campaign, like "First Deposit".

Under the "Earning Rule" section, select the event you created earlier, "deposit," as the trigger for the reward. Set the condition to reward users when the "amount" property is greater than or equal to "25".

In the "Rewards" section, select the "DreamCoins" wallet you created earlier. Choose "Flat reward" as the reward type and enter "100" as the number of DreamCoins users will receive for their first deposit of ₹25 or more. Set the "Maximum times a user can be rewarded" to "once".

This setup will ensure that users receive the 100 DreamCoins reward only for their first deposit, and only if the deposit amount is greater than or equal to ₹25.

Here's the Node.js code to send the API request to Rehook.ai for the "deposit and withdrawal" event:

const axios = require('axios');

const apiKey = '<your_api_key>';
const apiSecret = '<your_api_secret>';
const userId = '<user_id>';
const deposit_id = '<deposit_id>';
const amount = 200;

function run(amount, deposit_id) {
  const requestBody = {
    event_name: 'deposit',
    source_id: userId,
    metadata: {
      amount: amount,
      deposit_id: deposit_id
    }
  };
  
  const auth = `Basic ${Buffer.from(`${apiKey}:${apiSecret}`).toString('base64')}`;
  
  axios({
    method: 'post',
    url: 'https://api.rehook.ai/events/invoke',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': auth
    },
    data: requestBody
  })
  .then(response => {
    console.log('Event triggered successfully!');
  })
  .catch(error => {
    console.error('Error:', error.response.data);
  });
}

run(amount, deposit_id)

By executing the code multiple times with different amount values, you will observe that the reward is only attached when the amount is greater than 25 for the first time. Subsequent attempts rewards has not been granted.

Conclusion

In this article, we have explored the power of advanced action-based rewards in creating a highly engaging and personalized loyalty points system using Rehook.ai. By focusing on two critical aspects – First Withdrawal and First Deposit – we have demonstrated how you can leverage event properties and campaign conditions to create targeted rewards that incentivize users to complete these important actions. The step-by-step process outlined in this guide showcases the ease and flexibility of setting up advanced rewards using Rehook.ai, allowing you to craft rewards that celebrate users' milestones and encourage deeper engagement with your platform.

As you implement these First Withdrawal and First Deposit rewards, it's crucial to monitor user data and campaign performance using Rehook.ai's analytics tools. By gaining insights into user behavior and preferences, you can continually optimize and refine your rewards strategy to maximize engagement and retention. Moreover, the scalability of Rehook.ai's platform allows you to expand your loyalty program as your user base grows, ensuring that your program remains efficient and effective, even as you introduce new rewards and campaigns.

Take the first steps towards growth
Book your free consultation with our team and learn about all the ways you can grow your business, engage your customers and improve retention with our marketing solutions and retention programs.

In conclusion, by focusing on advanced action-based rewards and utilizing the full potential of Rehook.ai's platform, you can create a loyalty points system that truly sets your brand apart.

Stay tuned for the next instalment, where we'll explore further how to maximize the impact of your loyalty program and ensure that your platform remains a preferred choice for your users. Together, let's create an ecosystem of rewards that encourages, recognizes, and values the participation of every user.

Take the first steps towards growth
Every user-interaction is a promotional opportunity. Unlock the power of personalized, high-impact promotions that boost growth, user engagement and retention - without any tech effort.