# Reactions

## What are reactions?

Reactions are the actions that run when a reactor is triggered by an event and all defined conditions are met.

When an event is reported:

1. The reactor evaluates the event against its conditions.
2. If the conditions are satisfied, the configured reactions are executed.

Reactions usually occur almost instantly, though timing may vary slightly depending on server load.

#### Examples of reactions

* Adjusting a member’s points balance
* Awarding a badge
* Issuing a voucher or gift card
* Sending a notification via webhook

Reactions let you automate how your loyalty program responds to user activity, ensuring consistent and timely engagement.

***

## Adding reactions to a reactor

To add a reaction to a reactor:

1. Create or edit a reactor
2. Scroll to **Reactions** and click the empty + block
3. Choose a reaction to add and specify reaction-specific detail
4. Press **Confirm**
5. **Save** the reactor

{% hint style="warning" %}
Your changes are not saved until you press 'Save' at the bottom of the reactor screen.
{% endhint %}

<figure><img src="https://1999217057-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEFmrMvu6tg0ZiSX9SGEq%2Fuploads%2Fu807FbdZnuidR60ovIYm%2FScreenshot%2016.10.2024%2016.07.gif?alt=media&#x26;token=32978ce9-0502-40d6-b798-bc92828fb9d4" alt=""><figcaption><p>Adding a points and reward reaction to a reactor</p></figcaption></figure>

***

## Available reactions

You can add **one or more** of the following reactions to a reactor:

{% tabs %}
{% tab title="Adjust Points" %}

## Adjust Points

<figure><img src="https://1999217057-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEFmrMvu6tg0ZiSX9SGEq%2Fuploads%2FV8ZxscUhSNLBgbVlqVOa%2FScreenshot%2016.10.2024%2010.34%402x.png?alt=media&#x26;token=c20ab228-44ac-48ba-b3ed-acf9c82e0963" alt="" width="375"><figcaption><p>Adjust Points modal in the Create/Edit Reactor screen</p></figcaption></figure>

The **Adjust Points** reaction allows you to add or remove points from the user's points balance.

Your points adjustment logic can be simple, like adjusting by a **fixed amount** (eg. 100 points for registering) or more advanced, such as awarding a **variable amount** by summing or multiplying different payload values (eg. total transaction value multiplied by 2).

### Fixed points adjustment

To adjust a user's points balance by a fixed amount of points:

1. Select **Sum All** as the *calculation type*
2. Enter the number of points you want to adjust the user's balance by in the *points value* field and press enter
   * *To adjust by a positive amount, enter any figure greater than 0*
   * *To adjust by a negative amount, enter a minus figure (i.e. -500)*
3. Leave *Max Points Award* empty
4. Press **Confirm**

<figure><img src="https://1999217057-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEFmrMvu6tg0ZiSX9SGEq%2Fuploads%2FWc6bon15zuhI1SJjaLmW%2FScreenshot%2016.10.2024%2010.43.gif?alt=media&#x26;token=6e8e8204-9b1a-4fa1-b4c3-8dd9aeb75389" alt="" width="375"><figcaption><p>Adjusting by a fixed amount of points (500)</p></figcaption></figure>

### Variable points adjustment

Adjusting a user's points balance by a variable amount of points allows you to tie points adjustment reactions to values in the event's payload. This is useful for programs where you want to award X points per X currency spent (i.e. 1 point per £1 spent)

To adjust a user's points balance by a variable amount of points:

1. Select either **Multiply All** or **Sum All** as the *calculation type*
2. The reactor's trigger event payload values appear above the points field. Click any value you want to use as part of your calculation to insert it into the points value field.
3. Enter the number you want to multiply by or sum with the event value in the *points value* field and press enter.
   * *To adjust by a positive amount, enter any figure greater than 0 (i.e. 1)*
   * *To adjust by a negative amount, enter a minus figure (i.e. -1)*
4. **Max Points Award** allows you to specify a maximum number of points to be awarded regardless of any calculations you configure.
   * *For example: if you set a maximum limit of 500 and configured the reactor to award 1 point per £1 spent, if a user spends £1000 they would only be awarded 500 points.*
5. Press **Confirm**

<figure><img src="https://1999217057-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEFmrMvu6tg0ZiSX9SGEq%2Fuploads%2FsUtmerMe0AwlqVADOvDk%2FScreenshot%2016.10.2024%2010.58.gif?alt=media&#x26;token=0f4f92e3-3541-4f3f-8bcf-a04ae5c115a5" alt="" width="375"><figcaption><p>Adjusting by a variable amount of points ($.cost * 2, max 1000 points)</p></figcaption></figure>

Let's take a look at some common variable point adjustment setups:

