A task at a time, moves mountains.
So far we have defined our intents and related parameters including the slots and triggers. Now we will proceed towards defining the set of actions that need to be done for a given intent. For example, once the applyLeave intent has been identified and the required parameters (startDate, endDate, and leaveReason) have been collected, the chatbot is required to do necessary action to ensure the leave is applied for the user. The action or rather the set of actions that need to be carried to successfully complete an intent is defined in the IntentsAndAutomation->Skills/DSM section.
There are two approaches to define the workflow or set of actions that need to taken to complete the intent
- Using Dialog State Transition.
- Using Dialog Workflow.
In this example, we would be using the Dialog Workflow. You can read more about the Dialog State Transition in our Configuration section. The Dialog Workflow provides a highly flexible editor to configure the workflow which makes it recommendable for users.
To create a workflow, using Dialog Workflow, go to the IntentsAndAutomation->Skills/DSM and select Dialog Workflow tab. Use the
+button to create a new workflow.
Each workflow is characterized by
- Name : An unique string used to identify the workflow
- Description : Description of the workflow
- Action/Configuration : Definition of the workflow and actions
Note that you can define the Action/Configuration only after the Name and Description have been defined and saved. Both Name and Description are mandatory fields.
For the applyLeave intent we are working on this example, let us create a workflow leaveApplicationSkill as seen in the image above.
We will now proceed to map the workflow to the intent (in our working example, applyLeave). The intents can be mapped using the Map Intent button under the Action/Configuration column.
This would display the Map Handler And Intent page that allows you to map the intent. All the intents you have defined would be displayed in the Intent combobox. Select the applyLeave intent and Save to continue.
Having mapped the intent to the newly created workflow, it is now time to define the actual workflow. Use the View/Edit Workflow button under the Action/Configuration column to open the Workflow Editor.
Note that the workflow editor will prohibit the user from defining the workflow if the Intent is not mapped. The Workflow Editor mandates the intent to be mapped prior to defining the workflow.
The Workflow Editor provides an easy WYSWYG editor for creating workflows with easy flow-charts.
The Editor comprises two key components.
- Dialog Functions
- Editor View
The Dialog Functions provides the available functions which can be executed by the Workflow Automation. This also includes an explicit Start and Exit function, which identifies the start and end of the workflow.
The key functions available are
- START : Signals the start of the workflow.
- EXIT : Signals the end of the workflow.
- IF : Specifies an if condition
- CALLAPI : _Makes calls to an Rest Endpoint
- GET : Recieves the input from User
- SPEAK : Provide a response to the User
- SET : Set a slot's value, Eg SET validate = true ;
- DO : Call a sub intent. The skill linked to that intent will be called.
- SPEAK_4_EACH : If an API sets a parameter with value as List of strings, SPEAK_4_EACH can make the bot speak all the values in the list. For Example, SPEAK_4_EACH listOfShortListedCandidates ;
- WAIT : WAITS for the given micro seconds before executing next command. For Example, WAIT 2000 ;
- EXPECT : Expects a slot or a comma separated set of slots to be given by the user (there won't be a prompt utterance to ask for the slot in this case)
- TAKE_PAYMENT : Takes payment and updates status to a slot
- ESCALATE : Escalate the conversation to the supervisor
- EMAIL : Send an email
- SAVE2_SHEET : Save values to the spreadsheet. Spreadsheet is available in Reports Section
In addition to the Dialog Functions, the Editor also supports Connectors which describe the transition or relation between the actions. These include
We will now proceed to define our workflow steps.