Can you reference custom properties in hubspot emails (source code)


#1

Hi there,

In order to get started with product reviews in Trustpilot, I need to BCC or send directly to our Trustpilot email address with the following script in the header html of the email:

<script type="application/json+trustpilot">
{
"recipientName": "Name MacNameson",
"recipientEmail": "customer@email.com",
"referenceId": "1234abcd",
"productSkus": ["ABC-1234","ABC-4321"]

}
</script>

These values will need to by dynamic based on custom properties for each contact. I have already et up the custom properties. So i am just wondering how to reference the custom properties in the code editor


#3

Welcome, @a.ayodeji.

Yes, this is possible. I just confirmed the following method populates a contact's property values:

  1. To modify a HubSpot marketing email's <head> source code, you must clone a template to HTML. (The screenshots in this article are outdated, so I have included another below.)

  1. In the <head>, add the following code containing HubL tokens ("personalization tokens"):
<script type="application/json+trustpilot">
  {
    "recipientName": "{{ contact.firstname }} {{ contact.lastname }}",
    "recipientEmail": "{{ contact.email }}",
    "referenceId": "{{ contact.your_custom_property's_internal_name }}",
    "productSkus": ["{{ contact.your_custom_property's_internal_name }}","{{ contact.your_custom_property's_internal_name }}"]
  }
</script>
  1. The HubL tokens will populate each recipient's corresponding property values in the final email. My test produced the following:

My%20test


#5

Sorry for the later reply @Isaac_Takushi. Thank you so much for taking the time to answer my question!!!