<table><thead><tr><th width="304">Desired reaction</th><th width="152">Calculation type</th><th>Arguments</th></tr></thead><tbody><tr><td>Award 1 point per £1 spent</td><td>Sum all</td><td>Event value: order amount</td></tr><tr><td>Award 2 points per £1 spent, maximum award 1000 points <em>(shown in GIF above)</em></td><td>Multiply all</td><td><a data-footnote-ref href="#user-content-fn-1">Event value: order amount<br>Static number: 2</a></td></tr><tr><td>Award 1 point per £1 plus 100 bonus points</td><td>Sum all</td><td>Event value: order amount<br>Static number: 100</td></tr><tr><td>Deduct 1 point per £1 refunded</td><td>Multiple all</td><td>Event value: refund amount<br>Static number: -1</td></tr></tbody></table>

OK, so that's the theory - let's take a look in practice at both a sum and multiplication example:

#### Multiply all: Award 2 points per £1 spent, maximum award 1000 points

If Anna Smith spent £600, the order amount value in the payload would be 600 (shown as `$.cost` in the GIF above). The reactor takes this value and **multiplies** it by the static number, **2.** This results in 1200 points – however, as a maximum award of 1000 points has been set, the points adjustment has capped at 1000 points and thus Anna's points adjustment is 1000 points.

#### Sum all: Award 1 points per £1 spent plus 100 bonus points

If Max Jones spent £50, the order amount value in the payload would be 50. The reactor takes this value and the static number, 100, and determines the sum of those values (i.e. adds them together). This means 50 + 100 = 150 points awarded.

### Custom query points adjustment

