hari0
April 8, 2021, 2:55am
1
I am working on an integration application that uses HubSpot along with other data to provide AI-based suggestions and pain points to the customer.
We need to fetch and sync the HubSpot data periodically for this.
I am using the LIST GET API to fetch all the data from an object
/crm/v3/objects/companies/5803412850/associations/contacts?hapikey=
And using the SEARCH POST API to periodically sync the data. Based on the `lastmodifieddate` property.
crm/v3/objects/contacts/search?hapikey=
{
"filterGroups": [
{
"filters": [
{
"operator": "GT",
"propertyName": "lastmodifieddate",
"value": "1617630924000"
}
]
}
]
}
But this field doesn’t exist for all the object types, Eg: It doesn’t exist for Companies object type.
Is there any way to search the data based on the `updatedAt` field from the records? As this seems to be a field present for all object records.
There is also the `hs_lastmodifieddate` field. But it mentions that this field will also be updated when HubSpot changes some internal fields. So this would not be the best choice.
Hey @hari0 !
On the surface, this seems like a good use case for webhooks so you can subscribe to changes rather than having to periodically do a dump.
@RMones , @tominal might have better advice than I can offer (they usually do )
hari0
April 9, 2021, 5:16am
3
Hi @dennisedson
Thanks for the reply
I was hoping to avoid the use of webhooks. Currently we are interested in all the properties we can get from the objects. So using webhooks can lead the architecture being too chatty
I would still do a periodic “get all” request, but yes webhooks looking for specific property changes may suit you without know more about your integration.
Hope that helps!
hari0
April 9, 2021, 5:15am
5
Hi @tominal ,
Thanks for the reply.
We are interested in all the properties for Contacts and Companies objects. So using Webhooks can easily lead to a lot of requests to our backend.
Periodic sync using the Search API ensures that we get only the data that we want (Updated/Deleted data) when we want it.
I guess we can use `hs_lastmodifieddate` and search based on the required timestamp
system
April 9, 2021, 2:05pm
6
Hi @hari0 ,
Have you tried this below api?
Link : https://legacydocs.hubspot.com/docs/methods/contacts/get_recently_updated_contacts
URL : https://api.hubapi.com/contacts/v1/lists/recently_updated/contacts/recent?hapikey=demo&count=2
Use above url and when you will get updated contact result then filter in array.
Hope this helps!
If we were able to answer your query, kindly help the community by marking it as a solution.
Thanks and Regards.
hari0
April 12, 2021, 2:44am
7
Hi @webdew ,
I had seen the `recently_updated` API. But it’s from the legacy API list. Is there a new API added which matches this legacy API?
@hari0 , the legacy APIs are fully supported unless marked as deprecated. You should not worry about the support
hari0
April 13, 2021, 5:49am
9
Hi @dennisedson ,
Thanks for the reply.
Great, Then i can use the `recently_updated` API
system
April 13, 2021, 9:44am
10
No @hari0 this is the only API.