Lexicon offers a local REST API to interact with it and has the ability to create your own plugins to run.
REST interface to connect third party applications
Javascript that users can run in their own Lexicon