APIs & Integrations

jlandau
Member

getting users ownerId from the api

SOLVE

Hi, I am creating an integration to post calls to hubspot, and i want to send the ownerId with the call record, how can i get the users ownerId without knowing the users information like email etc.?

 

thanks!

0 Upvotes
1 Accepted solution
weiliang_lee
Solution
Top Contributor | Diamond Partner
Top Contributor | Diamond Partner

getting users ownerId from the api

SOLVE

Hi @jlandau hmm I'm not too versed with the flow for public apps. It seems that you only need the user_id of the user initiating the api. Do you think the meta data of the access token would help in your case?

 

https://legacydocs.hubspot.com/docs/methods/oauth2/get-access-token-information

 

Cheers

WL

View solution in original post

0 Upvotes
10 Replies 10
Jaycee_Lewis
Community Manager
Community Manager

getting users ownerId from the api

SOLVE

Hey, @jlandau 👋 The available endpoints to retrieve a specific Contact's Owner all require either using the Contact's VID or email address. 

 

You'll want to include 

hubspot_owner_id

as an additional query param in your request using any of these endpoints:

Have fun building! — Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

0 Upvotes
jlandau
Member

getting users ownerId from the api

SOLVE

Thanks for your response!

 

I want to post a new call engagement record, 

with the owner of the access token I used to post the new record, 

that's why I need the user ownerId, it's not about any contact information needed.

 

0 Upvotes
weiliang_lee
Top Contributor | Diamond Partner
Top Contributor | Diamond Partner

getting users ownerId from the api

SOLVE

Hi @jlandau - could you help me understand a little more about your application. Is it a private app? If so, how many api tokens are you using?

 

Do you mean that you want to firstly create a contact, then assign a call engagement record to a HubSpot user based on the api tokens "owner"? I don't think there is a native solution for that, but since you are already know which token you use for calling the api endpoints, would you be able to incorporate a switch statement to set the owner ID accordingly?

 

Let me know if I understood it right, perhaps you could share a little more about your app and we can all spin off ideas together.

 

Cheers

WL

0 Upvotes
jlandau
Member

getting users ownerId from the api

SOLVE

Thanks for your response @weiliang_lee!
we have a phone system, and people want to integrate it with there hubspot account, so i direct them to hubspot oauth with my clientId,  and a redirect to my api to get the code from hubspot, then i exchange the code to get the access and refresh tokens, and save it to my database, now when a user wants to post a phone call to hubspot , he can select an existing contact or post it without a contact to hubspot, but  how can I get the users hubspot ownerId for the user who posts the call?

0 Upvotes
weiliang_lee
Solution
Top Contributor | Diamond Partner
Top Contributor | Diamond Partner

getting users ownerId from the api

SOLVE

Hi @jlandau hmm I'm not too versed with the flow for public apps. It seems that you only need the user_id of the user initiating the api. Do you think the meta data of the access token would help in your case?

 

https://legacydocs.hubspot.com/docs/methods/oauth2/get-access-token-information

 

Cheers

WL

0 Upvotes
jlandau
Member

getting users ownerId from the api

SOLVE

@weiliang_lee  yes it is a good solution, but it's using the v1 of the api, Is that not considered legacy and discontinued? 

thanks!   

0 Upvotes
weiliang_lee
Top Contributor | Diamond Partner
Top Contributor | Diamond Partner

getting users ownerId from the api

SOLVE

Hi @jlandau yup I would guess that v1 is the one and only. Even on the latest documentation site, https://developers.hubspot.com/docs/api/oauth/tokens it also shows that the endpoint is for v1. The Oauth endpoints are used by every single app out there, I don't believe they'll change it anytime soon 😂

 

Cheers

Weiliang

0 Upvotes
Jaycee_Lewis
Community Manager
Community Manager

getting users ownerId from the api

SOLVE

Hi, @jlandau and @weiliang_lee 👋 This is correct, Legacy endpoints are stable and supported unless explicitly flagged for depreciation. 

CleanShot 2022-12-14 at 08.56.18.png

CleanShot 2022-12-14 at 08.55.53.png

Best,

Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

0 Upvotes
Jaycee_Lewis
Community Manager
Community Manager

getting users ownerId from the api

SOLVE

Thanks for clarifying. Hey, @weiliang_lee @LeeBartelme @LMeert @JBeatty, do you have any experience here? Thanks for taking a look! 

 

Best,

Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

0 Upvotes
jlandau
Member

getting users ownerId from the api

SOLVE

anyone with a solution?

thanks!

0 Upvotes