Using the Intent Detection Node

Using the Intent Detection Node, it is possible to upgrade a classic flow bot to match intents. Classic flow does not support a very conversational interface out of the box. In this model, the NLP service can do just intent matching on user input while flow manages the actual conversation.

We currently support the following NLP service for intent detection from within a flow:

Dialogflow NLP Detection from within Flow

In this tutorial we will use a flow-based bot with DialogFlow to create a bot that can detect intents and slots..

Set up Your Secrets

Since your bot will use DialogFlow services you will need access to a project with intents you would like to detect.

You can then create a secret for the intent detection node to use.

Build your Initial BOT

For this example we will use a classic flow bot. 1. Select the Bot Designer menu item 2. Click Create Bot 3. From the blueprint options, choose Classic Flow Bot 4. Name your bot, then set the custom message to Hi, How are you doing? 5. Build it!

Connect Everything Together

  1. Prep your Flow
    1. Open back up your bot. (Bot Designer -> Bot name).
    2. On the bot detail page click Designer.
    3. Delete all the nodes.
  2. Build the flow as shown intent-detection-flow
  3. Configure the intent detection node
    1. Open the node and select the secret created in a previous step.
    2. Enter the project ID of the DialogFlow project. dialogflow-setup
  4. Configure the change node
    1. Follow the image below, this puts the result of intent detection into the msg.payload.user object to allow it to be used in a markup node later. change-node-setup
  5. Configure the switch node
    1. The switch node will allow you to visit different output ports based on the configuration of the switch. This can be used to perform a different action based on the intent detected.
    2. Example of a configured switch node, your implementation will vary. The property will remain payload.result.intent but each case will differ based on your intent names. switch-node-setup
  6. Setup your markup nodes.

Play and Test

  1. On the Bot Designer Canvas, click Deploy to save your changes
  2. Hit the back button to go to the bot detail page.
  3. At the bottom of the bot detail page, click on the Test button
  4. Once you are on the test page, you can interact with your bot.

Microsoft Luis NLP Detection From Within Flow

Create a Classic Flow Bot

  • Follow the getting started instructions to generate a classic flow bot.
  • Delete the prompt node that comes after the first message and replace it by an input node followed by an intent detection node

Create your Luis App

  • Go to https://www.luis.ai/home
  • Log in, then create a new app
  • Name your bot
  • Set the culture to English
  • Set a memorable description for your bot.

Set up Utterances

  • Click on the build tab
  • Create an utterance called hours
  • Add a few utterances
What are your hours
When is servisbot open
What are your operating hours

  • Create a new intent for who works at servisbot

  • Add some utterances

Who works at servisbot
who are your employees
name some of your developers
  • Click on the train button for your bots, then click the Publish button

Create Your Secret

Follow the standard Luis instructions for secret creation to get your App ID and secret.

Set up Your Node

  • Go to your Bot’s Designer page and edit the Intent Detection Node
  • Make sure “Luis” Is selected as your NLP provider
  • Select the secret you created earlier
  • Enter your Application Id into the Project Id

  • Click done and save your node

  • The response from Luis takes the following format

    msg :{
      payload :{
        result: {
          intent: 'intent_name',
          slots: {},
          action: {},
          fulfillment: 'message from NLP'
        }
      }

    }

Wire the experience together

  • Add a switch node after our intent detection node and wire them together.
  • Add a few cases to the switchnode. one for each intent you have configured, and one for “otherwise” to catch non-matches
    • The switch node should match on msg.payload.result.intent

Play and Test

  • On the Bot Designer Canvas, click Deploy to save your changes
  • Hit the back button to go to the bot detail page.
  • At the bottom of the bot detail page, click on the Test button
  • Once you are on the test page, you can interact with your bot.