Campaigns - possible to make lastUpdatedTime more available?


#1

We are trying to develop an app that can sync HubSpot data with a database. Currently we are looking at doing this for the Email Campaigns / Campaign Events, but have hit a snag. The lastUpdatedTime field is only available off of the recent campaigns endpoints:

It is not available off of either the get all campaigns or the lookup campaigns by id endpoints:


This makes an initial import of data difficult to compare with further updates because we need a field that can be relied upon that can be used to identify if a campaign has changed. When we import additional data on further runs, we would ideally only retrieve campaigns that have been modified since the last run. Would it be possible to expose the lastUpdatedTime field on the get_campaign_data endpoint as well so that we can resolve the last updated time of a campaign even if it is not available on the list of campaigns with recent changes?


#2

Hi @Casey_Thompson

Are you syncing all of the existing data during that initial import? If that’s the case, you could use use the time of that initial import as the original last updated time, since you would have everything up to that point, and you’d only need to check for new stuff that happened after that initial sync.


#3

Hi @dadams

I discussed this with our sync tool people. Apparently we already do something like this. Instead of relying on the modified date of the objects returned, we do it based off of when the last sync was executed. However, it doesn’t affect the physical data we save to the columns in the table.

Unfortunately we really can’t alter the data that we are returning for the lastUpdatedTime since it would create incorrect data in the database for those records. Right now we will just populate a database with a bunch of nulls and then some Campaigns will have lastUpdatedTime because they also come back from that list of recently modified campaigns. If it’s not too much trouble, it would help if the “get campaign data” endpoint also returned lastUpdatedTime, but I suppose it shouldn’t prevent us from being able to do sync data.

Casey


#4

How are you using the lastUpdatedTime in the other system? If you’re pulling all of the events for the campaigns, you would be able to get the last update time from the created value of the most recent event in the campaign,


#5

Hi,

We are pulling the Campaigns and Events into their own separate tables. For both tables, to initially populate data, we go to the campaigns/by-id endpoint. For new campaigns, we use the campaigns endpoint to get ids of recently modified campaigns. For events, we just use the events endpoint using a startTimstamp parameter to specify events created after the last successful run.

We are not saving a lastUpdatedTime to the Events table since it is not available on either of those requests and does not seem to be specific to the event or needed in API queries for events. Likewise we are not pulling back events when writing campaign data back since it is not part of the response for the campaigns/:campaign_id endpoint.

Anyways, for now we’ve just settled on copying in the lastUpdatedTime from the campaigns endpoint. It will be available on at least some of the campaigns. It is not ideal and has some accuracy concerns, but this seems to be the best available option without making other unnecessary requests.

Casey