Skip to main content

Adding loyalty points via Braze

Let's set up Braze to give loyalty points to a customer when Talon.One receives a specific Braze event.

To do this, we must send a request to Talon.One from a campaign or canvas body using the Track event endpoint for Braze.

Talon.One requirements

  1. You have an Application and campaign in Talon.One.
  2. You have at least one customer profile in Talon.One. This profile also exists in Braze.
  3. You have set up a profile-based loyalty program for your Application.

Braze requirements

  1. You have created a campaign or canvas in Braze.
  2. You have a way to identify a given customer across Talon.One and Braze. In this tutorial, we assume a customer's Talon.One integrationId is always equal to Braze's user_id. You can also create a new property on your Braze customer profiles to store Talon.One's integration ID.

Creating an API key in Talon.One

In the Campaign Manager, create a Braze-specific API key:

  1. In your Talon.One Application, click Settings > Developer settings.
  2. Click Create API Key.
  3. For Do you want to use this API Key with a 3rd party service?, select Yes.
  4. From Platform, select Braze.
  5. Select an expiration date, and click Create API Key.
  6. Copy the key for later use.

  7. note
    You cannot display the API key after this step. If you lose the value, create a new API key.

We will use the API key in the Braze campaign template.

Creating the Talon.One rule

  1. Create a new custom attribute that represents the event sent from Braze:

    PropertyValue
    Associated EntityEvent
    Event typeMy Braze event
    Attribute TypeString
    API namemyBrazeEvent
    Rule Builder nameMy Braze event
  2. Open your campaign and create a rule to award points:

    WhatNameProperties
    ConditionsCheck for event types
    and custom event values
    • Event type: My Braze event
    • Attribute My Braze event (Event) is equal to test_string.
    EffectsAdd loyalty pointsSelect your profile-based loyalty program and set the amount of points to award.

Sending the event to add loyalty points

To send the event, we use the Track event endpoint for Braze integrations:

POST Track event (Braze)
https://integration.talon.one/braze/event

See API Docs

To trigger the endpoint, we must use Braze's Connected Content feature and Braze's Liquid tags.

Important

We assume that your customer profile in Braze contains a unique identifier that is equal to the customer integration ID in Talon.One. In this tutorial, we use ${user_id}. Ensure the user ID matches the integration ID in Talon.One.

  1. Open your Braze campaign/canvas for editing.

  2. According to the Braze docs, add the following Connected Content call to the body of your message, where:

    • YOUR_API_KEY is the API key you created.
    • YOUR_DEPLOYMENT_URL is the base URL of your Talon.One deployment.
    {% capture postbody %}
    {"eventType": "My Braze Event", "identifier": "{{campaign.${dispatch_id}}}",
    "type":"string", "customerProfileId":"{{${user_id}}}",
    "eventAttributes": {"myBrazeEvent": "test_string"}}
    {% endcapture %}

    {% connected_content https://integration.talon.one/braze/event
    :headers {
    "Authorization": "ApiKey-v1 YOUR_API_KEY",
    "destination-hostname": "YOUR_DEPLOYMENT_URL"
    }
    :method post
    :body {{postbody}}
    :content_type application/json
    :save result
    %}

    {% for effect in result.effects %}
    {% if effect.effectType == "addLoyaltyPoints" %}
    <p>You were awarded {{effect.props.value}} loyalty points!</p>
    <p>(Reason: '{{effect.props.name}}')</p>
    {% endif %}
    {% endfor %}

    <p>HTTP response code: {{result.__http_status_code__}}.</p>
  3. To test your request:

    1. Click Preview in the template editor.
    2. In Preview as User, click Select existing user and search for an existing user in Braze.
    note

    Loyalty points are only added when you use the preview function for the first time. The next time you use it, the same message appears, but no loyalty points are added to the customer's profile. This is because the dispatch_id isn't available at campaign creation. When your campaign is running, the sample behaves as expected.