A delta export retrieves only those matching records that were changed or created since the previous flow ran or a specified date. Certain Intercom API requests do offer the Delta export type as a built-in option. However, integrator.io is not always able to set the Intercom 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 the Intercom API by setting an output filter on the exported records, as described below. In short, this example compares the “last exported” value returned by Intercom with a record’s “updated at” value.
- Create an Intercom export with the following settings:
- Resource: Contacts
- Operation: List all contacts
- Click the Preview button, and record the JSON path to the “updated at” field in the response data – in this case, updated_at.
- 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
updated_at
is the value from step 2 (see image below):["subtract",["number",["extract","updated_at"]],["divide",["epochtime",["context","lastExportDateTime"]],1000]]
- 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
0
.
- 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 updated_at and lastExportDateTime (after converting it from milliseconds to seconds). Thus, a record with a positive value – meaning that its “last exported” date/time is earlier than its “updated at” date/time – proceeds in the flow.
Comments
Please sign in to leave a comment.