Botpress Cloud: Studio Interface
This is the diagram style editor where you design your conversations. Be sure to right-click the diagram for more options!
Botpress uses a Dialogue Engine to handle conversations. For every interaction, it handles the user input and the chatbot response.
The Dialogue Engine uses Flows to represent a chatbot's overall conversational logic. A Flow is composed of Nodes which execute a series of Instructions.
Instructions are part of a Node’s lifecycle that tells the chatbot to say something to the user, wait for the user to say something, or execute code.
A Topic is a way to group your bot's content. For example, if you’re building a bot for a hotel, topics could be events, reception, hotel menu, parking charges, amenities, accessibility, about-hotel, etc.
The topic description provides context to the NLU for improving predictions.
Each Topic consists of Flows and Q&As. Within a topic you can create multiple Flows and Q&As that share the same context.
When you create a new bot, you will have a default Global Topic with a Main Flow, an Error Flow, and a Q&A section.
You cannot delete the Global topic, its main flow, its error flows, nor its Q&As section.
A flow allows you to break down a complex chatbot into multiple smaller flows. Breaking down the chatbot into multiple flows makes it easier to maintain, and you can re-use these flows when building other flows or even other chatbots.
The Main Flow comes with an Entry Node, a Standard Node and an End Node.
You cannot delete the main flow of the Global topic.
A workflow always starts at its Entry Node At the beginning of each conversation, the Start Node of the Main flow of the Global Topic is the first to be executed. When the conversation reaches a node, Botpress will queue the active node's instructions and execute them in the order they were added to the node.
The flow is event-based and non-blocking by default, meaning it will execute all the nodes and instructions until it needs to wait
In other words, once the Entry Node is processed, the flow will continue to proceed to the next node in the flow until it reaches the very end of the flow or until a node needs to “wait” for user input.
There are currently two reasons for a flow to wait:
- It has reached a Capture Information instruction in a Standard Node
- It has reached a Prompt field that can’t find the required fields in the conversation history
Go to another workflow
After building a few flows, you'll quickly notice that there are some common patterns that you find yourself implementing over and over. These can be seen as reusable components between multiple flows.
Once you have created your sub-flow, right-click in the Flow Editor, hover over the Go to another workflow option and select your subflow.
Nodes are the primary units of conversational logic of your chatbot. A node generally transitions to another node or flow. You can think of a node as a step in a conversation.
A single node can have multiple content types, instructions, and transitions. When there aren't any more transitions, the conversation ends.
Node types: Start, Entry, Standard, Exit and End
The Start Node is a specialized Entry Node that is only available in the main flow of a Botpress bot. It serves as the starting point for the conversation and can only execute transitions to other standard nodes.
Every workflow in your bot, except the main flow, starts with an Entry node. The Entry node is the starting point for each individual workflow and can only execute transitions to other standard nodes within that workflow. It is used to define the entry point for the workflow and the initial conditions that must be met for the workflow to start executing.
Similar to the Entry node, every workflow in your bot, except the main flow, should end with an Exit node. The Exit node is the final node in a workflow and can only receive transitions from other standard nodes within that workflow. It is used to define the exit point for the workflow and specify the conditions that must be met for the workflow to end. The Exit node typically contains cleanup or finalization logic, such as sending a message to the user or updating a database, before the workflow is completed.
The Standard node is a versatile building block in your bot's workflow. It allows you to add both instructions and transitions to your flow, and it can be used to represent a variety of steps in the conversation with the user.
You can add instructions to the Standard node to define what the bot should do at that point in the conversation, such as sending a message or asking the user for input. You can also add transitions to the Standard node to specify the conditions under which the conversation should proceed to the next node.
Standard nodes can be connected to other nodes within the same workflow using transitions, allowing you to create complex conversation flows that adapt to the user's input and actions. They are essential building blocks for creating conversational AI experiences that are engaging and useful for your users.
The End Node is a unique node in your bot's Main Flow. Its purpose is to clear the conversation session and reset the bot to its initial state once it is reached. When the End Node is executed, it will erase all variables and user data associated with the conversation and set the cursor back to the beginning of the Main Flow.
The End Node is typically used when you want to reset the conversation with the user and start a new session from scratch. It is particularly useful for bots that handle sensitive or personal information, where it is important to ensure that previous session data is not accessible to subsequent users.
Note that the End Node is only available in the Main Flow of your bot and cannot be used in other workflows.
In Botpress, Variables are used to store and manipulate data throughout the chatbot's conversation flow. You can create variables to store user input, API responses, or any other data needed for the chatbot to function properly.
Read more about Botpress Variables
In a bot conversation, each session has an associated state which is created at the beginning of the conversation just before the Entry Node is processed. The state persists throughout the conversation and is used to keep track of information related to the ongoing interaction with the user.
The state is global to the conversation, which means that if the conversation spans multiple flows, all the flows will share the same state. This allows information to be passed between flows and ensures that the bot has a consistent view of the conversation history.
The state can be used to store variables, such as the user's name, preferences, or history of interactions, that are needed throughout the conversation. It can also be used to keep track of the bot's progress through the conversation, such as which questions have been asked and which tasks have been completed.
By using the state effectively, you can create more personalized and engaging bot experiences for your users.
Q&As are part of the Topics. They are specifically designed to simplify how to handle frequently asked questions. They add more responsiveness to your chatbot. You need to add at least three different training phrases.
XQ · XA The X represents the number of questions and answers you have for this Q&A.
- Typing three sentences enables machine learning. 2. Typing 10 sentences makes your Q&A more resilient.
Press enter after typing your question/answer. It quickly adds a new alternative question/answer.
There are always specific questions that your customers ask a lot. This is why you can easily add questions and their answers without having to do it within the flow.
Add a Question
In the Explorer panel, under Topics > Q&A, Click the + button to create a new Q&A. Write your first question under Question, where it says: Write a sentence.
When you have no more than one question, only an exact text match will trigger an answer from the chatbot. You require a minimum of three to enable machine learning.
For example, when a user asks for the opening hours, you could add these question variations:
- When are you open?
- I can't find the opening hours. Can you help me?
- Opening hours, please.
- What are the opening hours?
- Tell me when you're open in the morning
For every Q&A, you can have one answer, or you can provide additional alternate answers. When your Q&A triggers, an Alternate Answer is selected randomly and sent to the users. This makes the conversation feel more natural and "human."
Although alternate answers have different phrasing, their meaning should stay the same.
Add an Answer
Under Answer in Q&As, type the basic answer to the question in the box. Click + Add Answer Alternatives, and type as many alternatives as you need.
The number of answers is not essential. It could be 1 or 10, anywhere in between, or even more; it won't make a difference for the Language Understanding. However, for the Questions, you might want to add different utterances to teach your chatbot that it doesn't have to match the question asked precisely.
For example, when a user asks for the opening hours, you could add these alternate answers:
- Monday to Friday from 8 AM to 5 PM.
- We are open from Monday to Friday from 8 AM until 5 PM.
- Our opening hours are from 8AM to 5PM on weekdays.
- You can reach us from 8AM to 5PM every day of the week.
- The store opens at 8AM and closes at 5PM every weekday.