Skip to main content

API effects

Effects are set in your rules. They represent what happened inside the Rule Engine so that you can apply the right action in your integration layer, if needed.

Example

If discount rule is validated, a setDiscount effect is returned to your integration layer, and you are responsible to apply this discount into your webshop.

Every customer session event in the Campaign Manager triggers a request which is sent to the Rule Engine. The Rule Engine checks if any rules apply to this request and returns an array of effects for each valid rule. Understanding the returned effects is a core concept of any integration.

The triggered effects can affect Talon.One, your external web application, or both. For example:

  • Typically internal result: Updating a built-in attribute such as a customer profile's name. This only affects Talon.One but you can decide to use this effect in your ecommerce platform, if you need it.
  • Typically external result: Applying a discount to the shopping cart. Talon.One sends you the discount amount. You choose what to do with this information.

The following sections explain how to interpret the Integration API responses and which effects the integration layer must handle.

Locating the returned effects

The Update a Customer Session endpoint always returns an array of effects, which might be empty. These are the results of rules that matched the event.

For example, consider the following rule:

  • Rule name: Check XMAS Coupon
  • Condition: Coupon code is valid
  • Effect: Set a discount ([Session.Total] * 10%). Name: 10% off with XMAS coupon.

Now let's imagine a request where we communicate that a given customer session now has a coupon code added to it:

Update customer session body
{
"customerSession": {
"profileId": "{{Integration_id}}",
"couponCodes": ["XMAS-2021"]
}
}

And this example response returning 2 effects:

'effects' object in the response
{
"effects": [
{
"campaignId": 3882,
"rulesetId": 14828,
"ruleIndex": 0,
"ruleName": "Check XMAS coupon",
"effectType": "acceptCoupon", // The coupon code is valid
"triggeredByCoupon": 4607465,
"props": {
"value": "XMAS-2021"
}
},
{
"campaignId": 3882,
"rulesetId": 14828,
"ruleIndex": 0,
"ruleName": "Check XMAS coupon",
"effectType": "setDiscount", // A discount was triggered by the rule
"triggeredByCoupon": 4607465,
"props": {
"name": "10% off with XMAS coupon",
"value": 20.0 // The value of the discount. You decide how to process it.
}
}
],
"ruleFailureReasons": []
}
important

Ensure that your integration logic does not depend on the position of the effects array items.

Each entry in the effect array is an object with the following properties:

  • campaignId: The ID of the campaign that caused this effect. Its value is -1 for effects that are not associated with any campaign. For example, if a coupon code is supplied and does not match any known campaign, the response is a rejectCoupon effect with a campaignId of -1.
  • rulesetId: The ID of the ruleset that caused this effect.
  • ruleIndex: The position of the rule that caused this effect in the ruleset.
  • ruleName: The name of the rule that caused this effect.
  • effectType: The type of the triggered effect.
  • props: Additional properties of the effect, these are unique per effect type.

In this case, there are two effects:

  • acceptCoupon indicates that a coupon with a value of XMAS-2021 was accepted.
  • setDiscount indicates that a discount with a name of 10% off with XMAS coupon and a value of 34.56 in the Application's currency should be applied to the order.

Interpreting the different effect types

Each effect has a specific structure. Be ready to parse the ones you expect.

Coupons

rejectCoupon

It indicates that the coupon code supplied couldn't be used.

You should handle this effect by informing their user the coupon code is invalid.

{
...
"effectType": "rejectCoupon",
"props": {
"value": "SUMMER-2021-25",
"rejectionReason": "CouponNotFound"
}
}
PropertyTypeDescription
valueStringThe coupon code that was rejected
rejectionReasonStringThe reason why the code was rejected.
  • CampaignLimitReached: the campaign-wide coupon redemption limit has been reached.
  • CouponExpired: the coupon is expired.
  • CouponLimitReached: the coupon redemption limit has been reached.
  • CouponNotFound: the coupon code is incorrect.
  • CouponPartOfNotRunningCampaign: the campaign the coupon belongs to is currently not active. The campaignId field contains the id of that campaign.
  • CouponPartOfNotTriggeredCampaign: the campaign the coupon belongs to is skipped because of campaign priority settings.
  • CouponRecipientDoesNotMatch: the given coupon value does not match the recipient.
  • CouponRejectedByCondition: other conditions failed in the rule or all conditions passed but the `Coupon code is valid` condition is not present.
  • CouponStartDateInFuture: the coupon isn't active yet.
  • EffectCouldNotBeApplied: one of the effects in the campaign wasn't applied because a limit for that effect was reached (most common use case will be `setDiscount` cannot be applied because a discount limit is reached).
  • ProfileLimitReached: the profile-specific coupon redemption limit has been reached.
  • ProfileRequired: the coupon has a redemption per profile limit, and the current session is not linked a customer profile. Set a value for IntegrationId in your Update customer session request.

