Custom rules allow you to define specific conditions and actions to be executed based on incoming events or data. This guide provides an overview of custom rules, their benefits, and how to create and manage them in Greip.

Greip custom rules section

Adding custom rules

To add a custom rule, follow these steps:

1

First Step

Go to the Custom Rules page from the account dashboard.

2

Second Step

Click on the ‘Add Rule’ button from the top right corner of the page to create a new custom rule.

3

Third Step

Give it a title that describes the rule. This will help you identify the rule later, and when the custom rule is applied to an API request, it will be returned in the API response along with the rule ID.

4

Fourth Step

Choose the endpoint then define the conditions and action for the custom rule.

Defining conditions and action

5

Fifth Step

Click the “Add rule” button to save the custom rule.

Once you have added a custom rule, it will be considered immediately when you use the API. If the conditions are met, the action will be executed and the custom rule will be returned in the API response.

Sample response with custom rule

When a custom rule is applied to an API request, the custom rule ID will be returned in the API response. Here is an example of a response with a custom rule:

{
  "status": "success",
  "data": {
    "sample_property": "sample_value",
    "another_property": "another_value",

    "custom_rules_applied": {
      "total": 1,
      "rules": [
        {
          "id": "CR104",
          "message": "Block all payments from specific email address or phone number"
        }
      ]
    }
  }
}

Definitions of custom rule actions

Custom rules can be defined with the following actions: