When defining a chatbot conversation, some topics have to be considered (Intents, Trigger Messages, Messages, Entities, and Flows).
An Chatbot Intent is always represented by a Flow, and the Flow can be associated to a GeneXus object through the Conversational Object property.
Here we explain how to define an Intent using a Flow whose Conversational Object is a procedure.
To add a Flow to the Conversational Flows object, select the Add -> Flow of the contextual menu.
Next, enter a Name for the Flow, some Trigger Messages, and select the GeneXus object which will be triggered after the intent is recognized and the user finishes entering all the required input (the conversational object).
In this example, the conversational object is a procedure called "Lighting".
In the Chatbot Provider (e.g., Watson), an Intent will be defined for the dialog using the given Flow name. It's important to define Trigger Messages for this Intent to be detected by the Artificial Intelligence (AI).
The "Lighting" procedure has the following parm rule:
parm(in:&UserIdentification, in:&ComplaintDescription, in:&ComplaintAddress,out:&response);
Once the Intent has been detected, the user will be asked to provide some information to comply with this Intent. The information to be asked from the user is displayed under the User Input node of the structure.
The User Inputs are added automatically to the structure and are inferred from the In parameters of the Conversational Object. The output parameters are also detected, so a Response node is added automatically, including that parameter.
The Chatbot Message node determines the way that this output is going to be shown; in this case, since the Action property property is set to Text Message, it will be displayed as text only.
Note that in the Messages property you configure the message text which is going to be displayed, in this case, is the &response variable which is in the dialog context (the output of the Conversation object).
In sum, the Intent is defined as follows in the Conversationals Flows instance structure:
Each parameter can be set as an Entity in the Chatbot Provider's. The benefits of setting a parameter as an Entity is that its value will be checked against the Entity values. Note that in this example, the UserIdentification is set to match with an entity, whose name is "UserIdentification".
The Ask Messages property allows specifying the message to be shown to the final user in order to ask him to enter that input.
The On Error Messages property value is thrown when the input entered is not valid. A Try Limit property can be specified in case the user fails to enter a valid value.
Inside the On Error Messages property you can include the reference of what the user has entered: &GXUserInput. For more information see HowTo: Reference context parameters in a conversation.The output parameter is used to send an answer to the chatbot.
At runtime, it looks as shown below: