While Authsignal provides a powerful set of predefined data points to create rules with, you may find yourself wanting to create rules based on your own data.

In this guide we will explore how you can create your own custom data points within the rules builder.

Let’s create a rule that will challenge a user when they attempt to withdraw funds over a certain amount.

1. Create the withdrawFunds action

  • Create the withdrawFunds action
  • Head to the Rules section and create a new rule called Challenge large withdrawals
  • Set the Outcome to CHALLENGE

2. Create a custom data point

  • In the Conditions section, click Add feature
  • Click Select feature, then head to the Custom tab
  • Click Create data point and choose Action.
  • Fill in the Name and Description for the data point and choose Type as Number.

The value you provide to the Name field dictates how it must be sent in the track action payload.

  • You should now see a new condition added to your rule. Now, change the operation from == to > and set the value to 2000.

Any custom data point you create will be saved in the Custom section and available tenant-wide, i.e. you can use it in any of your actions and rules.

  • Finally, click the Save button and return to the Rules page for your withdrawFunds action. You should see your new rule listed.

3. Send the custom data in your code

Now that the rule is created, you need to send the withdrawalAmount custom data point in the track action payload. When tracking actions, Authsignal allows you to send a custom object that contains your custom data points. For our withdrawFunds action this will look like:

const request = {
  userId: "dc58c6dc-a1fd-4a4f-8e2f-846636dd4833",
  action: "withdrawFunds",
  attributes: {
    deviceId: "<device-id>",
    userAgent: "<user-agent>",
    ipAddress: "<ip-address>",
    redirectUrl: "https://yourapp.com/callback",
    custom: {
      withdrawalAmount: 2001,
    },
  },
};

const response = await authsignal.track(request);

That’ it! Now when someone tries to withdraw more than $2000, they’ll be challenged. You can verify this worked by checking the Latest activity table in your dashboard.

You can manage all your custom data points in one place at Settings > Rules > Custom data points in the Authsignal Portal.