acceptCoupon

It indicates that the coupon code supplied was valid.

You should handle this effect by clearing any messages from previous rejectCoupon effects and informing the user that the coupon is valid.

Other effects, such as setDiscount, provide more information about the actual rewards received.

{
...
"effectType": "acceptCoupon",
"props": {
"value": "SUMMER-2021-25"
}
}
PropertyTypeDescription
valueStringThe coupon code that was accepted.

couponCreated

It indicates that a coupon was created.

For referrals and retention marketing, a common use case is to generate a coupon that can only be redeemed by one specific customer.

Handle this effect by notifying the recipient about their new coupon code.

{
...
"effectType": "couponCreated",
"props": {
"value": "SUMMER-2021-25",
"profileId": "TestUser"
}
}
PropertyTypeDescription
valueStringThe coupon code that was created.
profileIdStringThe integration identifier of the customer for whom this coupon was created.

rollbackCoupon

It indicates that a coupon code redemption has been rolled back. This coupon becomes redeemable again.

This effect happens when you cancel a session where a coupon was accepted. See an example of use in the cancelling a session tutorial.

{
...
"effectType": "rollbackCoupon",
"props": {
"value": "SUMMER-2021-25"
}
}
PropertyTypeDescription
valueStringThe coupon code whose redemption has been rolled back.

Discounts

setDiscount

It indicates that a discount should be set on the total shopping cart value of the current order with the given label and amount.

This discount should overwrite any existing discount with the same name. The most recent integration state update always returns the latest values for all effects, effectively overwriting any previous effects.

Enabling partial discounts allows a rule that would fail because of insufficient budget to pass. The rule still fails when the budget reaches 0. Use the desiredValue property to identify the original value of the discount.

{
...
"effectType": "setDiscount",
"props": {
"desiredValue": 16,
"name": "MyDiscount",
"value": 10
}
}
PropertyTypeDescription
desiredValueNumber(Partial discounts enabled only) The monetary value of the discount to be applied without considering budget limitations.
nameStringThe name/description of this discount.
valueNumberThe monetary value of the effective discount.

setDiscountPerItem

This effect schema is returned when you use the Discount individual items or Discount individual items pro rata effect in a rule.

It indicates that a discount per item should be applied on the specific item specified in the effect.

The properties it contains depends on:

  • Whether you used the pro rata effect or not.
  • Whether the cart item flattening feature is enabled.
  • Whether the partial discount feature is enabled.
{
...
"effectType": "setDiscountPerItem",
"props": {
"name": "10% off per item#1",
"value": 10,
"position": 1,
"subPosition": 0,
"desiredValue": 16,
"totalDiscount": 10,
"desiredTotalDiscount": 36,
"scope": "price"
}
}
PropertyTypeDescription
nameStringThe description of this discount. #number is equal to the position property.
valueNumberThe monetary value of the effective discount applied to the item.
positionNumberThe index of the item in the cartItem object on which this discount should be applied.
subpositionNumber(Cart item flattening enabled only) The index of the item unit in its line item.
desiredValueNumber(Partial discounts enabled only) The monetary value of the discount to be applied to the item without considering budget limitations.
totalDiscountNumber(Pro rata discount only) The monetary value of the total effective discount
desiredTotalDiscountNumber(Pro rata discount only) The monetary value of the total discount to be applied without considering budget limitations
scopeStringWhat the discount applies to. Possible values:
  • price: discount on the price of the item.
  • additionalCosts: discount on the additional cost of the item.
  • itemTotal: discount on the sum of price + additional cost of the item.

Enabling partial discounts allows a rule that would fail because of insufficient budget to pass. The rule still fails when the budget reaches 0. Use the desiredValue property to identify the original value of the discount.

If you use the Discount individual items effect in your rules and partial discounts is enabled, each eligible cart item receives the full discount, and only the last item on the list may receive a lower discount if the budget is insufficient. If the budget reaches 0 before each item has received a discount, the rule fails.

If you use cart item flattening and the session contains some cart items with quantity > 1, use the subPosition property to identify the exact item unit in its line item. See the following example for more information:

Example: Cart item flattening

