integrator.io helps to connect business application and transfer data between them. A flow in integrator.io is composed of sources and destinations. An export retrieves the data of the source application and breaks it into smaller pages. An import processes those pages and stores the data in the destination application. Exports and imports have different types of hooks. Hooks are custom code that can run at different stages during the execution of a flow to modify the behavior of export and import processes.
The different types of hooks are,
Export Hooks
Export hooks run during the export stage of a flow. The integrator supports only one type of export hook i.e., Pre save. With the help of pre save hook we can format, filter, and perform logic on the data coming from source before it passes to the data flow. The logic that applies to the data at all steps of the integration should be done at this stage of the flow. The major use of this flow are to filter the data at line level, to apply calculations on data like to calculate discounts, for complex data formatting and to perform data validation etc.
Import Hooks
Import hooks are the hooks that are executed during the import process of a flow run. One of the import hook is postResponseMap hook. The postResponseMap hook is used to process records after response mapping before they are passed on to downstream applications in your flow. Any changes that you made to records by using postResponseMap hook will affect ALL downstream applications. The most common use case of this hook is error management i.e. to ignore errors, trigger error and to modify error messages.
Pre Map Hook
This hook are invoked before the fields are mapped to their respective fields in the objects to be imported. This hook can be used to reformat the record’s fields before they get mapped. It is helpful to apply logic to the data within an import prior to going through the mapping process. Any manipulation of the data in this step only applies to the import that it is running on. Therefore it is used to insert default values and it format the data that can be used for mapping.
Post Map Hook
This hook is invoked after the fields in the source objects have been mapped to their respective fields in object to be imported. This hook can be used to modify the mapped data. It is helpful to run complex calculations and set default values based on mapped data.
Post Submit Hook
This hook gets invoked after the records are processed by the import. It is very helpful to provide details around error messages. Post submit hook can be used to ignore known errors in custom flows.
postAggregate Hook
postAggregate hooks are invoked after the final aggregated file is uploaded to the destination. This hook only works when the ‘skipAggregation’ property is ‘false’. This hook is passed a read only object.