Sync Nested Object Data to Braze
Marketing
Retail
intermediate
This playbook will help you understand how and why you should be leveraging nested object arrays in Braze to deeply personalize your omnichannel marketing campaigns.
Made by:Hightouch
6 minutes
Leading marketing platforms like Braze have made it easier than ever to create hyper-personalized omnichannel user journeys. One of the most powerful personalization capabilities offered by Braze is nested custom attributes. This feature allows you to store complex objects and arrays in your Braze database as a new data type for custom attributes. Doing so allows you to then utilize that data to create segments using information from a custom attribute object, and personalize your messages using a custom attribute object and Liquid. Having this type of data available is extremely valuable because it enables you to personalize your marketing campaigns using granular information about your customers, as well as their relation to various objects.
Say you work on the marketing team for a pet business called Ellie's Pet Supplies. You want to send out personalized email campaigns that reference information about each of your customers' pets. For example, you want to pull in each pet name to the specific email message to users. You know that traditionally, doing so was extremely difficult due to the complexity associated with customers being able to have a number of different pets.
Luckily, Braze's nested custom attributes give you the ability to easily store and tie back your pet-related data to a single user profile. Once stored in Braze, the data can be easily referenced in your campaigns - allowing you to deliver true 1:1 user experiences.
While the feature itself is incredibly powerful, in order to leverage it, you first need a way to send the pet object data from your data warehouse to Braze. Inevitably, this means you're going to need to ask your data team to build a custom integration to sync data from your warehouse to Braze. Alternatively, you could manually download the data before then uploading it into Braze with CSV files. You know there has to be an easier way.
This playbook will show you how to streamline the process and easily sync structured data from your warehouse directly to Braze using Hightouch.
Syncing Nested Objects Into Braze with Hightouch
Note: before you can sync your data to Braze destination you'll want to make sure it's modeled properly. Taking the example of a customer who has multiple pets, you’ll want to build a single column (within your data model) that contains the entire nested object array containing pets and their metadata. Here’s an example JSON body:
[
{
"id": 0,
"type": "dog",
"breed": "Mutt",
"name": "Rae"
},
{
"id": 1,
"type": "cat",
"breed": "Tabby",
"name": "Garfield"
}
]
Select from our supported source types and click Continue.
Enter your source integration details and then click Continue.
Name your source and click Finish.
Navigate to Destinations in Hightouch and click Add destination. Select Braze and click Continue. After this you'll need to enter your Braze destination API key and region, and click Continue.
Name your destination and click Finish.
Navigate to Models in Hightouch and click Add model.
Select the data source you connected earlier and click Continue.
Next, you want to define your data model. You can define your data using either a SQL editor, table selector, your existing dbt models, or even your Looks if you use Looker as your BI tool. For this scenario, we'll be using the SQL Editor.
Input a query that selects the pet data that you want to sync as custom attributes.
sql
SELECT
*
FROM
PUBLIC.PETS_DATA
Click Preview and verify your model output looks correct. Name your model, select your primary key, and click Finish.
With the model created, it's time to create your sync to Braze. Select Syncs, click Add a sync, select your Braze destination and click Continue.
Next, configure your settings and choose how you want your data synced to Braze. You'll also need to choose an object and define how your records should be updated. After this, you simply need to select a primary key and choose which columns you want to sync to Braze.
After you've mapped your columns you can set your sync schedule.
With your sync configured, simply click Run and your data will begin syncing Braze as an object.
We can head into Braze and see the results of our actions. We can see the pet data under custom attributes if we search for a user.
With the data now in Braze, you can reference the custom attribute object properties using Liquid templating. Simply use the custom_attribute personalization tag and dot notation to access properties on an object. Specify the object name and position in the array, followed by a period, followed by the property name. More information on this found here
{{custom_attribute.${pets}[1].name}}
Pro Tip: Subsequent Syncs
It’s important to note that for subsequent syncs, Hightouch will automatically sync incremental updates, and in doing so, will optimize how to update embedded metadata within these attributes, using a very intelligent deduplicating system to optimize Braze data point usage.
Between syncs, Hightouch dives into each object or array, identifies a primary key for each object, deduplicates from the existing state in Braze, and uses the appropriate API to only update nested fields within these objects.
For example, if a given customer from the above example happens to change the name of their pet from “Garfield” to “Gary,” Hightouch would use the appropriate Braze APIs to only update that single name field, vs. overwriting the entire JSON object. This ensures that we’re only updating one data point, vs. eight in this example. Here’s what Hightouch would send to Braze in this example:*
{
"attributes": [
{
"external_id": "d3ffe943-9c0d-4f74-8679-545e546028db",
"_merge_objects": true,
"pets": {
"$update": [
{
"$new_object": {
"name": "Gary"
},
"$identifier_key": "id",
"$identifier_value": "1"
}
]
},
"_update_existing_only": false
}
],
"partner": "hightouch.io"
}
Leveraging nested custom attributes in Braze, you're able to quickly and easily create personalized touchpoints that feel unique to each individual customer, translating into better customer experiences and ultimately more revenue for your business.
Thanks to Hightouch, building automated syncs to send data from your data warehouse to Braze is easy, allowing your team to move faster without the need for manual uploads or custom integrations.
Want to learn more? Check out our other playbooks or book a demo with our team of experts today!