Using trigger data in your messages

You can use Liquid to personalize your broadcasts. Any part of message or email layout can contain liquid, including the subject line and from address. You’ll personalize broadcasts using trigger data that Customer.io doesn’t know about until you trigger your broadcast. You can provide example data when you compose your broadcast to preview your broadcast with realistic data that you expect to send in a trigger.

How it works

When you trigger a broadcast, you can provide additional data in your trigger that you can use to personalize your broadcast with liquidA syntax that supports variables, letting you personalize messages for your audience. For example, if you want to reference a person’s first name, you might use the variable {{customer.first_name}}.. This is very similar to the way you’d personalize event-triggered campaigns. But, in this case, you’ll reference your data using {{trigger.<data.property>}}.

When you compose a broadcast, you can provide representative data to test your liquid and make sure that your message behaves the way that you expect it to. If you’ve triggered the broadcast before, you can select previous broadcast data from the dropdown for preview purposes only.

image.png
image.png

Send custom data for all recipients

You can send custom data in the data object when you trigger a broadcast. You can preview your data in messages by pasting it in the JSON Sample box when you compose your message.

For example, imagine that you send messages on behalf of ACME incorporated, and you want to send a message to all coyote users who want alerts about roadrunners in their area. In this case, you might trigger a broadcast with 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!" 
  }
}

You’d paste this into the JSON Sample box.

{
  "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!" 
}

This data becomes available in messages and wherever you can use liquidA syntax that supports variables, letting you personalize messages for your audience. For example, if you want to reference a person’s first name, you might use the variable {{customer.first_name}}.. So you could use the headline or date in a message using {{trigger.headline}} and {{trigger.date}}.

image.png
image.png

Providing custom data per user

You can send custom data for each member of your broadcast using per_user_data or data_file_url. You can match data to people by id or email. For example, using the example below, you could use {{trigger.voucher_code}} to provide a custom coupon or voucher for your individual broadcast recipients.

Go to our API docs and select User Maps under Request Body to learn more.

{
    "data": {
        "headline": "Roadrunner spotted in Albuquerque!",
        "date": 1511315635,
        "text": "We received reports of a roadrunner in your immediate area! Head to your dashboard to view more information!"
    },
    "per_user_data": [
        {"id":"wiley","data": {"voucher_code": "FESwYm"}},
        {"email":"road@runner.net","data": {"voucher_code": "cYm6XJ"}}
    ]
}

Go to our API docs and select Data file URL under Request Body to learn more.

{
    "data": {
        "headline": "Roadrunner spotted in Albuquerque!",
        "date": 1511315635,
        "text": "We received reports of a roadrunner in your immediate area! Head to your dashboard to view more information!"
    },
    "data_file_url": "https://myFile.example.com"
}
Copied to clipboard!
  Contents
Is this page helpful?