Conversations

Conversations are a collection of steps that the bot goes through with the user. Each conversation is a separate process that your bot can handle.

Kinvey Chat is built around the concept of conversations. Each conversation can be a specific business process such as Booking an appointment, Transferring money, Purchasing a product or simply Contacting an operator.

Each conversation consists of steps and the steps are executed in a linear way (one after another).

Once you define the conversations your chatbot can have, Kinvey Chat will use predictive analytics and slot-based algorithms to determine the correct conversation and step that needs to be executed next in order to have an intelligent conversation with your user.

Once the chatbot identifies the correct conversation, it will search for a conversation with this name, and start with the first step from that conversation.

As your definition grows with adding more conversations and steps, it becomes difficult to track and navigate between the elements. You can use the navigation menu to easily access the elements or just look at the general structure of your definition.

Types of conversations

The conversation can be one of the following types:

Goal

Execute 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.

"conversations": {
  "myPrimaryConversation": {
    "type": "goal"
    ...
  }
}

Support

These are used to help the user achieve a business process, such as provide billing info, get help, answer FAQs and etc. But they are not meaningful on their own.

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 switch to it from all goal conversations that need to collect such information.

"conversations": {
  "contactInformation": {
    "type": "support"
    ...
  }
}

From a goal conversation, you make the switch to the support one by using a Conversation step:

"steps": [
  ...
  {
    "type": "conversation",
    "conversation": "contactInformation"
  }
  ...
]

When the user completes all of the steps of the support conversation, the bot will switch back to the remaining steps of the goal conversation.

Display name

The conversation has display-name property used to display friendly name to the user in quick replies or wherever you might need.

Use the `` expression to display the friendly name of the current goal conversation.

Built-in Conversations

There are 3 built-in conversations:

  • welcome - introduces the bot and shows the available conversations
  • help - shows a list of conversations the bot can have
  • restart - allows the user to restart the bot and start a new conversation.

Welcome

Here is a basic definition of a welcome conversation that has a message step to identify the conversation with a user.

"conversations": {
  "welcome": {
    "type": "support",
    "display-name": "welcome",
    "steps": [
      {
        "type": "message",
        "messages": [
          "Hello there, I am the virtual assistant of ACME Hospital powered by Artificial Intelligence. If you get stuck, you can always restart our conversation by typing 'restart'"
        ]
      },
      {
        "type": "message",
        "messages": [
          [
            "Here is what I can do for you:"
          ]
        ],
        "display": {
          "type": "quick-reply",
          "data": [
            "Book a doctor",
            "Contact operator"
          ]
        }
      }
    ]
  }
}

Restart

Here is a basic definition of a restart conversation that will force the bot to start from the beginning. Notice the step with reference to the welcome conversation - this will execute the steps defined in the welcome conversation.

"conversations": {
  ...
  "restart": {
    "type": "support",
    "display-name": "restart",
    "steps": [
      {
        "type": "message",
        "messages": [
          "Your conversation is restarted."
        ]
      },
      {
        "type": "conversation",
        "conversation": "welcome"
      }
    ]
  }
}

Help

The help conversation is displayed always when there is no active conversation and the bot does not understand the user input.

Here is a basic definition of a help conversation that shows the user what the bot can do.

"conversations": {
  ...
  "help": {
    "type": "support",
    "display-name": "help",
    "steps": [
      {
        "type": "message",
        "messages": [
          [
            "Here is what I can do for you:"
          ]
        ],
        "display": {
          "type": "quick-reply",
          "data": [
            "Book a doctor",
            "Contact operator",
            "Restart"
          ]
        }
      }
    ]
  }
}

Next steps

Steps and their properties