APIs & Integrations

jamesgraham
Member

Assigning engagements to the correct owner

We are using an OAuth integration and matching Hubspot owners to our users based on email address.

 

We create engagement records which by default have the "createdBy" as the account owner. We need to assign the engagement correctly and this is hit and miss across our user base.

 

Our logic is to use the Owners API to match an owner by email, then iterate through the remoteList and find their HUBSPOT remote like below:

 

  {
         "id": 30441229,
         "portalId": 2163627,
         "ownerId": 35190951,
         "remoteId": "7409504",
         "remoteType": "HUBSPOT",
         "active": true
}

Which ID should we use? If we use ownerId, for some users this shows as the digits in the "Assigned to" field in the HubSpot UI. For others it works. If we use remoteId, it shows "No value selected".

0 Upvotes
1 Reply 1
cbarley
HubSpot Alumni
HubSpot Alumni

Assigning engagements to the correct owner

Hi @jamesgraham , when creating engagements, the proper field to use from the Owners API is the ownerId field. Owner IDs should stay the same, while the remote ID might change based off of any aliases created in the User Preferences center. For example, I made a GET to the owners api, and got this back:

 

http://prntscr.com/mrikb5

 

These correspond to my aliases here: 

 

http://prntscr.com/mrikml

 

Do you have an example engagement I can see where the owner field comes up as a string of numbers? 

0 Upvotes