Regardless of what type of campaign you want to run, you will need to give the Talon.One rule engine some data about your customer's activities so that it can make decisions (and trigger effects) based on them. Here is what to do:

  1. Send Session and Profile Updates to Talon.One
  2. Process Effects
  3. Custom Events

1. Send Session and Profile Updates to Talon.One

The object representing a customer transaction or order in Talon.One is called a CustomerSession. To get started, include the Talon.One SDK for your language in your backend code. A good integration point in your code could be the place where the current customer order is (re)calculated.

Depending on your industry, you can select from a large number of predefined attributes important to your business, or even create completely custom attributes just by selecting a name and a type. In the Rule Builder section of Campaign Manager, you or your marketing managers can then create sophisticated rules matching these attributes.

The next level of integration concerns attributes of your customers themselves. To work with address, device, location or shopping history data, you should bundle these and send them to Talon.One in the form of a CustomerProfile. A CustomerProfile is the "owner" of a CustomerSession. A CustomerProfile can have many CustomerSessions over their lifetime, effectively describing your customer's business history with you. CustomerProfiles can be customized with industry specific attributes in the same fashion as CustomerSessions.
  customerProfile: {
    email: "",
    phone1: "0800-EAT-TUNA",
    birthDate: "1970-01-01",
    cartItems: [
        category: "Italian Food",
        quantity: 1,
        sku: "12345-TUNA",
        price: 9.99
  customerSession: {
    coupon: "PIZZA-2017",
    attributes: {
      restaurantId: "Luigis Pizza"
    state: "closed"

2.Process Effects

Now that you have a working data pipeline into the Talon.One rule engine, you will want to work with the results (called Effects) of your campaign rules, so that your coupon validations, referral or loyalty programs actually do something useful.

You have a choice of implementing either a synchronous (simpler) or an asynchronous (more flexible) effects processing model. For simplicity, this guide covers the first option. For every CustomerSession or CustomerProfile update that you send, Talon.One immediately runs all applicable rules and directly returns all resulting effects in the HTTP API response. To process these effects, you can simply register Effect Handlers using the Talon.One SDK, or loop through the "effects" array of the response if you prefer to do it yourself.

Example: Giving Discounts

talonOne.handleEffect("setDiscount", function(context, label, amount) {
  if (amount > 0) {
    // ... add the discount to your customer's order

Example: Giving Promotional Items

talonOne.handleEffect("addItemToCart", function(context, label, sku) {
  // ... add free item (by SKU) to your customer's order

3.Custom Events

While you can get a long way just by updating the details of CustomerSessions and CustomerProfiles, you might want the system to react to specific customer behavior. For example you want to reward someone with bonus points for providing their credit card details, or incentivize the visiting of specific pages of your website.

For use cases like these, Talon.One supports Custom Events.