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



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 ( ), 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 {{}} but that doesn't work https://foobar/?cid={{}} 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?


Tested {{contact.vid}}, as in ( )

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



      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!



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.


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

that I hoped it returned something like hubspot_contact_record= 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.


Also thought about something like,

{{}} and the md5 filter, but again, 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 works.

Adding a token to the URL in an email template

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


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.


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 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 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 Not even the What is that a security risk? Duh! So, the email is sent to a given email address and is not accessible, not even the 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


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...


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('', '') }}"></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?


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 }}


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.


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.


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!


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


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:


1) Link has Extra Query Params


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:


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.


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:


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