APIs & Integrations

a_ayodeji
Member

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

SOLVE

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

0 Upvotes
1 Accepted solution
IsaacTakushi
Solution
HubSpot Employee
HubSpot Employee

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

SOLVE

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

Isaac Takushi

Associate Certification Manager

View solution in original post

0 Upvotes
2 Replies 2
IsaacTakushi
Solution
HubSpot Employee
HubSpot Employee

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

SOLVE

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

Isaac Takushi

Associate Certification Manager
0 Upvotes
a_ayodeji
Member

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

SOLVE

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