How to enrich your emails with third-party API data 

Learn how to create hyper-personalized emails at scale with third-party API data.

Jp Valery
Jp Valery
Success Team Manager, Mid-Market
How to enrich your emails with third-party API data

If I had to pick an unsung hero of marketing campaigns, it would be customizing emails with data from a third-party API. Essentially, APIs let different applications “talk” to each other by passing data. With a third-party API, you simply set up an action in your workflow to retrieve data from the API, and then you can use it in various ways in your messages. This lets you tap into a huge variety of data sources to personalize campaigns.

There are a wide variety of third-party APIs available. One of my favorite examples is Weather API, a freemium, easy-to-use API that lets you pull localized, real-time weather information for anywhere on earth. Imagine you’re in the office. It’s 11:30 and you’re hungry, but it’s pouring outside. You get a message from your favorite takeout app that says:

It’s raining ☔. Want to stay dry? Order in for lunch today and save $5.

That’s extreme personalization, and it’s what sets leading brands apart.

Customer.io makes it simple to enhance your messages with third-party API data and automation. I’ll show you how to do it using weather data. After all, there’s a reason that small talk is so often about the weather: it’s always immediate and relevant to people’s lives!

If you’d like to see it in action, you can also watch our Director of Solutions, James, demo it in this video:

Step 1: bring in data from a third-party API data

For this example, let’s say you run a youth sports event platform, and you’re sending a pre-game-day reminder to the players’ parents. Here’s how you’d use weather data to make it personal:

  • Add a webhook action to your campaign (a webhook lets you pass data to, and get data from, an API)
  • Pass the recipient’s location to Weather API
  • Receive the weather forecast for that location from Weather API
  • Save the relevant data as an attribute for the parent
  • Customize the next message based on the data you saved

Once the data is saved to your customer’s profile, you can use it just as you would any other attribute data in your campaigns. Now let’s see what you could do with it!

Step 2: personalize you campaign with API data

In the youth sports event platform example, you could pull real-time data about tomorrow’s forecast for the recipient’s location to customize the pre-game-day reminder email content. In our example, the forecast calls for rain, so we’ll insert dynamic content based on that:

There’s a 60% chance of rain tomorrow, so don’t forget your umbrella!

Once you’ve built the campaign logic, you can use it over and over. All you have to do is use Liquid to determine what content to display based on the data automatically pulled in by the API. For the purposes of the sports event platform, you could have a selection of possible messages based on certain kinds of weather conditions, such as:

  • If the forecast is over 90 degrees: “Looks like a hot one tomorrow! Be sure to bring plenty of water for yourself and your player.”
  • If it will be below 50 degrees: “Brr, tomorrow will be chilly. Don’t forget a jacket for your player to wear while off the field.”
  • If the weather will be warm and sunny: “Looks like a bright and beautiful day for our game tomorrow!”

This approach makes highly customized, automated messaging scalable, and it ensures you don’t sound like a robot when you’re sending frequent emails with similar content, like recurring reminders. Each message is slightly different, and all create real value for the recipient.

Weather is just the beginning

Weather API is a great starting point for using APIs because it’s very simple and has a free tier. Plus, there are so many ways you can use this little bit of personalized data, from specifically tying the forecast to an event or offer to just adding a friendly “Hope you’re enjoying this sunny day” sign-off.

Want to talk about more than the weather? You can use APIs to get all kinds of data into Customer.io. There are thousands of APIs out there, from the practical to the whimsical; take a look at Rapid API to get a sense of the possibilities. With your unique knowledge about the people who love your brand and Customer.io’s powerful automation tools, you can build an ultra-personalized customer journey, at scale.