Cognitive Flow

Learn about the structure and the basic concepts of the configuration of your bot’s conversations.

The Cognitive flow describes all conversations the bot can have. It also contains some general settings for your bot.

Each conversation is comprised of steps executed in a linear way. The bot will try to go through all of the steps in a conversation. You can define conditions on each step if you want it (or don’t want it) executed in certain circumstances.

The Cognitive Flow is described in JSON format (Bot > Cognitive Flow in NativeChat Portal).

Structure

The default structure for your bot has three elements defining the built-in conversations, settings, and commands.

Here is a basic Cognitive Flow example:

{
  "conversations": {
    "conversation": [
      "steps": [
        ...
      ]
    ]
  },
  "commands": {
    "NEXT-PAGE": [
      "Next 5"
    ],
    "PREVIOUS-PAGE": [
      "Previous 5"
    ],
    "RESTART": [
      "restart"
    ]
  },
  "settings": {
    "invalid-replies": [
      "I am not sure I understood what you said."
    ],
    "general-failure": [
      "We are experiencing technical difficulties at this moment."
    ],
    "previous-conversation-messages": [
      "I am going back to {{ conversationDisplayName }} now."
    ],
    "silence-timeout": 60,
    "persist-entities": [],
    "timezone": "Universal"
  }
}

Conversations

List of all conversations and definition of every conversation.

See Conversations page for detailed documentation.

Commands

Optional element specifying expressions that will trigger built-in bot commands. If this element or any of its children are omitted, default values for the bot’s language will be used.

  • NEXT-PAGE: List of expressions that will trigger the NEXT-PAGE command, used to navigate to the next page of data when paging is available.
  • PREVIOUS-PAGE: List of expressions that will trigger the PREVIOUS-PAGE command, used to navigate to the previous page of data when paging is available.
  • RESTART: List of expressions that will trigger the RESTART command, used to restart the bot and start a new conversation.

Settings

Definition of all general bot settings (not specific to a particular conversation)

See Settings page for more info.

Basic Concepts

Check the following diagram to get a overview of how a conversation with your bot happens and how the bot engine determines how to respond to a user message.

Cognitve Flow: behind the scenes of a conversation.

Automatic slot-filling

Slot-filling is the machine algorithm where you have a defined number of pieces of information (slots) to gather from your users. Each slot corresponds to an entity and a step in the cognitive flow. Thanks to the NLP NativeChat can automatically fill some (or all) of the slots if the user writes them in some part of the conversation.

For example, if you need to collect for an appointment the doctor, the date and the time, you define 3 entities and 3 steps in the cognitive flow. But if the users say something like “Can I visit Dr. Smith on Wednesday afternoon?” NativeChat will automatically fill the 3 matching entity values with Dr. Smith (doctorName), 21-03-2018 (date) and 12:00PM (time) and not ask explicitly about them.

Bot Memory

NativeChat chatbots have long-term and short-term memory.

  • short-term memory - this is where all the information from the current conversation with the user is stored.
  • long-term memory - after a conversation is completed, all the information from the short-term memory is saved in the long-term memory. And then the short-term is reset.

Information in the long-term memory can be used for displaying suggestions to the user or automatically pre-filling some of the data in a conversation.

Read more about bot memory and how to use it.

Linear vs decision-tree

The steps of the conversation you define in the Cognitive Flow are executed in a linear way, one after the previous.

You can add conditions to each step so it is executed only if the conditions are met.

In a conversation with a user, the chatbot will always try to finish conversation by running all the available steps.

Types of conversations

There are 2 types of conversations the chatbot can have depending what you are trying to achieve with them.

Goal conversations

The goal is to complete a specific business process, e.g. book an appointment, make a request, etc. When the bot is having a goal conversation it will try to complete all the steps and keep asking the user questions.

Learn more about goal conversations.

Support conversations

These are used to help the user achieve a business process, such as provide billing info, get help, answer FAQs and etc.

One support conversation can be referenced from multiple goal conversations.

For example, if you need to collect contact information from the user, you can create a support conversation “Contact Information” once and then redirect to it from all goal conversations that need to collect such information.

Learn more about how to configure a support conversation.

Next steps

Defining Conversations