Solved

How to reference Transaction Email API message_data in liquid?

  • 14 March 2023
  • 3 replies
  • 227 views

I’m trying to use this endpoint to send transactional emails to end users. 

Each email has the following unique metadata:

  • URL
  • String

The documentation linked above mentions using message_data → liquid_data in order to pass data through to the template. 

But I can’t figure out how to reference the message_data object using liquid from the template edit screen. 

How do I reference the message_data field from the API in the template?

icon

Best answer by katie_judd 15 March 2023, 20:51

View original

3 replies

Userlevel 4

Hey Matrix,

I am not a developer, so this might no be useful (or too obvious for a solution 😀)  but have you tried this:

{{ trigger.message_data.url }}

 

What excatly have you tried already?

Felix

Userlevel 2
Badge

Howdy! Popping in as a Customer.io Technical Support Engineer to say Felix is right on the money. To reference data within a transactional message, it will need to be formatted as trigger.attribute.property 

Resource: https://customer.io/docs/transactional-api/#trigger-data-and-content-variables

For anyone who comes across this problem, you actually just need to access the properties on “trigger”. e.g. 

{{ trigger.url }}

Reply