Awarding 1000 points for 3 purchases over $300 each
Prerequisites
- Create your Integration API key.
- If you haven't done so already, fork our Sample Campaigns collection in Postman:
- In the Campaign Manager, open the ADVANCED-GAMIFICATION: Spend more than $300 3 times and get 1000 points demo campaign and click Activate Campaign.
- Open the Rule Builder to get some context.
Let's create a gamification promotion rule that gives 1000 loyalty points to customers who spend over $300 3 times. Their 3 qualifying spends need not be consecutive.
This tutorial shows how we can use native Talon.One features as workaround to create complex rules. In this case, we'll use a fake loyalty program to count sessions.
Creating the promotion
In the current scenario, let's use 2 rules:
- Count Transactions over $300
- 3rd transaction over $300
Creating the subledger accessor
Let's create a subledger in our loyalty program to keep track of the number of sessions of a given value each customer makes.
- Click Subledger accessor.
- Set Loyalty program to Transaction counter and in Subledger type
TransactionOver300
. This creates a new subledger inside the Ledgers loyalty program. - Save it as
TransactionOver300
.
Rule 1: Count transactions over $300
Let's add a free item to sessions when they reach $300:
Conditions:
- Check for default event: Customer Closing session.
- Validate attribute value: Session Total (Current Session)
is greater than 300
.
Effect: Add loyalty points and select:
- Loyalty program: Ledgers
- Subledger name:
TransactionOver300
- Recipient: Current customer (friend)
- Reason:
1 transaction over $300
- Amount of points:
1
This use of a subledger allows us to keep track of the number of transactions of 300. It's not related to points in this case. It functions as a counter.
Rule 2: 3rd transaction over $300
This rule detects the third transaction and grants 1000 points.
Conditions:
- Check for default event: Customer Closing session.
- Validate attribute value: Session Total (Current Session)
is greater than 300
. - Validate attribute value: Current Balance (TransactionOver300)
is equal to 3
.
Effect: Add loyalty points and select:
- Loyalty program to Sample Wallet. Note that we do not use the subledger for this.
- Recipient to Current Customer.
- Reason to
1000 bonus points
. - Amount of point to
1000
.
When a customer places an order for the third time, they will get 1000 points.
Running the campaign
To run and test the campaign, we need 3 requests to trigger our 2 rules. We send the requests to the Integration API's Update customer session endpoint.
A customer makes 2 purchases of $300 each
- 🚀 Request
- ✅ Response
Let's send 2 requests for the same customer profile but with different sessions. That cart has a total value of $310 every time. The sessions must be closed.
CURL -X PUT https://mycompany.europe-west1.talon.one/v2/customer_sessions/my_session_id -d
'{
"customerSession": {
"profileId": "A_given_customer",
"state": "closed",
"cartItems": [
{
"name": "ProductL",
"sku": "sku-00003",
"quantity": 1,
"price": 310,
"Category": "",
"weight": 0,
"position": 0,
"attributes": {}
}
],
"couponCodes": [""],
"referralCode": "",
"attributes": {
},
"additionalCosts": {}
},
"responseContent": []
}'
We receive this response, which shows the
addLoyaltyPoints
effect is triggered.
{
"createdCoupons": [],
"createdReferrals": [],
"effects": [
{
"campaignId": 244,
"rulesetId": 487,
"ruleIndex": 0,
"ruleName": "Count Transactions over $300",
"effectType": "addLoyaltyPoints",
"props": {
"name": "1 transaction over $300",
"programId": 56,
"subLedgerId": "TransactionOver300",
"value": 1,
"recipientIntegrationId": "talonone-b46812yoxpb",
"transactionUUID": "266611c9-22c2-4930-bfb6-26d5978c7880"
}
}
]
}
Sending the last of the 3 sessions
- 🚀 Request
- ✅ Response
The last session we close for the same customers triggers the point addition.
CURL -X PUT https://mycompany.europe-west1.talon.one/v2/customer_sessions/my_session_id -d
'{
"customerSession": {
"profileId": "A_given_customer",
"state": "closed",
"cartItems": [
{
"name": "ProductL",
"sku": "sku-00003",
"quantity": 1,
"price": 310,
"Category": "",
"weight": 0,
"position": 0,
"attributes": {}
}
],
"couponCodes": [""],
"referralCode": "",
"attributes": {
},
"additionalCosts": {}
},
"responseContent": []
}'
We receive this response, which shows the
addLoyaltyPoints
effect is triggered.
{
"createdCoupons": [],
"createdReferrals": [],
"effects": [
{
"campaignId": 244,
"rulesetId": 487,
"ruleIndex": 0,
"ruleName": "Count Transactions over $300",
"effectType": "addLoyaltyPoints",
"props": {
"name": "1 transaction over $300",
"programId": 56,
"subLedgerId": "TransactionOver300",
"value": 1,
"recipientIntegrationId": "talonone-b46812yoxpb",
"transactionUUID": "85ab20e3-aaf5-4e3c-a19f-2ba4f32b1936"
}
},
{
"campaignId": 244,
"rulesetId": 487,
"ruleIndex": 1,
"ruleName": "3rd transaction over $300",
"effectType": "addLoyaltyPoints",
"props": {
"name": "1000 bonus points",
"programId": 1,
"subLedgerId": "",
"value": 1000,
"recipientIntegrationId": "talonone-b46812yoxpb",
"transactionUUID": "26d13ab7-01a4-49e4-b15e-8883fd2454c4"
}
}
]
}
- Talon.One's core features are flexible and can be used as workarounds to implement advanced logic.