Skip to main content

Integration with Talon.One

Integrating with Talon.One revolves around two main concepts: sending customer session updates and processing rule effects.

Integration landscape

Any integration uses at least the Integration API to send business data to the Campaign Manager's Rule Engine. The Rule Engine is where all promotion rules are processed.

The Rule Engine determines which rule(s) should be applied based on the data it receives. For every rule whose conditions are met, the engine returns the rule effect(s) to the integration layer. For example the coupon code is valid or apply a discount.

Integration landscape

The following video provides an overview on the main steps to integrate with Talon.One:

Topics covered in the video
  1. 1:21 Learn about the entities.
  2. 3:05 Create your attributes to map your data points into Talon.One.
  3. 3:34 Send customer session updates thanks to the Integration API and our SDKs.
  4. 5:40 Creating and testing a promotion rule.

To learn more about the Campaign Manager and the Rule Engine, see our Product docs.

Sending your first request in five steps

These are the essential steps to send your first request:

  1. Create an Application in the Campaign Manager.

  2. Create your API key:

    1. Open your Application.
    2. Click Settings > Developer Settings > Create API key.
  3. Create a rule in your Application. For example:

    • Condition: Coupon code is valid.
    • Effects: Set a discount of 25% on the session total.
  4. Create a session inside Talon.One and add cart items and a coupon to it. To do so, install an SDK or use curl to send the following request:

    Creating a session
    curl --request PUT 'https://myapp.europe-west1.talon.one/v2/customer_sessions/mysession' \
    --header 'Authorization: ApiKey-v1 <your_api_key>' \
    --header 'Content-Type: application/json' \
    --data-raw '{
    "customerSession": {
    "cartItems": [
    {
    "name": "Mountain Bike",
    "sku": "SKU1234",
    "quantity": 1,
    "price": 140,
    "category": "bikes",
    "weight": 10
    }
    ],
    "couponCodes": ["XMAS-2021-25"]
    },
    "responseContent": [
    "customerSession",
    "customerProfile",
    "triggeredCampaigns",
    "coupons"
    ]
    }'

That's it! We just updated a customer session called mysession inside Talon.One. This session is anonymous because we didn't link it to a customer profile. It contains one cart item and one coupon code.

  1. Talon.One's response looks like:

    Parsing effects
    {
    "coupons": [
    {
    "id": 29734,
    "created": "2021-04-26T13:56:39.914646Z",
    "campaignId": 3737,
    "value": "XMAS-2021-25",
    "usageLimit": 1000,
    "usageCounter": 0,
    "attributes": {},
    "reservation": true,
    "batchId": "bmhknlwf"
    }
    ],
    "customerProfile": null,
    "customerSession": {
    // ...
    },
    "effects": [
    {
    "campaignId": 3737,
    "rulesetId": 10896,
    "ruleIndex": 0,
    "ruleName": "25% off",
    "effectType": "acceptCoupon",
    "triggeredByCoupon": 2971534,
    "props": {
    "value": "XMAS-2021-25"
    }
    },
    {
    "campaignId": 3737,
    "rulesetId": 10896,
    "ruleIndex": 0,
    "ruleName": "25% off",
    "effectType": "setDiscount",
    "triggeredByCoupon": 2971534,
    "props": {
    "name": "25% off",
    "value": 35.0
    }
    }
    ],
    "triggeredCampaigns": [
    {
    // ...
    }
    ]
    }

    The important part of the response is the effects array. In this case, the coupon code trigger two effects:

    • acceptCoupon: indicates that the code is valid.
    • setDiscount: shows the effective discount amount in the value field (35).

    See the available effects.

The rest of the workflow takes place in your own order system, in order to apply the effects that Talon.One returned. For example, removing $35 from the customer's cart total value.

Next steps