#Functional node

Understanding functional nodes

In the graph we have simple nodes, containing the messages fired by the chatbot and functional nodes. As per name, functional nodes contain functions, that is to say nodes containing some logic. With functions you can set built-in logic rules or execute API calls to your core systems and associate a chatbot behaviour according to every function’s output.

All functional nodes share the same principle: the flow of the conversation varies according to the previous user input. In other words, the functional node contains some logic to select the conversational path depending on the history of every user’s chat.

In order to create a functional node select the 🔹 icon from the controls toolbar at the left of the board and exactly as per simple nodes, click in any empty space in the board.

Every function has outputs represented through red edges. In a functional node, edges are predefined, therefore, when creating new ones the edge control panel will display a dropdown with the available options. For example, in the function below, we check an email address and are given valid and invalid outputs as options.

There are Standard Functions, which are provided directly by Spixii and Custom Functions, with possibility to enter custom logic. We can see some examples starting from Standard Functions.

Standard Functions

Most of the Standard Functions are validation functions. As an example, the simplest scenario is a function with two outputs: valid and not valid. When the input from the user is not valid, you can create an outcoming edge pointing to an error message. When the input is valid, the conversation can continue as per the “golden path” to the following conversational node.

Some of the Standard Function examples include:

Custom Functions

With Custom Functions you can define a new function along with its outputs. Spixii CPA provides a powerful Function Manager to create and manage the function straight from the platform.

When creating a new functional node, the option Create new function is available from the sidebar. When clicking the button, the function control panel will allow you to specify name and description for the new function.

The Function Manager contains the following elements:

  1. The Source code panel, that allows you to enter or even import your code. Through the Python coding language, specific logic can be defined for the conversation flow.

  2. The Arguments panel,

  3. The Returns panel, where the outputs of the function are defined. Outputs correspond with edges outcoming from the functional node.

  4. The Function simulator panel, where the function can be tested while creating it with the help of the development logs to the right.