Building Conversational Application having Custom workflow using Google DialogFlow Contexts

Building Conversational Bot with Custom workflows using Google DialogFlow Contexts

With emergences of smart speakers , there is boom going on building conversational bots. So as Google and Amazon are providing free build and deploy platform make it even easier for build your own custom apps. One of most important part voice application to have robust workflow with repetitive decision making steps . Below is sample workflow :-

As you notice there is multiple level for confirmation in flow and user can respond with “Yes” or “No” . In this case, NLP model should be aware of current state of your journey otherwise it could result in wrong path in flow. One of approach that comes handy in DialogFlow is contexts in these types of scenarios as DialogFlow NLP engine looks for current contexts in conversion along with user utterances to figure out intent . This gives So building application This is section is first part of building simple conversation app using Google DialogFlow.

Login to actions on google using your google account :- https://console.actions.google.com/

  1. Create a new project
New Project

2. Type project and then select custom

This will create action and then go to DialogFlow link

3. Create following new intents :-

Create intent and add input context
Create intent and add input context
Create intent and add input context

4. Below is final conversional setup:-

In case you notice that there are input contexts setup for couple of intents , with this setup DialogFlow engine looks for context in input payload along with utterance to figure out intent . This helps navigation to desired step even multiple intents have similar training data setup.

Trending Bot Articles:

1. Case Study: Building Appointment Booking Chatbot

2. IBM Watson Assistant provides better intent classification than other commercial products according to published study

3. Testing Conversational AI

4. How intelligent and automated conversational systems are driving B2C revenue and growth.

In our case, we are setting up output context from fulfillment. This helps to make navigation dynamic and easily customizable for any future changes .

Few points to remember for contexts while setting outputs context :-

  • Context name should be same including cases while setting it from backend
  • In case you want to move forward , clearly previous contexts

Sample to set context Node.js fulfillment code:-

conv.contexts.set(‘hungry_followup’, 5, {});

Once everything is setup then conversational will work as shown below :-

Notice that even though user responded with yes still NLP followed workflow and navigated to next steps

Conclusion

This shows contexts are very essence for DialogFlow NLP engine and provide needed navigation controls on user journey in flow.

I will post code and projects in coming articles.

Connect with me on LinkedIn

Don’t forget to give us your 👏 !


Building Conversational Application having Custom workflow using Google DialogFlow Contexts was originally published in Chatbots Life on Medium, where people are continuing the conversation by highlighting and responding to this story.


Posted

in

by

Tags: