Creating an intent using a Procedure Conversational Object

Official Content

When defining a chatbot conversation, some topics have to be considered (Intents, Triggers, 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 instance, select the Add -> Flow of the contextual menu.

image_2018228103938_1_png

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).

image_2018228153415_1_png

In this example, the conversational object is a procedure called "Lighting2".

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).
 

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.

enlightenedThe User Inputs are added automatically to the structure and are inferred from the In parameters of the Conversational Object.

Each parameter can be set as an Entity in the Chatbot provider's workspace. The benefits of setting a parameter as an Entity include that its value will be checked against the Entity values. Besides, a try limit can be specified in case the user fails to enter a valid value.

image_2018228153646_1_png

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.

enlightenedInside 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 "Lighting2" procedure has the following parm rule:

parm(in:&UserIdentification, in:&ComplaintDescription, in:&ComplaintAddress, in:&ComplaintPhoto,out:&response);

The output parameter is used to send an answer to the chatbot. The code is as follows:

&complaint = new()
&complaint.UserIdentification = &UserIdentification
&complaint.ComplaintAddress   = &ComplaintAddress
&complaint.ComplaintDescription = &ComplaintDescription
&complaint.ComplaintReason      = ComplaintReason.Lighting
if not &ComplaintPhoto.IsEmpty()
&complaint.ComplaintPhoto       = &ComplaintPhoto
endif
&complaint.TrafficSignalId.SetNull()
&complaint.Save()
if &complaint.Success()
    commit
    &response = !"Thanks for your feedback. It was successfully added and it will be processed asap!"
else
    &response = !"There was an error, try again later please!"
endif

The output parameters are also detected, so a Response node is added automatically, including that parameter. 

image_2018228154341_1_png


The Message node determines the way that this output is going to be shown; in this case, since the Style property is set to Text Message, it will be displayed as text only:

image_2018228154422_1_png

 

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:

image_2018228154633_1_png

At runtime, it looks as shown below:

image_2017121152233_1_png
                image_201712115236_1_png

Was this page helpful?
What Is This?
Your feedback about this content is important. Let us know what you think.