Tier Updates
Real-time Tier Update Notifications
In this tutorial, let's set up Braze to receive loyalty notifications from Open Loyalty and use them to trigger an email campaign. This way, we can inform customers immediately when their tier updates (upgrade or downgrade).
Because the schema of Open Loyalty's webhook requests doesn't match the schema of Braze's API endpoints, we can't send requests to Braze directly. Instead, we rely on Braze's Data Transformation feature to transform the Open Loyalty payload into valid Braze API calls.
Open Loyalty Requirements
You are an admin user.
You have a Tenant.
You have at least one Member profile in Tenant. This profile should also exist in Braze (identified by their e.g. loyaltyCardNumber).
You have configured a tier set and defined different tiers.
Braze Requirements
You are an account or workspace admin.
Access to the "Data Settings" tab in Braze to configure webhook listeners.
Setting up the integration
Generate the Webhook URL
First, we must generate a webhook URL to which Open Loyalty can send the notification requests. Braze automatically generates a webhook URL when you create a data transformation.
In Braze, open Data Settings > Data Transformation.
Click Create transformation and configure the following parameters:
Transformation name: Type a name (e.g., "Open Loyalty Tier Update").
Editing experience: Select Start from scratch.
Select destination: Select POST: Track users. (This is the endpoint used to trigger user events).
Click Create Transformation.
Next to Webhook URL, click Copy.
Note: Keep this URL safe; you will need it for the next step.
Create the Webhook Subscription
You must configure Open Loyalty to send data to the Braze URL you just generated whenever a member's tier changes. We will use the CustomerLevelChanged event.
Log in to your Open Loyalty Admin Panel.
Navigate to General > Webhooks.
Click Add new webhook and configure the subscription:
eventName: Set this to
CustomerLevelChanged. This event triggers whenever the tier is changed.url: Paste the Braze webhook URL you copied in Step 1.
Add the following headers:
Content-Type: application/jsonUser-Agent: partner-OpenLoyalty
Save the webhook subscription.
Configure the Data Transformation
Now that Open Loyalty is linked to Braze, you must write the JavaScript logic in Braze to translate the Open Loyalty payload into a Braze User Track event.
In Braze, open the data transformation you created in Step 1.
Trigger a points change in Open Loyalty (e.g., add points to a test member) to generate a sample payload under Webhook details.
Under Transformation code, enter the following JavaScript. This maps Open Loyalty data to Braze properties:
let brazecall = {
// Update the user's profile attribute with the new tier name
"attributes": [
{
"external_id": payload.data.customer.loyaltyCardNumber,
"loyalty_tier": payload.data.level.name
}
],
// Trigger a custom event for the campaign
"events": [
{
"external_id": payload.data.customer.loyaltyCardNumber,
"name": "Loyalty Tier Changed",
"time": new Date().toISOString(),
"properties": {
"new_tier_name": payload.data.level.name,
"is_upgrade": payload.data.level.levelMoveUp,
"is_downgrade": payload.data.level.levelMoveDown
}
}
]
};
return brazecall;Click Validate to ensure the code runs against your sample payload.
Click Activate.
Trigger the Email Campaign
You can now use the custom Braze event (Loyalty Tier Changed) to trigger an email.
In Braze, click Campaigns > Create campaign > Email.
In Campaign Name, type a name for your campaign.
In Email Variants, select HTML Editor and click Blank Template.
Click Edit Sending Info and enter a subject line.
Click the Body tab and insert the following HTML code. This uses Liquid logic to display dynamic text based on whether points were added or spent:
{% if event_properties.${is_upgrade} == true %}
<h1>Congratulations!</h1>
<p>You've leveled up to <strong>{{event_properties.${new_tier_name}}}</strong> status!</p>
<p>Check out your new perks in the app.</p>
{% elsif event_properties.${is_downgrade} == true %}
<p>Your tier status has changed to {{event_properties.${new_tier_name}}}.</p>
<p>Earn more points to get back to the top!</p>
{% endif %}Click Done.
In the Schedule Delivery tab, select Action-Based as the delivery type.
In New Trigger Action, select Perform Custom Event and click Add Trigger.
In Choose a custom event, select Loyalty Tier Changed.
Ensure your Target Audience includes the users you are testing with.
Click Launch Campaign.
Testing the Setup
To test the setup, manually change a member's tier in Open Loyalty (e.g., via the Admin Panel)
This triggers the
CustomerLevelChangedwebhook.Braze receives the data, transforms it using your JavaScript, and records the
Loyalty Tier Changedevent.The email campaign is triggered, sending the user an update with their new tier.
Last updated
Was this helpful?

