A delta export retrieves only those matching records that were changed or created since the previous flow ran or a specified date. Certain HubSpot API requests do offer the Delta export type as a built-in option. However, integrator.io is not always able to set the HubSpot query parameters to check the “last exported” (lastExportDateTime) value that it typically relies on to export only unsynced records.
As a safeguard, you can achieve full delta functionality in v3 of the HubSpot API by setting an output filter on the exported records, as described below. In short, this example compares the “last modified” value returned by HubSpot with a record’s “last exported” value.
- Create a HubSpot export with the following settings:
- API version: v3
- API name: CRM API: Companies
- Operation: List
- Click the Preview button, and record the JSON path to the “last modified” field in the response data – in this case, properties.hs_lastmodifieddate.
- Save and close the export.
- Returning to Flow Builder, create an output filter:
- Click Define options (+) on the export, and select Output filter ( ). The Define output filter panel opens with an empty initial rule.
- Click to edit the Operand settings (), set the Operand type to Expression, and click Save to close the dialog.
- Paste the following expression into the first operand field, where
last-modifiedis the value from step 2 (see image below):
- Choose is greater-than for the operator.
- Change the second operand’s Operand type to Value and its Data type to Number, and set its value to
- Save and close the filter, and run the flow.
This new filter excludes all records that were modified before they were last exported, based on calculating the difference between the timestamps in properties.hs_lastmodifieddate and lastExportDateTime. Thus, a record with a positive value – meaning that its “last exported” date/time is earlier than its “last modified” date/time – proceeds in the flow.