Reactions

Learn how to configure reactions in the Loyalty Engine, including adding and managing reactions like Adjust Points, Give Reward, Award Badge, and custom webhooks.

Reactions are actions that occur when a reactor is triggered by a specific event and all the defined conditions are met. Once the trigger event is reported, the reactor processes the event, and the reactions are executed. Reactions typically happen shortly after the event is reported, with timing depending on server load. This can range from almost instant to a few seconds.

Reactions allow you to automate key actions in your loyalty program, such as adjusting points, awarding badges, or sending notifications via webhooks. They are an essential part of tailoring your program’s response to user activity and driving the desired outcomes.


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

Adding a points and reward reaction to a reactor

Available reactions

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

Adjust Points

Adjust Points modal in the Create/Edit Reactor screen

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

Adjusting by a fixed amount of points (500)

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

Adjusting by a variable amount of points ($.cost * 2, max 1000 points)

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

Desired reaction
Calculation type
Arguments

Award 1 point per £1 spent

Sum all

Event value: order amount

Award 2 points per £1 spent, maximum award 1000 points (shown in GIF above)

Multiply all

Award 1 point per £1 plus 100 bonus points

Sum all

Event value: order amount Static number: 100

Deduct 1 point per £1 refunded

Multiple all

Event value: refund amount Static number: -1

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.

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

The query editor

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, based on an example event payload. You can adjust the payload data and variables in the expression to see how it affects the result.


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. For more information on JSONPath, you can refer to JSONPath on Wikipedia.

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.

Last updated

Was this helpful?