Writing a custom JSONata query for a points reaction allows you to define advanced, conditional logic to handle complex scenarios. The query operates on the payload data provided with the event that triggered the reactor. You can learn more about JSONata [here](https://docs.jsonata.org/overview.html).

To adjust a user's points balance using a custom query:

1. Select either **Multiply All** or **Sum All** as the *calculation type*
2. Click **Custom Query** in the bar above the points field
3. Click the yellow field to open the query editor
4. Enter your query and press **Done**
5. Press **Confirm**

<div data-full-width="false"><figure><img src="https://1999217057-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEFmrMvu6tg0ZiSX9SGEq%2Fuploads%2FLLhocaMhHHpbC8z0rYVk%2FScreenshot%202025-05-20%20at%2015.12.02.png?alt=media&#x26;token=240b6496-caeb-4048-a738-ef1cf44bc21d" alt="" width="375"><figcaption><p>The query editor</p></figcaption></figure></div>

Let's look at a scenario with conditional logic which can be addressed with a custom query:

#### Custom query: Award 10 points per unit, plus 5 bonus points for selected brands and 10 bonus points for spend over £50

If Carl Ward bought 3 units of a product from brand "Coffee Club" at a total line item price of £60, the reactor would calculate reward points using three factors:

* A base rate of 10 points per unit.
* A bonus of 5 points per unit for products from bonus brands like "Coffee Club".
* An extra 10 points for spending more than £50 on a single product line.

Since "Coffee Club" is a bonus brand and the line item total is over the £50 threshold, the calculation would look like this:

* Base: 3 × 10 = 30 points
* Brand bonus: 3 × 5 = 15 points
* Spend bonus: 10 points

In total, 30 + 15 + 10 = **55 points awarded** for this product line.

If multiple products were in the order, the reactor would repeat this calculation for each and add the totals together.

You can see an example of a custom query to address this scenario [here](https://try.jsonata.org/KCdEXshKm), based on an example event payload. You can adjust the payload data and variables in the expression to see how it affects the result.
{% endtab %}

{% tab title="Give Reward" %}

## Give Reward

The **Give Reward** reaction allows you to give any reward which has an associated *benefit* to the user. This includes WLL vouchers and partner gift cards.

When a reward is given as part of a reactor flow:

* The reward is placed in the user's wallet in an unredeemed state
* The cost of the reward is not deducted from the user's wallet
* `PURCHASED_REWARD` and `GIVEN_VOUCHER` events do **not** occur

You can toggle the 'automatically redeem reward' option to have the reward automatically redeem at the same time as it is given to the user.

{% hint style="info" %}
As *offer-type rewards* have no associated *benefit*, they cannot be given as part of a reactor flow. See [reward-types](https://kbase.whitelabel-loyalty.com/product/loyalty-engine/rewards-and-points/rewards/reward-types "mention") for more information.
{% endhint %}

<div data-with-frame="true"><figure><img src="https://1999217057-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEFmrMvu6tg0ZiSX9SGEq%2Fuploads%2FuNY0NHIo9aWYpQuG1jQ3%2FScreenshot%202025-11-09%20at%2020.42.37%402x.jpg?alt=media&#x26;token=ce267a7f-9eaa-442d-8816-60f7da76ca3f" alt=""><figcaption><p>Adding a give reward reaction to a reactor</p></figcaption></figure></div>
{% endtab %}

{% tab title="Award Badge" %}

## Badge

The Award Badge reaction allows you to select a badge to be awarded to the user.

<figure><img src="https://1999217057-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEFmrMvu6tg0ZiSX9SGEq%2Fuploads%2FAAgkkp9RvDNSM5iam4mR%2FScreenshot%2017.10.2024%2023.33%402x.png?alt=media&#x26;token=4ccd8b0c-d6c2-450d-b266-ac0e4827a751" alt="" width="375"><figcaption><p>Award badge selector in reactor create interface</p></figcaption></figure>
{% endtab %}

{% tab title="Custom webhook" %}

## Custom webhook

You can specify one or more custom webhooks to be sent when a reactor is triggered, along with any headers that should be included in the call.

This allows you to trigger action in systems external to the White Label Loyalty platform - such as updating a data field in your CRM, creating an order in your e-commerce platform, or sending an email via your marketing tool.

WLL will forward the full event which triggered the reactor, including:

* The **user's WLL ID** or **auth ID** as the `subject`
* The **event type** as the `type`
* The **event payload,** including any data from any applicable [enhancers](https://kbase.whitelabel-loyalty.com/product/loyalty-engine/events/event-types/event-enhancers), as the `payload`
* Any custom headers specified in the **Headers** field of the webhook reaction itself

You can also choose to pass the full WLL user account details and auth credentials for the webhook's receiving service.

<figure><img src="https://1999217057-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEFmrMvu6tg0ZiSX9SGEq%2Fuploads%2FvZ6VQWcnSy8VnbNx25od%2FScreenshot%202026-02-20%20at%2014.57.56%402x.jpg?alt=media&#x26;token=b7d0e14c-0605-40c8-8da2-3ab4e692f947" alt=""><figcaption><p>Adding a custom webhook reaction to a reactor</p></figcaption></figure>

### Webhook format

You can use a site like [webhook.site](https://webhook.site/) to get a test webhook URL to see the exact format White Label Loyalty will send a webhook in for a particular event. Get the test webhook URL, add it to a reactor, and report an event which triggers that reactor against a user. You will see the results on webhook.site.&#x20;

<figure><img src="https://1999217057-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEFmrMvu6tg0ZiSX9SGEq%2Fuploads%2Fiscxo2VMcJ7pTpPSkbMJ%2FScreenshot%2003.02.2025%2016.25%402x.png?alt=media&#x26;token=eceed045-5496-4cc5-9dfe-ca02ebb63f4f" alt=""><figcaption><p>Viewing a webhook sent from WLL in webhook.site</p></figcaption></figure>
{% endtab %}

{% tab title="Marketing webhook" %}

## Marketing webhook

You can select a push notification to be sent to the user when this reactor triggers.

{% hint style="info" %}
This option is only applicable to customers using our [loyalty-mobile-app](https://kbase.whitelabel-loyalty.com/product/interfaces/white-label-interfaces/loyalty-mobile-app "mention"). See [marketing](https://kbase.whitelabel-loyalty.com/product/modules/marketing "mention") for more information.

If you have your own mobile app, call your own push notification server with a [custom webhook](#custom-webhook) instead.
{% endhint %}
{% endtab %}
{% endtabs %}

***

## FAQs

#### Can I add multiple reactions to a single reactor?

Yes, you can add more than one reaction to a reactor, allowing multiple actions (e.g., awarding points and sending a webhook) to occur when a trigger event is reported.

#### Can reactions be conditional within the same reactor?

Both JSONata and JSONPath is supported in Adjust Points reactions, which allows you to define more advanced logic based on the event’s payload. This can enable some level of conditional behaviour within a reactor, especially when adjusting points based on specific data reported in the event.

For more information on JSONata, you can refer to the documentation [here](https://docs.jsonata.org/overview.html). For more information on JSONPath, you can refer to [JSONPath on Wikipedia](https://en.wikipedia.org/wiki/JSONPath).&#x20;

#### How does the system ensure points are awarded accurately? Are there any checks in place to prevent errors

Points are awarded based on the configuration defined in the reactor's reactions. To avoid issues, we recommend using test mode to thoroughly test any reactor configuration before making them live.

As an additional measure to ensure your setup is correct, you could consider constraining the campaign to a small audience and run a soft launch at first, before removing the constraint and making it available to all of your members.

You should also review the events that trigger the reaction for the first few days after making it live to ensure points are attributing as you expect. You can see the reactors that were triggered and a summary of the reactions that occurred in response to a specific event under the 'Reactions' tab for that event in the Loyalty Console.

[^1]: The event value (let's say £50) is multiplied by 2, equalling 100 points.
