For a better understanding, we will start with the most essential parts our plugin must have.
In order to develop a plugin for Botonic, you will have to create a new directory structured as explained before. Once created, you will have to copy this boilerplate code in your
As seen, in our plugin we have three basic methods:
constructor: used to give to our plugin the necessary options (JS Objects) needed to run our code, such as tokens, authentication keys, etc.
pre: stands for all these kinds of operations that we want to preprocess of our input, such as applying NLU to extract intents or entities.
post: stands for all these kind of operations that we want to process ex-post, such as adding a tracking id to our session.
Botonic will look for pre and post methods and will execute them before or after the input is processed, correspondingly.
Note: It's crucial that
post methods are declared with the async keyword for an expected behaviour.
Let's take a closer look at Botonic LUIS Plugin:
That's all! Once you have implemented your plugin, you are ready to use it.