General Patterns for Creating Add-ins

When you are creating add-ins for Interaction Connect, there are a few things that you need to keep in mind in order for your add-in to function correctly:

  • Each function that taps into the Interaction Connect application is asynchronous and will return an IPromise instance, which represents the result of the function that may not yet be available.
  • Function arguments and return values are generally interfaces. In other words, functions can simply pass objects that conform to the interface specified by an API's definition, or use the defined API on the returned object.
  • Some objects implement the ININ.Addins.IEventHandler interface, which means that they will raise one or more events. Event handler callbacks can managed by calling one or more of the following functions: on, once, off. For example:
function callback(...) { }
eventHandlerObject.on("event", callback); // all future events until `off` is called
eventHandlerObject.once("event", callback); // the next event
eventHandlerObject.off("event", callback); // removes the callback
  • Subscriptions need to have their events bound before calling subscribe, otherwise, an event may be fired and be missed.
  • When an object has a dispose function, this means that the add-in has a way to inform the application that it is finished with the specified instance and it will be cleaned up. As such, no further events will fire and function calls will fail with this particular instance.

  • Common constants are also provided, including interaction attribute names and common interaction attribute values (found in the ININ.Addins.IC.Interactions namespace).