HomeGuidesRecipesAPI ReferenceChangelog
GuidesAPI ReferenceCustomer Help CenterLog In
API Reference

Triggers and Rewards

A number of objects in Xola include triggers and rewards objects that describe the conditions that must be met for an action to take place, and the effects of that action, respectively.

Metadata is useful for storing additional, structured information about an object. For example, you could store the customer ID from your CRM system in the Xola User object.

Triggers

Triggers provide a standardized, structured way to set conditions and impose restrictions on certain classes of object in Xola.

There are a number of different triggers available, including experience_trigger, arrivalBetween_trigger, arrivalSpan_trigger, always_true_trigger, blackout_schedule_trigger, bxgy_coupon_trigger, demographic_quantity_trigger, privacy_trigger, organizer_trigger, expiry_trigger, arrival_schedule_trigger, book_by_schedule_trigger, usage_limit_trigger, selected_experiences_trigger, and same_day_arrival_trigger. Triggers can be stacked together, and some trigger types include a limited amount of additional logic (e.g. supporting any vs all). However, certain Xola objects may only use certain trigger types.

Trigger NameDescriptionSample CodeUsed In
experience_triggerTest to ensure that at least one experience is included{
object: "experience_trigger",
"experiences": [
{
"id": "63f7cbd825498161bf341fb8"
},
{
"id": "63f7cbd055d6ca3b4c599cf4"
}
]
}
Packages
arrivalBetween_triggerTest to ensure that the target event or experience takes place between specified start and end times{
"object":"arrival_between_trigger",
"start": "2023-05-04T00:00:00-04:00",
"end": "2023-05-05T23:59:59-04:00"
}
arrivalSpan_triggerTest to ensure that two target objects (e.g. two experiences in a Package) happening within a certain amount of time of each other{
"object": "arrival_span_trigger",
"arrivalSpan": 90
}
Packages
always_true_triggerA placeholder trigger that always returns true{
object: "always_true_trigger"
}
Coupons
blackout_schedule_triggerA trigger that tests whether date selected for the target object is in a blackout period. Takes at least oneschedule object as a parameter{
"object":"blackout_schedule_trigger",
"blackoutSchedules": [
{
"id": "64545fa6d6b86f7d35684444",
"name": "blackout dates",
"days": [
0,
1,
2,
3
],
"start": "2023-05-04T00:00:00-04:00",
"end": "2023-05-05T23:59:59-04:00",
"repeat": "weekly",
"type": "unavailable"
}
]
}
Packages
bxgy_coupon_trigger
demographic_quantity_triggerTests whether the requirement for some minimum number of travelers from a specific demographic (or multiple demographics) is met{
"quantity": "1",
"demographics": [],
"allDemographics": true,
"object": "demographic_quantity_trigger"
}
Coupons
privacy_triggerTests whether the target object has the correct privacy value{
"object": "privacy_trigger",
"allowedPrivacies": [
"private",
"public"
]
}
Coupons
organizer_trigger
expiry_trigger
arrival_schedule_trigger
book_by_schedule_trigger
usage_limit_trigger
selected_experiences_trigger
same_day_arrival_trigger{
"object": "same_day_arrival_trigger"
}
Packages

For example, when configuring a Package that features two Experiences, it is generally necessary that both of these Expereinces are included in the purchase. So at a minimum our trigger object would consist of:

[  
    {  
        "object": "experience_trigger",  
        "id": "6448050b2967692ada1d5e8f",  
        "condition": "all",  
        "experiences": [  
            {  
                "id": "63f7cbd825498161bf341fb8"  
            },  
            {  
                "id": "63f7cbd055d6ca3b4c599cf4"  
            }  
        ]  
    }  
]

However, we may want to impose additional restrictions or qualifications. For example, if we require a visitor to book both of the Experiences on the same day, we can add an additional clause to the trigger:

[  
    {  
        "object": "experience_trigger",  
        "id": "6448050b2967692ada1d5e8f",  
        "condition": "all",  
        "experiences": [  
            {  
                "id": "63f7cbd825498161bf341fb8"  
            },  
            {  
                "id": "63f7cbd055d6ca3b4c599cf4"  
            }  
        ]  
    },  
    {  
        "object": "same_day_arrival_trigger",  
        "id": "6448050b2967692ada1d5e90"  
    }  
]

Rewards

The rewards object works in a similar way, and describes outcomes and actions that take place when key trigger conditions are met. Available rewards include demographic_reward, add_on_reward,
bxgy_coupon_reward, absolute_demographic_reward, percent_demographic_reward,
percent_reward, and absolute_reward.

Trigger NameDescriptionSample CodeUsed In
demographic_reward
add_on_reward
bxgy_coupon_reward
absolute_demographic_rewardProvides a reward worth a specific, fixed amount (e.g. $5) for up to a certain number of different demographic groups{
"quantity": 2,
"object": "absolute_demographic_reward",
"amount": 5,
"demographics": [],
"allDemographics": true
}
Coupons
percent_demographic_rewardProvides a percentage discount for up to a certain number of different demographic groups{
"quantity": 2,
"object": "percent_demographic_reward",
"amount": 5,
"demographics": [],
"allDemographics": true
}
Coupons
percent_rewardProvides a percentage discount (e.g. 10% off){
"object": "percent_reward",
"amount": 5
}
Coupons
absolute_rewardProvides a reward worth a specific, fixed amount (e.g. $5) {
"object": "absolute_reward",
"amount": 5
}
Coupons

An example package that applies a discount when two experiences are purchased together might implement an absolute_reward for a specific dollar amount off, or a percent award that varies with the total purchase price. Additional discounts can be applied to add-ons purchased with the experiences.

[  
    {  
        "object": "demographic_reward",  
        "id": "6453057615c08e677144500b",  
        "discount": {  
            "amount": 50,  
            "amountType": "absolute"  
        },  
        "demographic": {  
            "id": "63e1509a461784660477325d"  
        }  
    },  
    {  
        "object": "add_on_reward",  
        "id": "6453057615c08e677144500c",  
        "discount": {  
            "amount": 10,  
            "amountType": "percent"  
        },  
        "addOn": {  
            "name": "Adventure pants"  
        },  
        "experience": {  
            "id": "63e152c04f6a6b5be271e2fd"  
        }  
    }  
]