Integration Main Module

The integration.js file is the main entry point to your integration on the Polarity server

Directory Structure

sample-integration/
└── integration.js

Summary

The integration.js file is the entry point into your integration on the server. The file runs on the server and is responsible for taking entities from the Polarity client, enriching or transforming them, and returning results back to the Polarity client.

The integration.js file runs in its own process on the Polarity Server so if your integration crashes it will not also crash the server.

At a minimum your main module must export a doLookup method but it can also provide a startup, validateOptions, onDetails, and onMessage method. Each of these methods must be exported from your main module so that they are accessible to the Polarity Server's integration loader.

The minimum integration.js file which will properly load is as follows:

integration.js
function doLookup(entities, options, cb){
    cb(null, []);
}

module.exports = {
    doLookup: doLookup
}

Method Hooks

The following table provides a summary of the special methods that can be implemented and exported from the integration.js file.

Method

Required

Description

optional

Executed once when your integration is started or restarted

required

Enriches or transforms entities passed from the client and returns the enriched data.

optional

Called anytime a user saves changes to their integration options

optional

Executed when a user opens the details panel for your integration in the Overlay Window

optional

Used to send messages from your integration's front end code (component and template) to your integration's server side code (integration.js)

Last updated