Skip to main content

On-Demand

This guide is for businesses in the on-demand space. It shows how Talon.One can be used to provide loyalty programs and discounts. There are always two steps to using Talon.One:

  1. Notify Talon.One's API of assorted customer activities.
  2. Handle the effects returned by the API.

The decision of which effects to return for a given customer activity is controlled by the Talon.One Rule Engine.

1. Send activity notifications#

We recommend you start with the SDKs. After the SDK has been installed & configured you will use the following API calls:

Below we show example API calls for different customer activities: viewing restaurants, updating an order, and entering a promotional code.

1.1. User views products on a category page#

Track a custom map event with a postcode attribute whenever a user visits the home screen to book a ride:

talon.trackEvent("session1234", "map", { PostCode: "10115" })

This allows campaigns to offer promotions specific to the postcode and/or the time. For example, a response may contain the following effect:

["offerDiscount", "Now 10% on all rides from 10115!"]

1.2. User places an order#

Send a session update with details about the current trip when a user orders a ride:

talon.updateCustomerSession("ride-12586b2d612e2", {
attributes: {
PostCode: 10115,
CarType: "sedan",
EstimatedWait: 5
}
})

This allows campaigns in the Rule Engine to trigger effects based on the trip details. For example, we can create a campaign that gives a 10% discount when the postcode starts with "1011":

["setNewQuote", "1011x Special", 1.09]

1.3. User enters a promo code#

Send a session update whenever a user enters a promo code:

talon.updateCustomerSession("session-1234", { coupon: 'Off to the beach' })

The Rule Engine will validate the code, and return an acceptCoupon effect (and potential other effects), or a rejectCoupon effect indicating that the coupon is invalid.

Successful validation:

["acceptCoupon", "Off to the beach"]
["setDiscount", "$20 off on all rides to the beach", 20]

Unsuccessful validation:

["rejectCoupon", "Off to the beach"]

2. Handling effects#

The Rule Engine will send back discounts and other actions to take in the form of effects. These are handled in your integration by registering effect handlers:

talon.handleEffect('setDiscount', function (context, label, amount) {
context.order.addOrReplaceDiscount(label, amount)
})

3. References#

  • See Handling effects for more information on the types of effects the Rule Engine might return and their arguments.
  • See Data Model overview for more information on what information you can use in your campaigns to conditionally trigger effects.