Create a more complex skill
Last Updated: 25.10.2019
Last updated
Last Updated: 25.10.2019
Last updated
After the registration on the Hala Platform, you will get pre-trained skills, one of such skill is "Example: Lock the User." We have created this skill to show you an example of building more complicated skills.
When you open this skill, you will see the following dialog tree:
There is one root node "Receive the query from the user." This root node had a condition intent.hal_example_lock_user
(intent.hal_example_lock_user was created for especially for that skill).
The output is "...skip user input..." and behavior is Skip the user response
.
This configuration means that when the user writes "lock the user" Hala will match the user input with the root node condition intent.hal_example_lock_user
, display the text in the chat, and then Hala starts evaluating the child nodes: "The user name is provided" and "The user name is missed." Based on this, Hala will not wait from the user any text until the evaluation of child nodes are finished.
The child nodes: "The user name is provided" and "The user name is missed" are designed to process the skill in right direction.
Condition of the child node "The user name is provided" is entity.sys-person
, the condition of the child node "The user name is missed" is not_recognized
.
As a result, if the user writes "lock the user Andrii" Hala triggers the child node: "The user name is provided" because we have provided the user name and it matches the entity.sys-person
. If the user writes "lock the user," Hala triggers the child node: "The user name is missed" because the user did not provide the user name of the person to block.
If the user writes "lock the user Andrii" Hala triggers the child node: "The user name is provided" because we have provided the user name and it matches the entity.sys-person
.
This child node has the next configuration: Output includes the text and quick reply buttons and standard behavior when we are waiting for the user response.
When user provides the response, Hala starts evaluating the next child nodes: "Answer - Yes" and "Answer - No".
If the user response is "Yes," then Hala triggers the child node "Answer - Yes" and provides the response based on the output configuration for this node. On this step in real life, we can add the Action and make an API request to the external application to lock the user. In our example, we are displaying the next text: "Thank you for confirmation. I am locking the user (here you can add the integration and action to perform the user block in your backend system)," and then again, we can skip the user response and provide the final text from the next child node "User is locked."
If the user response is "No," then Hala triggers the child node "Answer - No" and provides the response based on the output configuration for this node. This is the last child node in the brunch. Hala provides the text "Ok, if you want to block another user, write, for example, "Lock the user Andrii Rudchuk"" and finish the skill execution.
If the user writes "lock the user," Hala triggers the child node: "The user name is missed" because the user did not provide the user name of the person to block. Based on the child node configuration Hala will send the next text: "Provide the full name of the user, that you want to block" and will wait for the response.
If the user response will include the first name or full name then Hala triggers the child node "The user name is provided". The node output is: "...redirect to another dialog node..." and behavior is Redirect to another node
. This configuration allows us to continue the conversation from another bunch of nodes (more information about the behavior here). With the redirect function, we can manually determine which node should be triggered next. As a result, Hala will continue the conversation from the node where we have redirected the flow.