Braze Tutorial: How To Make A Connected Content API Call

Making a Connected Content API Call can be a bit scary, right on time for Halloween. Don’t worry; this post will walk you through everything!

halloween

Connected Content

First, let’s start with the definition of Connected Content. From the Braze Documentation:

This feature [Connected Content] allows you to insert any information accessible via API directly into messages you send to users.

So using Connected Content, as long we have the credentials, we can pull data from anywhere, even outside of Braze, and insert that data into our message bodies.

This opens up so many use cases; for example, for more general information like an eCommerce business’s product catalogue, we can access the full data and insert the relevant information in your personalized emails.

This also means that not every data needs to be logged to a user profile and incurring data points.

If there’s simply too much data to log on a user profile, but you never know when you’ll need which data, here’s what you can do:

You can request the Engineering to stand up an API endpoint with the desired data so that the Marketing team’s Braze Specialist can use their technical chops 🔪 and pull the data themselves using Connected Content!

Catfact.Ninja

Before we can talk about making a Connected Content Call, we first need to find some data to work with!

And we found the perfect, publicly-accessible data: random cat facts 🐱.

(To be honest, I’m more of a dog-person, and we’re getting our first dog in a few weeks, but random cat facts was the only publicly-accessible data we could find.)

So Catfact.Ninja’s random cat fact API endpoint is https://catfact.ninja/facts, and because it’s a publicly-accessible endpoint, you can actually click on the link and take a look at the full, raw data.

Let’s check it out.

Yikes, not so friendly, is it?

So here’s a resource that will beautify this daunting code; install this Chrome Extension called JSON Formatter, the function is in the name, to turn that ugly code into this:

So much better, we can actually visually understand the code, and this makes it much more practical to navigate this code.

We’ll have a whole new video dedicated to navigating through the data, but for now, let’s jump into Braze and use Connected Content to pull this data.

Making a Connected Content API Call in Braze

For simplicity, we’ll use a blank HTML email for our channel. Navigate to Messaging → Campaigns → Create Campaign → Email.

Name the Campaign “Random Cat Facts”, click HTML Editor (should be the default), choose “Blank Template”, click “Edit Email Body”, and copy and paste the Connected Content script below inside the Message:

{% connected_content https://catfact.ninja/facts :save cat_facts %}

Now before we go to the Preview tab, let’s break down each part of this script.

The connected_content part is Braze-custom Liquid that indicates that this script is a Connected Content call. It’s required at the beginning of every Connected Content call.

The https://catfact.ninja/facts link is simply the API endpoint that we’re pulling the data from.

And lastly, :save cat_facts is a command within the script to save the returned data in a variable called “cat_facts”. If the script said :save random_facts, then the returned data would be saved in a variable called “random_facts”.

So now that we have the data, let’s click the Test tab, and see that… there’s nothing happening?

So we’ve fetched the data in the backend with our Connected Content script, but we have to actually render the data that’s living inside! So let’s type in below the Connected Content script and click the Preview tab again.

{% connected_content https://catfact.ninja/facts :save cat_facts %}
{{cat_facts}}

Whoa! We definitely got the data this time! But we don’t want all the unnecessary data, and we’re back at the daunting amount of code before we installed the JSON Formatter Chrome Extension.

However, we did successfully make a Connected Content API Call which was the purpose of this video, so if you got this far, please give yourselves a round of applause.

And definitely check out the next video that will talk about how to navigate all this data. I’ll also be sharing my go-to, super helpful resource that I use when I’m working with Braze Connected Content.

Thank you!

To summarize, Connected Content allows you to insert any information accessible via API directly into messages you send to users. This allows you to avoid storing data inside user profiles and lower your data point consumption.

If you have any questions, please share them in the comments. We’re happy to help! 🙏

If you learned something from this tutorial, please subscribe for more awesome Braze tutorials in the future!

Thank you for reading, and see you next time!

allan@fornowmarketing.com

fornowmarketing.com

Previous
Previous

Braze Tutorial: How To Navigate Connected Content Data

Next
Next

Braze Tutorial: Use A Webhook To Log Test Custom Events