APIs & Integrations

Not applicable

User id vs owner id

when I get the token information I get the following information: https://api.hubapi.com/oauth/v1/access-tokens

"user_id": 627388

when I lookup a deal using the REST API: https://api.hubapi.com/deals/v1/deal/260158844

"hubspot_owner_id": {
"versions": [
{
"name": "hubspot_owner_id",
"value": "66"

How do I link the 2 together, is there way to use the user id and get the owner id or use the owner id and get the user id? please help, as we trying to launch our software and we are stuck.
thanks

-Dileepa

0 Upvotes
5 Replies 5
3PETE
HubSpot Employee
HubSpot Employee

User id vs owner id

@Dileepa_Wijayanayake At the moment there is not a way to do this. I would be curious to hear why you would be trying to sync up the user that installed the app into the portal and the owner of a deal?

0 Upvotes
Not applicable

User id vs owner id

so here's what happens in order:
-user authenticates, gets token, we record the user, i mean the user_id value in our side
-in our software user_id maps to our user some GUID
-when a deal is created, we get the owner id and try to look for that user in our software, and we cannot find the user

Maybe what we need to do is, instead of storing user_id, maybe we should store owner_id mapping to our user. but need to know how to take the user id and convert that to owner id?

The reason for above is, if the user who auths/gets the token, creates a new deal, we need to find that user who created the deal in our software. Thanks

-Dileepa

0 Upvotes
ClydeJCC
Participant

User id vs owner id

I faced the same scenario and found that Hubspot have a new owner api which solved the problem for me.

How I did it was, once I got the user_id using the access token I use the /crm/v3/owners/{ownerId} endpoint with the idProperty set to userId as explained in https://developers.hubspot.com/docs/api/crm/owners?_ga=2.185499241.179858301.1629793963-62403396.161.... The 'id' in the response is the ownerId. It worked for me.

Hope that helps. 

 

0 Upvotes
3PETE
HubSpot Employee
HubSpot Employee

User id vs owner id

@Dileepa_Wijayanayake What about the case where someone creates a deal and did not auth/gets the token? Do you log that too somehow? If so how?

You could also associate user_id to owner_id by the email address. Both endpoints return the email address of the user.

0 Upvotes
Not applicable

User id vs owner id

We ended up getting the owner list and finding the user from that. there was no direct api call to get a user using the owner id or the remote id.

0 Upvotes