Teach Your Bot to Have Conversations

This page describes the essential tasks required to build a bot in CXone Bot Builder. This is the third step in the bot implementation process.

Teaching Your Bot to Have Conversations

You don't need to script each possible variation of a conversation. Bot Builder bots use conversational AI technologies, which allow them to understand contacts' meaning and respond appropriately without being scripted. However, you do need to teach the bot how to handle conversations with contacts. You do this by creating conversation templates using rulesClosed Used to define bot's response to messages that don't change with context. and storiesClosed Used to train bot for interaction handling based on intent and context in Bot Builder.

Rules and stories, also known as dialogues, teach the bot how to respond to the contact utteranceClosed What a contact says or types. by utterance. Each dialogue focuses on a specific, small part of the conversation. They generally consist of a contact utterance, the corresponding intentClosed The meaning or purpose behind what a contact says/types; what the contact wants to communicate or accomplish, and the bot's response.

You may need more than one dialogue for a given intent. There might be some situations where you want your bot to respond differently to the same intent based on certain criteria. You can teach the bot how to tell the difference by creating multiple dialogues, each their own unique response and the criteria that define when the bot should give that response.

How Dialogues Teach the Bot

During an interaction with a contact, the bot analyzes the contact's utterance and identifies the intent. If the intent only has one configured dialogue, the bot responds according to that dialogue's configured response. If there are several dialogues for the intent, the bot analyzes the conversation to detect clues for which version of the dialogue it should use.

The following diagram shows the bot's logic in responding to a contact: 

Bot Responses

Bot responses can be as simple or as complex as you want to make them. Bots can: 

  • Reply with information or questions.
  • Display images, GIFs, videos, or links to web pages. They can include buttons or lists that the contact can interact with.
  • "Choose" which action to take using conditions. You can configure multiple possible responses based on what the contact says.
  • Follow a form to collect information from the contact.
  • Escalate the interaction to a human agent.

Bot responses are built in dialoguesClosed Bot stories and rules in CXone Bot Builder. and consist of one or more of the available bot actions. Bot actions perform a specific function. Some bot actions send content to the contact, such as a message or a list of options to choose from. Other bot actions perform tasks that are invisible to the contact, such as calling an API or pulling data from or storing data in a third-party application.

Bot Builder has a set of default bot actions that you can choose from, but you can create custom bot actions. Custom bot actions can be make API calls or be designed with custom JavaScript.

Skill Store

Bot skills allow you to group your bot's configurations and training data according to what your bot can do. You can use them to filter training data, which makes it easier to focus more specifically each task your bot can accomplish.

Bot skills are also used to distribute pre-made abilities to Bot Builder users via the Bot Builder Skill Store. NICE CXone uses the Skill Store to provide integrations with various CXone features and products.

For example, if you want to use your CXone Expert knowledge base with your Bot Builder bot, you can add the Enlighten Autopilot Knowledge bot skill to your bot. This adds all the necessary rules, stories, intents, entities, slots, scripts, and so on to your bot.

You can design bot skills and submit them for approval to be added to the Skill Store. NICE CXone reviews them and will add them to the Skill Store if they're approved.

Train Your Bot

Training your bot helps it learn from the configurations you've made. The better the quality of the training, the better the bot's ability to correctly predict intents will be. Training happens in the following ways:

You can test how well-trained your bot is by chatting with it in Bot Builder. By chatting with your bot, you can see where it has problems and make corrections immediately.

Part of the ongoing training process is working with your bot to make it smarter. The smarter your bot is, the more effective it is at predicting intents and choosing the correct response. You can make your bot smarter by reviewing conversation data and making changes to your bot in response to problems found in the conversation data. You can review and improve your bot

Training Data

IntentClosed The meaning or purpose behind what a contact says/types; what the contact wants to communicate or accomplish examples train your bot on the various ways a contact might express an intent. The more examples of an intent you have, the more variations of that intent your bot will be able to correctly identify. Use real-world conversation data to test and train your bot. Always opt for quality data over quantity for best results. This helps ensure that the bot is well-prepared to handle conversations with real contacts.

You can review your intents to see which ones need more training examples. Each intent has a number next to it that indicates the number of examples it has. Intents with 14 or fewer examples need more, if possible.

Train and Stage Option

When you are ready to test changes you've made to your bot, you can click Train and Stage. This adds the changes to the bot so you can test them. Additional training through conversations may be required to refine the bot's understanding of the configuration.

If you are making improvements to a bot that's been deployed to production, Train and Stage creates a new bot modelClosed Version of a bot that has been trained and staged and deploys that model to stage. If you want your improvements to be reflected in production, you need to manually deploy this new model. This ensures no bot model enters production without your explicit consent.

You can use the health monitor to track the progress of trainings initiated with Train and Stage.

