The Intent Resolution Process is only started after an Intent is matched and validated. The goal of this process is to create a response, or a number of responses, for the user.
This process is also optional, since the response could be generated by the NLP.
The process is asynchronous by nature, since it can return promises if an asynchronous call needs to be performed. An example of this type of call could be a request for data from an external API.
This is an example of the onResolution method.
//Intent Hello
let helloIntent = new Intent("hello");
helloIntent.onMatching = () => {
return state.messageFromUser === "Hello";
};
helloIntent.onResolution = async () => {
state.setField('previousGreeting', 'hello');
state.addStringResponse("Is it me you are looking for?");
};
In this case, the Intent will reply with the string message "Is it me you are looking for?" whenever a user writes "hello".
Comments
0 comments
Please sign in to leave a comment.