Using API Triggered Broadcast data in your messages

With Customer.io, you can use Liquid to personalize your emails. Any part of the email or layout can contain Liquid, including the subject line and from address.

However, it’s a little bit different for API Triggered Broadcasts.

The basics

If you’ve sent an API Triggered Broadcast before, you’ll have the data accessible in the dropdown, for preview purposes only. However, if this is a new broadcast, you can paste in the data that you plan to be sending via the API, to make sure it all works correctly before you send. Here’s an example:

Say I’m ACME Corp. Say we want to send a message to all coyote users that have opted into receive broadcast alerts about roadrunners in their area. If I’m sending (or will be sending) Customer.io some JSON data that looks like this:

{
  "data": {
    "headline": "Roadrunner spotted in Albuquerque!",
    "date": 1511315635, 
    "text": "We've received reports of a roadrunner in your immediate area! Head to your dashboard to view more information!" 
  }
}


I can paste that into the Sample JSON box, in this format:

{
  "headline": "Roadrunner spotted in Albuquerque!",
  "date": 1511315635, 
  "text": "We've received reports of a roadrunner in your immediate area! Head to your dashboard to view more information!" 
}


Then, that trigger data will be accessible in your messages. So if I wanted to get that news headline and use it in my message, I could do that like this:

{{trigger.headline}}

Or the timestamp that I’ve sent:

{{trigger.date}}

In the composer, that looks like this:

Data preview for API Triggered Broadcast

This format is similar to how you access event data (with the format {{event.DATA}}). Depending on the data you send, you can access and manipulate it with Liquid just like the rest of your Customer.io data!

Liquid errors in the composer related to this data, as with event and segment triggered campaigns, will be surfaced in the ‘Review Errors’ box.