Sync Nested Object Data to Braze
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
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!