Let's imagine we want to discount individual items in the shoes category. Consider the following session:

  • 2 cart items
  • The second cart item has a quantity of 2.
"cartItems": [
{
"name": "tshirt",
"sku": "SKU3435",
"quantity": 1,
"price": 20,
"category": "tshirts"
},
{
"name": "Shoes1",
"sku": "SKU1234",
"quantity": 2,
"price": 100,
"category": "shoes"
}
]

We assume cart item flattening is disabled. In this case, we consider the items as they appear in the cart. One index of the cartItems array is one item, regardless of the quantity.

We have 2 cart items. We discount one of them: the 2 pairs of shoes.

A successful rule execution returns the following effects meaning the discount applies on the second cart item (position: 1).

"effects": [
{
// ...
"effectType": "setDiscountPerItem",
"props": {
"name": "10% off per item#1",
"value": 20.0, // 10% of the _line item_ price: 2x100
"position": 1
}
}
]

If you use a pro rata discount effect in your rules, use the totalDiscount property to identify the total value of the discount applied to all the items among which it is prorated. See the following example for more information:

Example: Pro rata discount

Let's imagine we want to issue a $30 pro rata discount among the 3 items in the cart.

"cartItems": [
{
"name": "tshirt",
"sku": "SKU3435",
"quantity": 1,
"price": 20,
"category": "tshirts",
},
{
"name": "Shoes1",
"sku": "SKU1234",
"quantity": 1,
"price": 40,
"category": "shoes",
},
{
"name": "Shoes2",
"sku": "SKU0123",
"quantity": 1,
"price": 60,
"category": "shoes",
}
]

A successful rule execution returns the following effects:

{
"effects": [
{
// ...
"effectType": "setDiscountPerItem",
"props": {
"name": "25 pro rata",
"value": 5,
"position": 0,
"totalDiscount": 30
}
},
{
// ...
"effectType": "setDiscountPerItem",
"props": {
"name": "25 pro rata",
"value": 10,
"position": 1,
"totalDiscount": 30
}
},
{
// ...
"effectType": "setDiscountPerItem",
"props": {
"name": "25 pro rata",
"value": 15,
"position": 2,
"totalDiscount": 30
}
}
]
}

If partial discounts is enabled and the budget is insufficient for the full discount to be applied, use the desiredTotalDiscount property to identify the original value of the total discount.

addFreeItem

It indicates that a free item should be added to the shopping cart in the current session. In this example, add the SKU to the shopping cart and set its price to 0.

Note about referrals

The effect of a successful referral can mean a free item for someone else, such as the referrer.

{
...
"effectType": "addFreeItem",
"props": {
"sku": "TEST-29372",
"name": "Enjoy your free item"
}
}
PropertyTypeDescription
skuStringSKU of the item that needs to be added.
nameStringDescription of the effect.

setDiscountPerAdditionalCost

It indicates that a discount that should be applied on a specific additional cost.

This gets triggered whenever a rule containing a Discount additional cost effect is validated.

{
...
"effectType": "setDiscountPerAdditionalCost",
"props": {
"desiredValue": 5,
"name": "50% off shipping cost",
"additi
"additionalCost": "shippingCost",
"value": 2.5,
}
}
PropertyTypeDescription
desiredValueNumber(Partial discounts enabled only) The monetary value of the discount to be applied without considering budget limitations.
nameStringThe name of the discount.
additionalCostIdIntegerThe internal ID of the additional cost.
additionalCostStringThe API name of the additional cost.
valueNumberThe monetary value of the discount to apply.

Enabling partial discounts allows a rule that would fail because of insufficient budget to pass. The rule still fails when the budget reaches 0. Use the desiredValue property to identify the original value of the discount.

setDiscountPerAdditionalCostPerItem

It indicates that a discount of a specific additional cost within a specific item should be applied.

This gets triggered whenever a rule containing a Discount additional cost per item effect is validated.

Use this effect when all items in the cart have an additional cost. If one of more items do not have an additional cost, the rule will fail.

{
...
"effectType": "setDiscountPerAdditionalCostPerItem",
"props": {
"name": "10% off individual fee#1",
"additionalCostId": 51,
"additionalCost": "shippingCost",
"value": 10,
"position": 1,
"subPosition": 0,
"desiredValue": 16
}
}
PropertyTypeDescription
nameStringThe description of this discount. #<number> is appended to the name. It is equal to the position property.
additionalCostIdStringThe ID of the additional cost to be discounted.
additionalCostStringThe API name of the additional cost to be discounted.
valueNumberThe monetary value of the effective discount applied to the item's additional cost.
positionNumberThe index of the item in the cartItem object containing the additional cost that this discount applies to.
subpositionNumberCart item flattening enlabled only. The index of the item unit in its line item.
desiredValueNumberPartial discounts enabled only. The monetary value of the discount to be applied to the addtional cost without considering budget limitations.

