In the age of data-driven marketing, personalization is king. As marketers, we’re always looking for new ways to enhance our campaigns and make them more relevant to our audience. One powerful strategy is to leverage public APIs to enrich our messaging with real-time, context-specific data.
Braze, a comprehensive customer engagement platform, supports this approach with a feature known as Connected Content. This allows you to make HTTP requests to external servers – such as public APIs – and use the returned data to customize your messages.
Let’s explore how you can leverage some popular public APIs to supercharge your Braze campaigns with dynamic, personalized content.
WeatherAPI.com
WeatherAPI.com offers a detailed forecast API that can be used to include weather information in your messaging.
Suppose you want to send a message that includes the day’s weather forecast for the user’s city. Assuming WeatherAPI.com provides the weather forecast for a specific location with an API call like this:
https://api.weatherapi.com/v1/forecast.json?key=<YOUR_API_KEY>&q=<LOCATION>&days=1
You could use Connected Content in Braze like this:
{% connected_content https://api.weatherapi.com/v1/forecast.json?key=YOUR_API_KEY&q={{${city}}}&days=1 :save result %}
Then you could reference the result in your message:
Hello {{${first_name}}}, the forecast for today in {{${city}}} is {{result.forecast.forecastday[0].day.condition.text}} with a high of {{result.forecast.forecastday[0].day.maxtemp_c}} degrees.
SportScore API
SportScore API can provide real-time scores and stats for various sports, which can be useful for engaging sports fans with the latest updates.
Assuming that SportScore API provides data on the latest scores with an API call like this:
https://api.sportscore.com/scores?api_key=<YOUR_API_KEY>&sport=soccer&date=<YYYY-MM-DD>
You might use it like this in Braze:
{% connected_content https://api.sportscore.com/scores?api_key=YOUR_API_KEY&sport=soccer&date={{${todays_date}}} :save result %}
Then you could reference the result in your message:
Hey {{${first_name}}}, the latest soccer scores are in! The match between {{result.games[0].team1}} and {{result.games[0].team2}} ended {{result.games[0].score1}} to {{result.games[0].score2}}.
VISIT Data
VISIT Data, a location data API, can provide insights about a user’s current location, which can be used to offer location-specific recommendations.
Assuming that VISIT Data provides data on a user’s location with an API call like this:
https://api.visitdata.com/user?api_key=<YOUR_API_KEY>&user_id=<USER_ID>
You might use it like this in Braze:
{% connected_content https://api.visitdata.com/user?api_key=YOUR_API_KEY&user_id={{${user_id}}} :save result %}
Then you could reference the result in your message:
Hello {{${first_name}}}, we see you're currently in {{result.location.city}}. Check out our recommendations for places to visit!
Please note that these examples are hypothetical, and the actual implementation would depend on the specific APIs’ documentation and how they structure their responses. Always replace placeholders like <YOUR_API_KEY>
and <USER_ID>
with actual values or variables from your data.