APIs & Integrations

smartreach
Mitglied

Help Needed: Preventing Owner Change While Updating Lead Status via HubSpot API

Hi,

Could you please guide us how we can update the lead_status of without modifying the hubspot_owner_id of the contact, using the HubSpot API ?

I will expand further below:

We are running integrations with SmartReach and HubSpot API. Our users connect their HubSpot account with SmartReach using the OAuth integration.

We are facing an issue where the owner of a contact is getting updated, when we try to just update the contact status, or add an activity to the contact.

When we use the property update call for contact to update the contact status column, the owner is changed too. We want to avoid the case where the owner is changed.


We are calling the HubSpot api in the following manner:

API in use -

POST https://api.hubapi.com/contact/v1/contact/vid/{person_id}/profile

The data we are sending:
{
"properties":[
{
"property":"hs_lead_status",
"value":"NEW_STATUS"
}
]
}


As you can see, we are trying to update the “hs_lead_status” property. However, we have noticed that this also updates the owner of the lead.


To work around this issue, we tried to first fetch the data for the lead using the respective HubSpot api; that gives us the “hubspot_owner_id” of the lead. We then send this same hubspot_owner_id explicitly in the update call.


This solution looks like the following -

API in use -

POST https://api.hubapi.com/contact/v1/contact/vid/{person_id}/profile

The data we are sending -
{
"properties":[
{
"property":"hs_lead_status",
"value":"NEW_STATUS"
},
{
"property":"hubspot_owner_id",
"value":"12345"
}
]
}

// NOTE: the value we are sending for hubspot_owner_id above is the same owner id we get from https://api.hubapi.com/contacts/v1/contact/email/${email}/profile?property=hs_lead_status&property=e...

But still the issue stays. We are at the end of the rope here and don’t know how to avoid the ownership change.

The only other thing that we are sending is the access token, but we don't think that should be the issue here.

 

Best regards,
Animesh

0 Upvotes
1 Antwort
smartreach
Mitglied

Help Needed: Preventing Owner Change While Updating Lead Status via HubSpot API

Thank you for getting back to us with your detailed response.

We have tried the following things you have suggested:

Approach 1:

-> Update Lead Status Only: Send a request to update the lead status (hs_lead_status) without including the hubspot_owner_id in the payload.

This was the first thing we tried and this is where we encountered the owner change issue first.

Approach 2:

-> Fetch the Contact Details: Before updating the contact, retrieve the existing contact details, including the hubspot_owner_id.

We tried this as well. We made a call to HubSpot API to get the current hubspot_owner_id and sent the same in the request for the status update. This didn’t work either.


Approach 3:

-> Ensure that your OAuth token has the necessary permissions to update contacts without changing their owner IDs.


We are not clear about this one. Could you please elaborate here?


We looked up the api documentation, and found the supported “scopes” on this page: https://developers.hubspot.com/docs/api/working-with-oauth


We didn't find any scope which will allow updating contacts without allowing changing the owner IDs.

The closed relevant scopes we find there are:
Crm.objects.owners.read
crm.schemas.contacts.read
crm.schemas.contacts.write

 

 

We are currently passing these scopes during the OAuth flow:

"crm.schemas.deals.read crm.objects.owners.read crm.objects.contacts.write crm.objects.companies.write crm.lists.read crm.schemas.contacts.read crm.objects.deals.write crm.objects.contacts.read crm.schemas.companies.read"


We do want to know how we can make sure that the token permissions are correct?

 


Additional approach 4:

We use the legacy Hubspot APIs for our integration. We also tried using the latest /v3 api endpoints for the update. The issue still happened - the ownership changed along with the lead_status update.


—-----


Can you please help us figure out what can be going wrong here?

0 Upvotes