An Action of a Zia bot is characterized by its Sample sentences, Params and Functions.
Params
Params are the input data that are required to fulfill or execute an action. If we consider the execution of an action analogous to filling a form, then the fields in the form are considered as the params for the action.
For example, the params of an action written to create an event would typically be title, start time, end time and so on.
Sample sentences
Sample sentences are the example invocations that end users would say to invoke a particular action in their natural language. These Sample sentences constitute to Zia's intelligence in understanding a user input.
Typical sample sentences for the create event action would be the following.
- Create an event
- Schedule a meeting
Practically, people would speak out data as part of invoking instructions and hence sample sentences may also include certain param values. As in the examples below, user may say the event title, start time and end time as a part of their initial invoking sentence while trying to schedule an event.
- Create an event from 5 PM to 6 PM to discuss about the Zylker deal.
- Schedule a meeting with John at 5 PM.
If the invoking sentence does not contain all the required params, the bot will prompt the user for those param values.
Thus Sample Sentences define the intention of a particular action and the Params define what are all the entities that would be required to fulfill that action. The data model of an Action for Zia’s intelligence is formed by the combination of the Sample sentences and Params.
Functions
Functions are the custom hooks to be written by developers that are executed by the bot during execution of an action. Functions control the flow of an Action. The business logic of an action are defined in these Functions.
All the functions must be written in Deluge, the native online scripting language of the Zoho cloud environment. All the declared params of an action are passed as input arguments to these functions, in addition to some other environmental data that would be needed to execute the business logic.
Every action can have the below functions, that are executed at their respective invocation points during an action execution.
- Action Execution (mandatory) — invoked at the end of an action, after all params are filled.
- Context handler (optional) — invoked for every user input in the course of an action.
Action execution flow
- Whenever a user inputs a sentence in a Zia bot, Zia tries to understand the user input to detect the intention of the user input.
- If the intention matches with any one of the intentions of the configured actions, then Zia will prompt the user for the params that are required to fulfill that action, in the form of a conversation.
- For every user input, the Context Handler Function will be invoked, if enabled.
- Once all the configured params are received from the user, Zia executes the Action Execution Function.
- The return value of the execution function is sent as a reply message to the user.