LogoLogo
Enterprise GuideCommunity Edition GuideDeveloper Guide
  • Using The Polarity Developer Guide
  • Quick Start
    • What's New
    • Installing Integrations
    • Quick Start Guide
    • Learning Resources
  • Building an Integration
    • Directory Layout
    • package.json
    • Configuration File
    • Integration Main Module
      • startup
      • doLookup
        • Entity Objects
        • Result Objects
        • Error Objects
      • onDetails
      • onMessage
      • validateOptions
    • Customizing the Overlay Window
      • Templates
        • Conditionals
        • Displaying a List of Items
        • Display Object Properties
        • Built-in Helpers
        • Displaying Icons
      • Component File
        • Aliased Properties
        • Computed Properties
        • Event Hooks
      • CSS Styles
    • Vendor Javascript
      • Inserting Javascript into DOM
    • README Guide
    • Debugging Integrations
      • Web Inspector
      • Using Integration Logs
      • Testing Main Module
  • Recipes
    • Enabling User Actions
    • Throttling Lookups
    • Using Custom Entity Types
    • Custom Summary Tags
    • Creating a Tabbed Interface
    • Accessing Username of Requestor
Powered by GitBook
On this page
  • Directory Structure
  • Summary
  • Method Hooks
  1. Building an Integration

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)

PreviousConfiguration FileNextstartup

Last updated 5 years ago

startup
doLookup
validateOptions
onDetails
onMessage