I'm interesting in possibility of getting vid or canonical_vid by using a Hubspot's function? I'm using now Contact API with User Token from Cookies in order to get it but I have to use external source for connecting to Hubspot's API (AJAX Request). I would like to have access to vid/canonical_vid by function without any scripts. I use vid for some leads campaings
A contact's vid isn't directly accessible on the frontend without first making a call to the HubSpot API. It sounds like you're doing things correctly (calling an external service to hit the 'Get contact by usertoken' endpoint).