rollbackDiscount

It indicates that a discounted session, cart item, or additional cost has been cancelled or partially returned. This effect can only happen when you set the status of a session to cancel or the status changes to partially_returned.

If you use cart item flattening and the session contains some cart items with quantity > 1, use the cartItemSubPosition property to identify the exact item unit in its line item. See the example below.

{
...
"effectType": "rollbackDiscount",
"props": {
"name": "MyDiscount",
"value": 10,
"cartItemPosition": 1,
"cartItemSubPosition": 0,
"additionalCostId": 51,
"additionalCost": "shippingCost",
"scope": "itemTotal"
}
}
PropertyTypeDescription
nameStringThe name of the discount effect that was rolled back.
valueNumberThe monetary value of the discount that was rolled back.
cartItemPositionNumberThe index of the item in the cartItem object whose discount was rolled back, or the unit containing the additional cost whose discount was rolled back.
cartItemSubPositionNumber(Cart item flattening enlabled only) The index of the item unit in its line item for which the discount was rolled back.
additionalCostIdNumberOnly when rolling back setDiscountPerAdditionalCost and setDiscountPerAdditionalCostPerItem The ID of the additional cost to be discounted.
additionalCostStringThe API name of the additional cost whose discount was rolled back.
scopeStringThe scope of the rolled back discount.
  • For a discount per session, it can be one of cartItems, additionalCosts or sessionTotal
  • For a discount per item, it can be one of price, additionalCosts or itemTotal
Example
Let's imagine the customer wants to return a discounted pair of shoes, an item belonging to the `shoes` category. Consider the following session:
  • 2 cart items.
  • The second cart item has a quantity of 2.
"cartItems": [
{
"name": "tshirt",
"sku": "SKU3435",
"quantity": 1,
"price": 20,
"category": "tshirts"
},
{
"name": "shoes1",
"sku": "SKU1234",
"quantity": 2,
"price": 100,
"category": "shoes"
}
]

We assume cart item flattening is disabled.

In this case, we consider the items as they appear in the cart. One index of the cartItems array is one item, regardless of the quantity.

We have 2 cart items we can roll back the discount for. If we want to roll back the discount for an item in the shoes category, we have to do it for the 2 pairs of shoes.

A successful rule execution returns the following effects meaning the discount is rolled back for the second cart item (cartItemPosition: 1).

"effects": [
{
// ...
"effectType": "rollbackDiscount",
"props": {
"name": "10% off per item#1",
"value": 20.0, // 10% of the _line item_ price: 2x100
"cartItemPosition": 1
}
}
]

Giveaways

awardGiveaway

It indicates the awarded giveaway item and to which profile the item was awarded. Learn more about giveaways.

{
"effectType": "awardGiveaway,
"props":
{
"poolId": 34,
"poolName": "mypool",
"recipientIntegrationId": "32hk597s-482y",
"giveawayId": 45,
"code": "9k849v-821o875"
}
}
PropertyTypeDescription
poolIdNumberThe internal ID of the giveaway pool.
poolNameStringThe name of the giveaway pool.
recipientIntegrationIdStringThe integration ID of the customer that receives the giveaway.
giveawayIdNumberThe internal ID of the giveaway.
codeStringThe giveaway code to be rewarded.

willAwardGiveaway

The equivalent of the awardGiveaway effect but returned when updating a session with any state other than closed. This ensures no giveaway codes are leaked when they are still not guaranteed to be awarded.

For more information about session states, see Managing states.

{
"effectType": "willAwardGiveaway",
"props": {
"poolId": 34,
"poolName": "mypool",
"recipientIntegrationId": "32hk597s-482y"
}
}
PropertyTypeDescription
poolIdNumberThe internal ID of the giveaway pool.
poolNameStringThe name of the giveaway pool.
recipientIntegrationIdStringThe integration ID of the customer that receives the giveaway.

Loyalty

addLoyaltyPoints

It indicates that a defined amount of loyalty points was successfully added to the customer's loyalty wallet.

If you use the Add loyalty points per cart item effect, use the cartItemPosition property to identify which item to add the loyalty points for.

