Actions

Last Updated: 25.10.2019

Overview

If you configured the integration and actions, you could use Actions in skills, to make the request to external application and get a response from it.

Adding your Actions allows you to make a trigger of programmatic function in the external applications based on end-user expressions and send dynamic responses back to the end-user or even start a chain of making API calls based on rules and conditions. For example, if an end-user wants to get a balance in SAP, your Action can check the SAP database and respond to the end-user with the balance for some particular account.

Each skill node has a settings to enable Actions. If a skill node requires to trigger a programmatic function in an external application, you should allow Action for the node.

The following diagram shows an example that uses action in integration with external application.

  1. The end-user asks for information about the balance in the backend system.

  2. Hala matches the user input with the intent intent.get_balance, and then search for the root nodes that include the condition intent.get_balance.

  3. Based on the response configuration in the founded node, Hala responds to the user and asks for additional information.

  4. The end-user responds "1000".

  5. Hala matches the user input with the entity.company_id, and searching for the child nodes that have the condition entity.company_id. The node configuration includes the activated Action "SAP Get Balance" and response. Based on this configuration, Hala will make the API call for the selected action and do not send the response to the end-user.

  6. Hala makes the API call of the action "SAP Get Balance" by sending the data to the external application - SAP. You should configure the integration and action upfront.

  7. The external application performs a programmatic function based on import parameters from Hala and then sends the response back to Hala.

  8. To evaluate the response from the external application, you need to specify the context variable in the child node condition. In the current example, the API response will be stored in context context.SAP.response. Also, the child node has a response setting. As a result, Hala will send the response to the end-user.

  9. After the system performs the necessary database queries, Hala provides the balance for the requested account.

Adding Action

When you are creating your skill nodes, you can see the section with Actions, and you can select the actions that you have created upfront on the page Actions.

When you will select the action, you will see the technical parameters of the Action (API). You can change the values for the parameters from the skill node interface.

If you want to add new parameters into the action or change them, you can do this only from the page Actions, where you have created the action initially.

Here is an example of added action into the skill node. You can add as many actions as you want (be sure that you will store the response from the Action in a unique context variable).

Be default the response from the Action (API) will be stored in a context variable context.actionResult, you can change the name of the context variable to the name that meets your goals with this Action. For example, if you want to make the action in the SAP, you can name the context variable like context.SAP or context.SAP.response.

If you are using actions, you need to create at least two child nodes to handle the response from the action, one child node will process the success response, and the second child node will handle the response with the error.

More information about the actions here: Actions‚Äč