Creating a Reaction
In this guide
We will be creating a reaction, that applies a benefit to a profile, when a certain tier is achieved.
This reaction will apply a benefit instance to the achieving profile, ready for the customer to use on their next transaction.
Before you begin.
You will need:
- A configured Tier Definition
- A configured Benefit Definition
- A configured Point Definition
- An Omneo Profile
Creating via the API
Creating a reaction via the API has a lot less steps than the CX Manager.
You'll need to review the Triggers endpoint first, to ensure you have a basic understanding of the fields required in the call.
In this example, we will be creating a reaction, to apply a benefit when the profile has achieved tier 2
Execute the below into a new terminal window.
Alternatively, you can copy the --data-raw payload into Postman and use the /triggers POST endpoint!
Read Getting started with Postman for more info
curl --location --request POST 'https://api.{YOUR TENANT}.getomneo.com/api/v3/triggers' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {YOUR BEARER TOKEN}' \
--data-raw '{
"name": "Tier Achieve 2",
"trigger": "tier.achieved",
"description": "achieved tier 2",
"is_active": true,
"notes": "some notes",
"actions": [
{
"name": "filter",
"sort_order": 1,
"description": "A description",
"notes": "some more notes",
"arguments":[
{
"name":"condition",
"value":{
"===":[
{
"var":"definition.handle"
},
"tier-2"
]
},
"is_dynamic":null
}
]
},
{
"name": "benefit.create",
"sort_order": 2,
"description": "another description",
"notes": "more notes",
"arguments":[
{
"name":"profile_id",
"value":{
"var":"profile_id"
},
"is_dynamic":true
},
{
"name":"definition",
"value":"test-definition-2",
"is_dynamic":null
}
]
}
]
}'
Explanation of the filter arguments
[
{
"name": "condition",
"value": {
"===": [
{
"var": "definition.handle"
},
"tier-2"
]
},
"is_dynamic": null
}
]
The above filter will be executed first on this reaction, as we've previously set the sort order to 1
This means, that only if this filter results to true
will the reaction continue to process the following actions in the chain (eg. sort order 2, 3, 4 etc)
name:
This filters name property is 'condition'
value:
The value used in the conditional logic. This field is using the "===" logical operator, to validate whether the input field is equal to a specified value.
In short, the logical operator is provided an Array with 2 values.
If the values match, this operator will resolve true, and continue.
In this case, we are selecting the definition.handle
from our tier definition trigger.
if this handle = "tier-1" this will continue on to the following actions.
If this has triggered on another tier, (e.g the profile has achieved handle "tier-4") this filter will not continue.
This is one way we can ensure this trigger only applies to a specific tier achievement.
Explaining the benefit.create action arguments
[
{
"name": "profile_id",
"value": {
"var": "profile_id"
},
"is_dynamic": true
},
{
"name": "definition",
"value": "test-definition",
"is_dynamic": null
}
]
name:
The name of the field we are selecting
value: logic to determine the value of this field
here, we are selecting the profile_id
field of the benefit.create
action
This will pass the profile_id
and use it to apply the benefit
is_dynamic: this is dynamic data, and changes with every execution of this action,
we will se this flag to true
The last object in this action, is the definition data.
use the handle
of your Benefit definition you wish to apply.
This is the definition which will be applied to the profile when the tier is achieved.
6. Save your reaction
7. Navigate to SETTINGS -> REACTIONS and ensure your new reaction i activated.
the green switch should be on
Testing your reaction
- Create or select a profile.
- On your profile, manually assign tier points to achieve the tier defined in your reaction.
you may need to check how many points are needed to achieve your tier definition - Navigate to the "incentives" tab of the profile
You should notice your profile has achieved the tier (in this case "Tier 1")
and, under the list of "issues Benefits" on the right sidebar, you will have an instance of your tier definition applied to the account.
You've now successfully configured a reaction, to apply a benefit when the profile achieves a specific tier.
Going Further.
Now that you've configured this reaction, try adjusting the triggers, or using different logical operators in your JSON logic.
You may wish to apply the benefit on all tier achievements, in this case, just remove the filter.
Try creating a different reaction, for another specific tier, or even use the reward.create
action, to apply a reward instead!
Updated almost 4 years ago