Enabling partial rewards allows a rule that would fail because of insufficient budget to pass. The rule still fails when the budget reaches 0. Use the desiredValue property to identify the original amount of loyalty points.

If you use Add loyalty points per cart item, enable cart item flattening and if the session contains some cart items with quantity > 1, use the cartItemSubPosition property to identify the exact item unit in its line item. See the example below for more information.

important

The points only persist when the session is closed.

{
...
"effectType": "addLoyaltyPoints",
"props": {
"name":"10% of current total",
"programId": 302,
"subLedgerId":"",
"desiredValue": 4.50,
"value":1.48,
"recipientIntegrationId":"32hk597s-482y",
"expiryCondition":"unlimited",
"cartItemPosition": 1,
"cartItemSubPosition": 0
}
}
PropertyTypeDescription
nameNumberThe name/description of this loyalty point addition.
programIdStringThe ID of the loyalty program where these points were added.
subLedgerIdStringThe ID of the subledger within the loyalty program where these points were added.
desiredValueNumber(Partial rewards enabled only) The amount of loyalty points to be awarded without considering budget limitations.
valueNumberThe amount of points that were added.
recipientIntegrationIdStringThe user for whom these points were added.
expiryConditionStringThe amount of time (in days) these points are valid.
cartItemPositionNumber(Add points per cart item only.) The index of the item in the cartItem object for which these points were added.
cartItemSubPositionNumber(Add points per cart item with cart item flattening only.) The index of the item unit in its line item.

deductLoyaltyPoints

It indicates that the loyalty points a customer wanted to spend got subtracted from their loyalty wallet.

This effect is generated when there is a Loyalty points in program Loyalty can be redeemed condition in an active campaign.

important

The points only persist when the session is closed.

{
...
"effectType": "deductLoyaltyPoints",
"props": {
"ruleTitle":"Cool-Summer!",
"programId":1,
"subLedgerId":"",
"value":1
}
}
PropertyTypeDescription
ruleTitleStringThe title of the rule that contained triggered this points deduction.
programIdStringThe ID of the loyalty program where these points were added.
subLedgerIdStringThe ID of the subledger within the loyalty program where these points were added.
valueNumberThe amount of points that were added.

rollbackAddedLoyaltyPoints

It indicates that a session was cancelled in which loyalty points have been added.

If you use the Add loyalty points per cart item effect, use the cartItemPosition property to identify which item the loyalty points were rolled back for

If you use Add loyalty points per cart item, enable cart item flattening and if the session contains some cart items with quantity > 1, use the cartItemSubPosition property to identify the exact item unit in its line item.

{
...
"effectType": "rollbackAddedLoyaltyPoints",
"props": {
"name": "always award 1 point with 1 minute pending window",
"programId": 302,
"recipientIntegrationId": "32hk597s-482y",
"subLedgerId": "",
"value": 1,
"cartItemPosition": 1,
"cartItemSubPosition": 0
}
}
PropertyTypeDescription
nameNumberThe name/description of this loyalty point addition.
programIdStringThe ID of the loyalty program where these points were added.
subLedgerIdStringThe ID of the subledger within the loyalty program where these points were added.
valueNumberThe amount of points that were added.
recipientIntegrationIdStringThe user for whom these points were added.
expiryConditionStringThe amount of time (in days) these points are valid.
cartItemPositionNumber(Add points per cart item only.) The index of the item in the cartItem object for which these points were added.
cartItemSubPositionNumber(Add points per cart item with cart item flattening only.) The index of the item unit in its line item.

rollbackDeductedLoyaltyPoints

Indicates that a session was cancelled in which loyalty points have been substraced.

{
...
"effectType": "rollbackDeductedLoyaltyPoints",
"props": {
"programId": 327,
"recipientIntegrationId": "32hk597s-482y",
"subLedgerId": "",
"value": 1
}
}
PropertyTypeDescription
programIdStringThe ID of the loyalty program where these points were added.
recipientIntegrationIdStringThe user for whom these points were added.
subLedgerIdStringThe ID of the subledger within the loyalty program where these points were added.
valueNumberThe amount of points that were added.

Referrals

referralCreated

The referralCreated effect behaves similarly to couponCreated. If the friendProfileIntegrationId parameter is empty, the referral code can be redeemed by anyone.

{
...
"effectType": "referralCreated",
"props": {
"value": "ReferralCode"
}
}
PropertyTypeDescription
valueStringThe referral code provided in the session.

rejectReferral

