Whenever a new dialogue model is created, it will open in the Dialogue Designer. In the main editing area, you will see a default built-in structure: Enter --> Speech --> Exit. But there are many more types of nodes. Let's see how you can use them to achieve particular designing goals.
Any model must always start with an Enter node. This is where the bot will enter the dialogue model and begin the conversational adventure. It goes without saying that each dialogue model must have exactly one Enter node, otherwise the bot wouldn't know where to start!
If you want to begin the conversation differently depending on the context, Enter will have to be followed by a Function, where you will define the decision process, according to which the flow will branch into multiple paths.
To indicate that a particular path through the graph has come to an end, use Exit / End / Sleep. What's the difference?
To LEAVE THE CURRENT DIALOGUE MODEL, use the node Exit. When the bot is running, it will behave like this:
If the current model is nested in another model, it will emerge back to that higher level.
If the current model is not nested in another model, it will behave like an End node: it will end the session.
If you want the bot to END THE RUNNING SESSION (i.e. end the whole conversation, stop talking and forget the session context) no matter if the model is nested or not, use the node End.
Note: This node is actually not used that much. You will probably want to use it only in quite specific situations (e.g. when the user says "stop!").
If you want to SUSPEND THE CONVERSATION but STAY IN THE CONTEXT of the session (so that the user can resume the conversation after a while), use the node Sleep. How long should it keep the context? You can set this in the Properties of the node: just type the number of seconds that the bot should wait for session re-start. When the time is out, the session will end in the background.
Note: Since Sleep doesn't really leave the dialogue flow, it must be always followed by another node. The flow must go on!
What the bot says is usually defined in Speech nodes. So as you can guess, you will be using these nodes A LOT. Using them is pretty straightforward:
Click on a Speech node inserted in the graph.
In the right panel, choose the tab Texts.
Type what the bot should say.
If you don't want your bot to always repeat the same formulation, you can insert multiple variants into one Speech node. How?
LINES. Each new line means a new variant.
BRACKETS WITH VERTICAL BARS. Vertical bars inside round brackets divide the brackets' content into equivalent alternatives. You can even nest brackets inside other brackets! An example:
(Hello|Hi there|(Nice|Good) to see you (|again)), my friend! will result in 6 variants:
Hello, my friend!
Hi there, my friend!
Nice to see you, my friend!
Nice to see you again, my friend!
Good to see you, my friend!
Good to see you again, my friend!
You can easily combine both tactics to achieve a much more varied Speech node. During a conversation, one of all the variants inside a Speech node will be selected randomly.
To indicate that it's time to START LISTENING (or expecting written input), connect a User Input node to the flow.
At this point, the user will respond. The system will then process the message and decide what should happen next. That's why you will have to define HOW DIFFERENT USER MESSAGES WILL AFFECT THE FLOW. In other words, the User Input will serve as a fork, a "crossroads".
Users can say literally anything, so how do you cope with this? In most cases, you will want to categorize the input using recognition of intents. Simply put, "intents" represent the meaning of the message (you can express the same intent [e.g. "yes"] by many different synonymic utterances: yes; oh yeah; sure; absolutely; you bet; ...).
For each User Input, you will need to define the most relevant intents (each intent will have its own green Intent node) by typing in some example phrases and indicate what should be the reaction based on the detected intent.
So, to your User Input node, connect as many Intents as you want the bot to detect at this point of the flow (these "local" Intents will be active only where they are connected – unlike Global Intents). But how do you define the meaning of the intent? Let's take it step by step:
Insert an Intent node and connect it to the User Input node.
Click on the Intent to see the node details in the right panel. Open the "Examples" tab.
Write example phrases that will define the semantics of the node (the meaning). To create different variants, use the same tactics as described above (lines + brackets with vertical bars). This is how the AI learns to distinguish between different intents that are active at this point of the flow.
Continue designing the dialogue flow by connecting new nodes.
Some user intents can be expected only in a particular context (connected to a particular User Input), but some intents are more general – any requests/questions/remarks that the user can say at any point of the conversation. You could connect such intents to every single User Input, but there's a better alternative: use the Global Intent nodes. Global intents are automatically detected throughout the whole dialogue model (and all models nested inside it). There is no transition leading to them: it's as if they are connected to all User Inputs.
After some global intents, you will want your bot to jump back to the point from where the user "deviated", and resume the original flow. To do this, use the Go Back node.
In most such cases, you will also want the bot to repeat the last text before the global intent, to indicate the previous context – for this, check the "Repeat after going back" box in the Go Back node: the bot will repeat all nodes marked as "repeatable".
A random example of global intents: if you are designing a multi-turn conversational game, you might want to include for instance:
a global intent meaning "stop this game", because the user can decide to quit the game at any moment; react to it and exit the dialogue flow;
maybe it is relevant to also cover globally the question "what is the name of this game?"; react to it, go back, and repeat the previous line.
The following gif shows how to do it:
Spoiler: to complete such tasks, you will use primarily the Function node. It might seem almost frightening – such a powerful node! But believe us, it will eventually become one of your best node friends.