APIs & Integrations

slaxxarn
Member

Associate/convert contact by utk search to a "real" contact

SOLVE

Hi!

 

So this is our problem, were fetching a contact, based on the utk available on the website for the user, via /contact/v1/contact/utk/:utk/profile.

 

When we get the specific contact, the response of the above route includes the following:

 

 

 

 

{ 
  vid: xxx, 
  'canonical-vid': xxx, 
  'merged-vids': [], 
  'portal-id': xxxx, 
  'is-contact': false, 
  'profile-token': 'xxx', 
  'profile-url': 'https://app.hubspot.com/contacts/xxx/contact/xxx',      
  properties: { 
   hs_is_contact: { value: 'false', versions: [Array] }, 
   num_conversion_events: { value: '0', versions: [Array] }, 
   num_unique_conversion_events: { value: '0', versions: [Array] },
   hs_object_id: { value: 'xxx', versions: [Array] }, 
   hs_all_contact_vids: { value: 'xxx', versions: [Array] } 
 }, 
 'form-submissions': [], 
 'list-memberships': [], 
 'identity-profiles': [ { vid: xxx, 'saved-at-timestamp': 1604990800312, 'deleted-changed-timestamp': 0, identities: [] } ], 'merge-audits': [] }

 

 

 

 

So in the next step when we try to update the contact property (via /contacts/v1/contact/vid/${contactId}/profile), we get an error saying "contact does not exist". We dont have a way of identifying the user when the utk token is created, only when the user has placed and order and the order has reached a certain status. When this happens, we currently send an api request and creates a new user. But because we know the visiting users utk token it would be really neat to convert this entity to a real contact and populate all the properties we desire to the same entity.

 

We don't save any user data or anything on our website (and users have no way of login in), so we don't know their email or anything until they actually placed and order and it got accepted.

 

We need to be able to identify and update certain properties to in a later stage, if the customer did not go through with their order, be able to send abandoned cart emails to them.

 

Is there anyway to convert an entity with ´"is_contact": false' to be a real contact? I guess you do it when people fill in forms and stuff?

0 Upvotes
1 Accepted solution
slaxxarn
Solution
Member

Associate/convert contact by utk search to a "real" contact

SOLVE

I solved it as following;

1) Activated Non‑HubSpot Forms

2) Created a hidden form (with onsubmit="return false" and a submit.click() on the hidden form submit button) in our checkout that post when checkout is completed (this creates a real contact in hubspot)

 

And then I did, in our backend services, if we already created a contact to a specific order but they dont have the same email address as the utk one, we merge these two contacts togheter.

 

Seems to be working just fine. But as @lynton pointed out, the form API seems to be a better choice.

View solution in original post

7 Replies 7
Edgar_Fortea
Participant

Associate/convert contact by utk search to a "real" contact

SOLVE

Same question here. In our case the user could or could not have filled a form during the online session so there might be a case where the user has been identified with the utk token but is not a contact in Hubspot. We can create a new user with

https://legacydocs.hubspot.com/docs/methods/contacts/create_contact but then any action taken later by the same user won't be stiched to the contact we created. Can we add any property that would identify that contact so it can be stiched later on? (ie: Google Analytics ID, UTK token...)

0 Upvotes
slaxxarn
Solution
Member

Associate/convert contact by utk search to a "real" contact

SOLVE

I solved it as following;

1) Activated Non‑HubSpot Forms

2) Created a hidden form (with onsubmit="return false" and a submit.click() on the hidden form submit button) in our checkout that post when checkout is completed (this creates a real contact in hubspot)

 

And then I did, in our backend services, if we already created a contact to a specific order but they dont have the same email address as the utk one, we merge these two contacts togheter.

 

Seems to be working just fine. But as @lynton pointed out, the form API seems to be a better choice.

lynton
Contributor | Elite Partner
Contributor | Elite Partner

Associate/convert contact by utk search to a "real" contact

SOLVE

Hi,

 

I think all you need to do here is use the HubSpot Form Post API to associate the named contact with their UTK token. You can submit the form with any HubSpot Contact Properties, including the email address which is required to create the contact. The form submission api includes the utk as an input param, so HubSpot will create a contact and include all tracking details in that contact's UTK. The form post api is the only way I'm aware to convert a UTK into a known contact record. 

dennisedson
HubSpot Product Team
HubSpot Product Team

Associate/convert contact by utk search to a "real" contact

SOLVE

Wonder if @lynton has thoughts on this.

0 Upvotes
dennisedson
HubSpot Product Team
HubSpot Product Team

Associate/convert contact by utk search to a "real" contact

SOLVE

Hey @slaxxarn 

Thanks for the very detailed post. 

I think you spelled it all out.  You will need a visitor to explicitly take an action to become a contact which would be something like a form would need to be filled out. 

0 Upvotes
slaxxarn
Member

Associate/convert contact by utk search to a "real" contact

SOLVE

Or is it possible to trigger an hidden form post and take advantage of Non-hubspot form to add the email to the contact?

slaxxarn
Member

Associate/convert contact by utk search to a "real" contact

SOLVE

Hi @dennisedson 

Thanks for the reply, but a follow up question.

 

Isn't there a way to add the visiting users utk token to a contact created via api?