Similar to rejectCoupon, but for referral codes. It indicates that the provided referral code is invalid.

{
...
"effectType": "rejectReferral",
"props": {
"value": "2482-SUMMER-2022",
"rejectionReason": "ReferralNotFound"
}
}
PropertyTypeDescription
valueStringThe referral code that was rejected
rejectionReasonStringThe reason why the code was rejected.
  • AdvocateNotFound: The advocate was not found.
  • CampaignLimitReached: The campaign-wide coupon redemption limit has been reached.
  • EffectCouldNotBeApplied: One of the effects in the campaign wasn't applied because a limit for that effect was reached (most common use case will be setDiscount can not be applied because a discount limit is reached).
  • ProfileLimitReached: The profile-specific referral code redemption limit has been reached.
  • ReferralCustomerAlreadyReferred: The friend is already referred.
  • ReferralExpired: The transferred referral code is expired.
  • ReferralLimitReached: The referral code redemption limit has been reached.
  • ReferralNotFound: The transferred referral code is wrong.
  • ReferralPartOfNotRunningCampaign: The campaign the referral code belongs to, is currently not active.The campaignId field will have the id of that campaign.
  • ReferralRecipientDoesNotMatch: The given referral code value does not match the recipient.
  • ReferralRecipientIdSameAsAdvocate: The recipient (friend) has the same id as the advocate.
  • ReferralRejectedByCondition: The coupon is valid and in an active campaign, but there were other conditions in that campaign's rules that were not met.
  • ReferralStartDateInFuture: The transferred referral code isn't active yet.
  • ReferralValidConditionMissing: No coupon is valid condition is present in the rules of the campaign that this coupon belongs to.

acceptReferral

Similar to acceptCoupon, but for referral codes. It indicates that the referral code supplied is valid.

You should handle this effect by informing the user that the referral code is valid.

Other effects will provide more information about the actual reward.

{
...
"effectType": "acceptReferral",
"props": {
"value": "Cool-Summer!"
}
}
PropertyTypeDescription
valueStringThe referral code provided in the session.

redeemReferral

It indicates that the referral code is valid and has been redeemed. It triggers when a rule containing a redeem referral effect is validated.

{
...
"effectType": "redeemReferral",
"props": {
"id": 43
"value": "Cool-Summer!"
}
}
PropertyTypeDescription
valueStringThe referral code to redeem.

rollbackReferral

It indicates that the redemption of the referral code has been rolled back. It triggers when a closed session that redeemed a referral is gets cancelled. The code becomes redeemable again.

For more information about session states, see Managing states.

{
...
"effectType": "rollbackReferral",
"props": {
"value": "Cool-Summer!"
}
}
PropertyTypeDescription
valueStringThe referral code to be rolled back.

Other

triggerWebhook

It triggers when a rule containing a "trigger webhook" effect is validated. This effect is shared with you for your information only. It usually doesn't require an action on your side.

{
"effectType": "triggerWebhook",
"props" :{
"webhookId": 234324.2352
"webhookName": "mywebhook"
}
}
PropertyTypeDescription
webhookIdIntegerThe internal ID of the webhook.
webhookNameStringThe name of the webhook.

showNotification

You can use notifications to inform customers of certain events. There are 4 types of notification messages:

  • Info
  • Offer
  • Error
  • Misc

It is up to you to use the Rule Builder to decide why and when to show notifications.

A common use case is to display the notification at the top of the cart view in your web application. You can use the notification type to implement different styling of the notification message.

{
...
"effectType": "showNotification",
"props": {
"notificationType": "Error",
"title": "An Error occurred",
"body": "Please try again"
}
}
PropertyTypeDescription
notificationTypeStringThe type of notification.
titleStringThe title of the notification.
bodyStringThe body of the notification.

updateAttribute

The effect returned by the Update attribute value effect.

These are typically needed for internal use within the Rule Engine. In certain cases, you can use these attributes to signal certain events to your system.

{
...
"effectType": "set",
"props": {
"path": "Profile.Attributes.Tier",
"value": "Gold"
}
}
PropertyTypeDescription
pathStringThe exact path of the attribute that was updated.
valueStringThe new value of this attribute. Value can be any of the following types: time, string, number, location, boolean. Or a list of any of those types.

Custom effects

The effects listed above are core effects provided by Talon.One. If you want to return data as an effect but no effect matches your use case, you can create a custom effect.

{
"effectType": "customEffect",
"props": {
// you define the properties
}
}

The structure of a custom depends on your specifications but is always named customEffect.