Using the Intent Detection Node

Using the Intent detection node, it is possible to use an NLP service to match user input to intents.

Each Intent Detection node will provide you with a few output ports:

  • The first port is for successful responses from the NLP service.
  • The second port is for slot filling.
  • The last port is for when no intent is matched in the NLP.

The second port is being deprecated and will be removed by November 2020

Start with a Classic Flow bot

Create a Classic flow bot from blueprint. Our getting started bot should be good enough.

Pick your NLP

This tutorial will cover using Dialogflow, but other vendors are compatible.

  • In Dialogflow, create a bot, and generate a secret.
  • Keep track of the project ID.
  • Create an intent and give it a few utterances.

Edit your Bot

  • Add an intent detection node.
  • Configure it to use the right project ID and secret from your previous steps.
  • Test the bot in messenger and send it an utterance.
  • The response from dialoglow should be available as a context variable msg.payload.result.fulfilment.

Other properties will also be available for use in your flow.

msg :{
    payload :{
      result: {
        intent: 'intent_name',
        slots: {},
        action: {},
        fulfilment: 'message from NLP', //for a single response
        fulfillmentResponses: ['array', 'of', 'nlp', 'responses'],
        intentDetectionConfidence: 1
      }
    }
  }
}

DialogFlow payloads

When using an intent detection node with DialogFlow, there are a few things to note:

  • If smalltalk is triggered, the intent name will be the same as the action e.g. smalltalk.greetings.how_are_you.
{
  "intent": "smalltalk.greetings.how_are_you",
  "slots": {},
  "intentContext": [],
  "fulfilment": "I'm doing very well. Thanks!",
  "fulfillmentResponses": "I'm doing very well. Thanks!",
  "action": "smalltalk.greetings.how_are_you",
  "intentDetectionConfidence": 1
}
  • Fallback intents will always have an action of input.unknown.
{
  "intent": "Default Fallback Intent",
  "slots": {},
  "intentContext": "system_counters",
  "fulfilment": "I missed what you said. What was that?",
  "fulfillmentResponses": "I missed what you said. What was that?",
  "action": "input.unknown",
  "intentDetectionConfidence": 1
}