I’m running into an issue with the way the api is structured and the way Hubspot is essentially using 2 primary reference keys for contacts (vid/email).
I am integrating a Rails app with Hubspot and am offloading the API calls to workers so they are non blocking and won’t slow the app down.
I am using the HTTP api calls to get the benefit of the response body and then saving the vid in my apps user table so I can associate this with later api calls for the given user.
I am also using the JS API for user event tracking on the app.
When I update a user email on our system the app sends the background worker to call to update our contact on hubspot. On page redirect the js on the page grabs the updated user email and creates a new user on hubspot before the worker can update the same users email via the background worker api call. So, I’m left with same user with 2 contacts on hubspot, since the JS api creates a new user based on the new email.
I know it is possible to merge two users after the fact via the api, but it seems like using the email as the primary key in the js code is a bit fragile, when emails are something that can and will change for a user on any given application.
Is there any way to use the unique vid as the identifier in the JS api? If not, should this not at least be an option?