Train Your Bot with Stories and Rules

Stories allow you to teach your bot how to respond to messagesClosed Anything a contact says in a bot interaction, whether question or statement, written or spoken. in the context of an interactionClosed The full conversation with an agent through a channel. For example, an interaction can be a voice call, email, chat, or social media conversation.. You can create stories from scratch or convert actual conversations into stories. Rules teach your bot to respond to messages whose meaning doesn't rely on context.

Sometimes you may need to create multiple stories for a single intent. This is useful when there you want your bot to respond differently depending on small differences in the intent. For example, if a bot can check account balances, you might want the bot to respond differently depending on the type of account the contact wants to check.

Stories and rules may need periodic updates and revisions. For example, if, after reviewing conversation data you discover that one of your stories is causing the bot to be confused and predict the wrong intent, you can address the problem by changing the story. In some cases, you might need to change the intent as well as the story.

Training Data Best Practices

When planning your approach to gathering training data and training your bot, keep the following best practices in mind: 

  • Always opt for quality over quantity. It's okay to start with a small data set and build it over time as you gather more high-quality examples.
  • Use examples from real-world conversations. This ensures that the data you use is realistic. It comes from things real contacts have said.
  • Don't use tools that auto-generate data and claim to train your botClosed A software application that handles customer interactions in place of a live human agent. faster. They often produce examples that don't reflect what contacts really say. They also can result in a bot that loses its ability to generalize. Over time, the bot reaches a point where it only recognizes phrases it's seen before.
  • Do not use the same training data for more than one intent. If you re-used training data, the bot won't be able to reliably determine the intent in live interactions with contacts.
  • Remain flexible and willing to adjust intents and stories over time. As you review conversation data, you may discover that what you thought was two separate intents are really shades of the same, more general intent. Or you may find that an intent is too broad, and you must break it down into more distinct intents.
  • Add new training examples only if they will help.
    • Do not add new training examples that are very similar to existing examples. If the bot correctly predicts the intent with a high confidence for an utterance, it doesn't help the bot to add additional similar examples.
    • Do add more training examples of utterances the bot has previously predicted incorrectly or with low confidence.

Create Bot Responses to Train Your Bot

Configure bot responses with the following process: 

  1. Create an intent.
  2. Create a rule or story for the intentClosed The meaning or purpose behind what a contact says/types; what the contact wants to communicate or accomplish you created to define how the bot responds to that intent. Which one you create depends on the intent. Refer to the plan you made earlier in the bot implementation process. The high-level process of creating storiesClosed Used to train bot for interaction handling based on intent and context and rulesClosed Used to define bot's response to messages that don't change with context. is:
    1. Stories and rules begin with something the contact might say. For example, for an intent called check_balance, the contact might say "Can you tell me my account balance?"

    2. After you enter an example of what the contact might say, Bot Builder attempts to predict the intent of the example contact message.
    3. Confirm the bot's prediction or choose the correct intent, then confirm it. If the bot's prediction confidence seems low, add more training examples to the intent.
    4. Now you can add the bot's response using any of the available bot actions.

    5. Add another contact utterance, if the real-world conversation examples for this intent show that contacts tend to follow up the response (from an agent or a bot) with the same type of question or statement.
    6. Continue the conversion in the story or rule, following the real-world examples you collected. Add as much back-and-forth interaction as you need to teach the bot how conversations about the intent should go.

      Typically rules will consist of one contact message and one bot response. Stories can be made up of a series of exchanges between the bot and the contact. However, stories should not be complete conversations. When the next statement in the conversation would necessarily start a new intent, it's time to stop and create a new story. Alternatively, consider breaking stories into smaller substories.

    7. Create multiple stories for the same intent if there are variations of how the conversation might go, based on the contact's unique situation and needs. This trains the bot to tell the difference between variations of a single intent.

      • Don't include variations of the conversation flow in the same story. This could confuse the bot.

      • If there are variations to the way a contact might phrase a message, or similar messages that all mean essentially the same thing, you can add them as examples of the intent.

      • Think in terms of happy and unhappy paths. Each intent can have more than one happy path and more than one unhappy path.

  3. If the intent, rule, or story requires them, create entities, slots, or forms.
    • Create entities only for information you need the bot to extract from the conversation.

    • Create slots for data you need to save or use during the conversation.
    • Consider using a form in a story or rule if you need to collect more than a couple pieces of information from the contact.
  4. When you're finished making changes, click Train and Stage to update your bot modelClosed Version of a bot that has been trained and staged to test this change.

  5. Chat with your bot to test it. Based on the results of your conversation with the bot, you might need to make adjustments to the story or rule you created. You might also need to add or change the training data for the intent you're working with. Repeat the the training and testing steps as often as necessary until you're happy with the bot's performance.