hubL Contact VID, UTK in the Email Template returns empty!


#1

Hi,

I need to get the Contact ID or Contact Email Address (plan b), for the user/contact the email is being sent to, in the email template!

In the hubL docs ( https://designers.hubspot.com/docs/hubl/hubl-supported-variables ), I can read "This variable is a dictionary that stores contact personalization properties for a known contact. Properties can be accessed from this dict, by adding a period and the property name. For example, contact.firstname would print the first name of a contact."

I tested with {{contact.id}} but that doesn't work https://foobar/?cid={{contact.id}} returns https://foobar/?cid=&utm_campaign=xxxxxx&utm_source=hs_email&utm_medium=email&utm_content=xxxxxxxxx...

Seems that it's not possible to get the contact ID in the template email?


#2

Tested {{contact.vid}}, as in ( https://developers.hubspot.com/docs/methods/contacts/contacts-overview )

Doesn't work! There's no VID value, returns https://foobar/?cid={{contact.id}} returns https://foobar/?cid=&utm_campaign=xxxxxx&utm_source=hs_email&utm_medium=email&utm_content=xxxxxxxxx...


#3

Tried:

      CONTACT PROPERTIES TEST:
      contact.vid: {{contact.vid}}
      contact.utk: {{contact.utk}}
      contact.contact_utk: {{contact.contact_utk}}
      contact.canonicalVid: {{contact.canonicalVid}}
      contact.canonical_vid: {{contact.canonical_vid}}
      contact: {{contact}}

Output is:

CONTACT PROPERTIES TEST: contact.vid: contact.utk: contact.contact_utk: contact.canonicalVid: contact.canonical_vid: contact: {canonical_vid=, canonicalvid=, contact_utk=, firstname=Hey, referrer_f_l=your friend, utk=, vid=}

As we can see, the {{contact}} returns empty canonicalvid and contact_utk, utk, vid, etc.

I've used SEND TEST EMAIL, so not sure if related or not.

But so far, as you can see, it doesn't work!


#4


#5

Is it that I need to change some settings for personalization tokens or something?

Remember, the output for hubL var contact was:
contact: {canonical_vid=, canonicalvid=, contact_utk=, firstname=Hey, referrer_f_l=your friend, utk=, vid=}

You can clearly see that the only props that return a value are contact.firstname and contact.referrer_f_l, and I need canoncial_vid or canonicalvid, or contact_utkm or utk or vid. Any contact id or unique token really...anything! Not sure why this is documented as such and doesn't work?

Is there a way to get immediate support in Hubspot? having to wait days for an answer is a huge blocker; and most of my posts in the forums result in no support and I have to contact the chat support that takes a day to reply and then points me here.


#6

Also tested hubspot_contact_record, as in {{contact.hubspot_contact_record}}

that I hoped it returned something like hubspot_contact_record=https://app.hubspot.com/contacts/2484981/contact/xxxxx and then compute the contactId through a regex pattern or something or whatever really to get xxxx but once again, empty! I knew this one was going to be empty, since the output of {{contact}} didn't hold that property, but anyway, always worth the test. Total failure!

Remember all these are being placed directly in the Email Template, because I want to link to our Web App that will consume the Contact VID/UTK/Whatever to compute the contact id in our side; Using the hubspot api in our side.


#7

Also thought about something like,

{{contact.email}} and the md5 filter, but again, contact.email is empty too. The workaround would be, to save the md5 in our side, and when click through email to our web app fetch the contact VID from our side. But not even the contact.email works.


Adding a token to the URL in an email template
#8

found this other post (another user with similar issue Adding a token to the URL in an email template )

Noticed that your requested the email id, so, you can find my account number here 2484981, the email template id is 5934740007, test email id 6567725434, if you read above you'll notice that I left some props there for tracing/debugging only

This is such a waste of time, why not enable the vid or even email for everybody?!?!?!?! takes ages to get a reply from your team, it's just a waste of time


#10

Hi @punkbit, just as a quick heads up our support team that monitors these forums aims to respond in under 2 business days. Luckily we have been able to work through our backlog pretty quickly and our response times are under 10 hours at the moment which is great. For more immediate assistance, Support can be reached by phone and aims to respond in under 3 minutes, or by webticket and aims to respond in under 24 hours (normally much faster than that).

For your particular issue, the reason you can't access the ID (vid), hutk or any other identifier on the contact object in an email is because vid and hutk are not contact properties. I looked into the thread you linked testing in my own account but it was not possible out of the box. Vid and hutk are unique identifiers that don't make much sense outside the context of the HubSpot database which is why it hasn't been built into HubSpot yet. I do see how it could be useful to surface as a contact property in your use-case, however. Other's share your sentiment, so I'd recommend upvoting and commenting on this idea.

One workaround I've heard of that could work in your case is creating a custom contact property called vid. You could then loop over all contacts in your portal using the get all contacts endpoint, then make a POST request to the update a contact endpoint to essentially copy the vid value to your newly created custom property, then use that how you'd like in your emails.You could run this job once for all your contacts, then create an active list of contacts who's vid values are blank (essentially all net new contacts would need to be updated), and just loop over that list for each subsequent job.


#11

Thanks for checking this post @Connor_Barley, I tried that too; based on my experience that custom properties also failed, I'm afraid; A simple use case that I tried a few hours ago (not working at the moment, just noticed you replied so, trying to put this out as quickly as possible so maybe can get another answer by tomorrow and save the day):

The email client got the following:

If I could get the contact.email address at least, like I pointed out above, I could create an md5 hash and create a service on our side, but Hubspot has screwed me up, it's almost beyond belief this is not accessible. There are so much documentation and articles promoting the API, so I've used it in our side. Previously reported major issues regarding data not reaching Hubspot, ended up having to use the Contacts API, my client paying for all the extra time and effort, reading the documentation etc; Not sure how I'm going to explain this to the client?

Can't even access the contact.email? Honestly Hubspot, this is unseen and it's not nice, the amount of money the service charges, promoting all the features, etc, but it's very limited. It's like going to a restaurant, ordering the food, getting it served but only allowed to stair at the food while hungry... This is not right! Has nothing to do with technology, but a very small minded decision, whoever decided and push that through and the team that didn't question it! That'll affect peoples business and lives. That's not acceptable!

I repeat; whoever that person is, who decided that VID, CONTACT ID or whatever is not useful for the Hubspot clients, needs to leave his small minded world and start practicing painting, maybe learn the guitar, or do anything that makes him think a bit, just a tiny little bit more creatively. Honestly! There's children creating API's with way better reach and accessibility, go wonder!

I'd like to remember that I need this to work directly in the Email Template, not in the WYSIWYG editor, I need to make sure that it exists every time the Hubspot Admin/Editor/User on our side have that in place.

I appreciate your effort, time and help, but hope you understand my point of view too.

Have to accept that this is not possible in Hubspot, that'll affect the business decision I'm sure.

I'm not happy!

Once again and it's never enough, thanks for replying to me @Connor_Barley and hope you don't take this personally; Technology should serve us, and this is not the case. I don't even have access to the contact.email? Not even the contact.email? What is that a security risk? Duh! So, the email is sent to a given email address and contact.email is not accessible, not even the contact.email? Please! Unbelievable... People will think I'm joking, honestly, no one is going to take me seriously

C'mon Hubspot team, you people can do way better, this is not nice, is it?! Unbelievable, what a waste of time


#12

Seems that is not possible to edit the subscriptions/unsubscribe page; so, what I'm planning to do now, is to use a headless browser and read the email value; it's a bit too much for such a basic requirement...


#13

Also that doesn't work, because the url is not passed, not even with the replace filter

  <p>unsubcribe_hash: <a href="http://foobar?unsubcribe_hash={{ unsubscribe_link_all|replace('https://info.moo.la/hs/manage-preferences/unsubscribe-all-test?d=', '') }}"></a></p>
  <p>unsubcribe_url: <a href="http://foobar?unsubcribe_url={{ unsubscribe_link_all }}"></a></p>

The only contact prop that seems to be available according to earliest tests (see above), might be useful if I update it with the value of vid referrer_f_l; not sure if this is a custom property created in our side, asked the person who manages hubspot in our team, but why would that one be available no other, can we control which ones are available?


#14

Following up on referrer_f_l

If you look above first comments, the dump of {{ contact }} is:

Why is referrer_f_l there? I looked into the custom properties we have on our side, there are plenty; Let's look at referrer_f_l:

What determinates if a custom property appears in the {{ contact }} exactly?

I'm now going to test and see if I can access {{ contact.referrer_f_l }}


#15

The only difference I can see in the referrer_f_l, is that it have a default value, so created a test property with a default value and see if it's going to show in the {{contact}} dump.


#16

It seems that Hubspot doesn't pass to the surface custom properties that do not have a default value, for some reason. Also, it doesn't pass to the surface any that is filled, so for example email or investment_status, as explained above! Even though this is a workaround, there is a bug in how hubspot works (now please don't start with excuses, it does not work, and I already gave my opinion about your policies and restrictions regarding properties, scroll up for your joy).

The property with a default value shows in the email template {{contact}} dump:

Now, I'll update the property on contact creation with the value.


#17

So, after spending all the time and energy for this workaround, the custom field that is updated, according to Hubspot own system, is not available in the email template, returns the default value... go wonder!

You can clearly see in the screenshot that the property MY_CONTACT_FREAKING_VID changed to 3287001

Lost my patience, trying to do workarounds and all that for what? Hubspot fails all the time, is not reliable, dah dah dah ladi ladi...c'mon!

Now what, should I wait an hour until the Property Value is available? C'mon!


#18

Just to remind you that the documentation is absolutely misleading, it's not correct, it's false.

Let me guess, now a Hubspotter is going to say that it's not supposed to work in the email templates?

I only tested using "send test email" for this particular case, should I try to send a proper email, will that work? Should I waste another few minutes on that...? c'mon you people, what a joke


#19

I'm going to try a different workaround, that I'll explain later; For now would like to say that, if for example the {{ unsubscribe_all }} page is a customisable page, we can place a script that takes the user to our web app; passing some computed query parameters from the DOM, such as the email etc. That won't work for browsers that are not running javascript, or might look strange if there is a delay and a forced redirection. So, let's forget about this one for now and move on.

Now, moving to other findings and approach around this (which makes the whole Hubspot "NO VID" or "NO CONTACT" to our Hubspot users silly, just to say the least). Let's look into how Hubspot manipulates urls:

This is the output we get in the email client:

25

1) Link has Extra Query Params

or

2) Link has Extra Query Params

If you click any of the links above, you are taken to the original SRC in the template, plus some extra Hubspot query parameters, such as the umt source etc and _hsenc

The query parameter _hsenc is what's required to identify the email contact. On our side, I have:

https://foobar/hs/manage-preferences/unsubscribe-all-test?d=eyJlYSI6ImhlbGRlckBtb28ubGEiLCJlYyI6Miwic3Vic2--FOOOOOOBAR-WQiOjEsImV0IjoxNTQyODA0MDA1MTU1LCJldSI6ImI4Zjc2OTBmLTM5ZjUtNDVkZC1hZTI1LTNhMTU4Y2QxZTU5ZSJ9&v=1&utm_source=hs_email&utm_medium=email&utm_content=2&_hsenc=p2ANqtz--ISoa9FadatuUf8axqTnT-m6eqw-nxWQdQOyq007BpQqYF_FOVm1k-kwgV5Tb2ul2VXNrvakHdYFGnq9G1xg1kGcY4xw&_hsmi=2

That is the unsubscribe manage preferences page, correct? You have the query paramter d and also the _hsenc that I've mentioned above.

The _hsenc is what's used to compute the contact, it's the identifier; you'll manage user email preferences of X given the unique value of _hsenc. I don't know what hsenc stands for, but let's assume it's a lookup hash value that determinates the vid or user contact token or whatever you want to call it.

So, this is a bit too much of a hassle for such a basic stupid requirement, but given how horrible Hubspot is, I'm going to try to request the preferences page with the hsenc query parameter and extract the email from the html and then fetch the contact by email.

Let's see.


#20

This should do, even though it's a lot of hard work to get the Contact VID. Here's proof of concept so far, the DOM result provides the Contact vid:


#21

Unfortunately this is very costly and won't scale, each request takes a lot of time to process.