2nd Jan 2019

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 our API of assorted customer activities.
  2. Handle the effects returned by our 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

The easiest way to get started is with our 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. E.g. we could 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 Talon.One rule engine will validate the code, and return either an acceptCoupon effect (and any other effects that were triggered), or a rejectCoupon effect indicating that the coupon was not valid.

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. Handle 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.
Still need help? Get in touch!
Last updated on 2nd Jan 2019

Was this article helpful?

Thank you! You have already voted

If you’d like a member of our support team to respond to you, please send a note to support@talon.one