Skip to main content

Receiving a loyalty ledger through Braze

Learn how to use the Braze endpoint to retrieve loyalty ledger information of customer coupons.

Endpoint usage#

This endpoint contains the following built-in required properties:

  • LOYALTY_PROGRAM_ID
  • USER_ID

Example with all built-in properties:

curl --location --request GET 'https://[YOUR_DEPLOYMENT].talon.one/v1/loyalty_programs/[LOYALTY_PROGRAM_ID](/profile/[USER_ID]' \--header 'Authorization: Bearer [BEARER_TOKEN]'

Configuring Connected Content#

To trigger the Talon.One coupon creation you have to use Braze's Connected Content Feature. You can use it in every campaign message body or any canvas message body.

  1. Add the connected content tag to the body of your message and add the URL to the getLoyaltyPoints endpoint. You can access Braze attributes by using liquid tags. For example, {{${user_id}}} to pass the user id.

    LocationAttribute

  2. Add the authorization header and the method (get) of the request. Follow this instructions to generate a session token.

    LocationAttribute

  3. Add the save parameter at the end to store the Talon.One response as a Braze variable (in the below case, result).

    LocationAttribute

  4. Use a liquid tag to show the value of the Total points of loyalty ledger in the message.

    LocationAttribute

  5. Testing the campaign/canvas will give you the following result:

    Value of total points {{result.ledger.total}}:

    LocationAttribute

    Whole response {{result}}:

    LocationAttribute

Code snippet:

{% connected_content https://demo.europe-west1.talon.one/v1/loyalty_programs/19/profile/loyaltytier1
:headers {  "authorization": "Bearer q-8pnumpXXXXXXXXXXAxf9Bz-i22G1" }:method get:content_type application/json:save result%}
Total points: {{result.ledger.total}}

Extracting the session token#

Once you are logged into your Talon.One deployment as an administrator, you can get your session token by following these steps:

  1. Open the console/developer settings of your browser.
  2. Navigate to cookie storage.
  3. Copy the value of the talonone-credentials cookie.
  4. Paste it into an online URL decoder.

LocationAttribute