Can't get contact by cookie (hubspotutk) any suggestions?


#1

Help! I’m stuck.

I’m writing a quiz in HubSpot. When the user fills in the quiz I want the quiz to check the hubspotutk cookie and, if it exists, add a Note to their Contact in the CRM with the values from the quiz.

I can read the cookie using JQuery but when I call the method:

GET /contacts/v1/contact/utk/:contact_utk/profile

example

https://api.hubapi.com/contacts/v1/contact/utk/{hubspotutk}/profile?hapikey={apikey}

HubSpot returns:

{"status":"error","message":"contact does not exist","correlationId":"6a8baXXX-XXXXXXX-XXXXXfc596195","requestId":"93bXXXX7e-XXXXXXXXX-8047cXXXX22"}

I know the contact is in there (it’s me). I can call me using the method:

GET /contacts/v1/contact/email/:contact_email/profile

example

https://api.hubapi.com/contacts/v1/contact/email/{my email address}/profile?hapikey={apikey}

HubSpot returns me in an object - which I can work with.

Any help would be appreciated.
Thank you
Mike


#2

Hey @Webalite,

Have you made sure that your contact record is associated with the cookie you are finding? Basically if you have filled out a HubSpot form, or clicked through an email from the HubSpot system on that device you should be attached. Otherwise we won’t have a contact record for that cookie and we would expect the error message you got.

If you can see page views on the contact record, that’s another good way to see if we have made that association.

-Zack


#3

Doh!

As soon as I read you message it was obvious.

Thank you Zack


#4

Thanks for the tip, this helped me figure out what was wrong. Looking at my profile I didn't see any click events on emails. I found that my IP was included in the "ignore activity from these IPs" setting on the account. I temporarily disabled this, cleared my cookies and re-clicked the email to generate the cookie. I was able to get a utk that returned my contact info on the test call. Thanks!