doLookup
Required function which takes entities from the user and returns enriched results
Summary
required function doLookup(entities, options, callback)
Parameters
Description
entities
An array of entity objects seen on the requesting user's screen
options
An options object with key value pairs representing the requesting user's options and their value
callback
A Node.js style callback which should return an array of resultObjects
For a quick overview of the doLookup
method please see the Quick Start Guide.
The doLookup
method is main entry point into your main module. This method is currently the only function that must be exported from your main module (integration.js
). The method receives a list of entities that appeared on the user's screen and the returns contextual data related to those entities.
Parameters
The following is an explanation of the doLookup
parameters
entities
The entities
parameter is an array of Entity Objects. Each entity object contains a range of boolean flags that can be used to determine the type of the entity. In addition, every entity object contains a value
, type
, and types
property.
For additional information please see the section on Entity Objects
Sample entities array
options
The second parameter to the doLookup
method is the options
object which contains the values for the integration options as set in the integration config.js
. Note that for per-user settings the value in the options
object will reflect the value of the user requesting the lookup.
The key in the options
object is the same value of the key
property set in the integration config.js
file.
callback(error, results)
The callback must be called before execution of the doLookup
method completes. The callback accepts two parameters.
The first parameter is an error which can either be a string literal or a JSON API error object. In the case of a string literal the returned string is displayed as an error in the notification window as well as tracked as an error in the integration
If you have no error to return you should return null
for the error
parameter.
Please see below for additional information on error objects and result objects.
Last updated