Voicebot based ordering system using Google Dialogflow CX

Voicebot based ordering system using Google Dialogflow CX

Before jumping into code and Dialogflow console, let us understand what we are trying to achieve with this blog today.

Voicebot is an AI-powered software that allows users to interact using voice without any other form of communication like IVR or chatbot. Voicebot uses Natural Language Processing (NLP) to power its software. Today, we are going to use Dialogflow by Google to understand how one can make such a Voicebot.

Google’s Dialogflow is an NLU (Natural Language Understanding) platform, which offers a conversational user experience.

With Dialogflow, we can design various conversational flows. It comes with building blocks like Agents, Flows, Pages, Entity Types, Parameters, Forms, Intent, Webhook, Fulfillment, Integrations.

In this article today, we will build a conversational Voicebot system to order coffee. Following is an example conversation that may happen:

Customer:?Hi

Voicebot:?Hey, how can I help today?

Customer:?Can you get me a coffee, please?

Voicebot:?Sure, we offer the following coffees, can you share which would you like?

  1. Espresso
  2. Americano
  3. Latte
  4. Cappuccino
  5. Macchiato

Customer:I would like to have an espresso

Voicebot:?We offer the following toppings with an espresso, would you like us to personalize it for you?

  1. Honey
  2. Cinnamon
  3. Butter
  4. Cardamom
  5. Chocolate Syrup

Okay! Let us cook it together!

Ohh! Wait… Before we jump on Dialogflow, it comes with two versions

  1. Dialogflow CX - Advanced agent type - suitable for large or very complex business needs.
  2. Dialogflow ES - Standard agent type - suitable for small and simple business needs.

Let’s not underestimate our business need for coffee ordering and go with Dialogflow CX. This can be just a small part of the whole menu offered by a cafe or a restaurant.

If you are curious to know more about both the versions of Dialogflow, checkout head-to-head comparison on Google’s documentation:

Create Project and Agent in Dialogflow

Okay, let’s head on over to the Dialogflow CX console and create a new project.

No alt text provided for this image

Click Create button and go back to the CX console, you should be able to find your newly created project.

No alt text provided for this image

When you access your project for the first time, it will ask you to enable the Dialogflow API for your project.

No alt text provided for this image

Once the permission has been granted, the next step is to create your first agent. Ideally, you should choose a location near your targeted user base.

No alt text provided for this image

By default, the Agent comes with a start page, which reacts to the greetings. So let’s give it a try to see that in action by clicking on the top-right corner “Test Agent” option.

No alt text provided for this image

Identify Entities and Training the same

For our requirements, we will be needing the following entities.

  1. Coffee Types
  2. Toppings

No alt text provided for this image
No alt text provided for this image

You might be wondering why I have given?Entity?1, 2, 3, 4, 5? The reason behind that is when you place an order, it's not a good practice to give the string i.e. “Espresso” to your backend, as your backend needs to look up using string to identify the unique ID. Instead, if you use that unique ID as Entity, it will send that value as a parameter to the backend when placing an order, which will be much faster and accurate. We will see that in action in the following sections.

Create flows

Flows are like reusable code! In programming, we used to keep our reusable code in separate files/modules. Similarly, while identifying Flows, you should keep the same thing in mind, Flows should be logically separated from each other, that can be reused if needed.

Let us identify the required flows. As we are keeping it very simple for now, we will be needing only Default Start Flow and Order Flow.

In advanced use cases, we may need payment flow to take order payment. Similarly, we can add more flow as we add logically separated features.

Let’s create an Order flow

No alt text provided for this image

Create Intents

Intents are actual user intentions that the Voicebot would hear while taking an order. For example, being a user, you would like to say “Hi” to the bot or want to place an order by saying, “Let me have an Espresso with Honey”.

As of today, all chatbot providers like Dialogflow, Amazon Lex are only providing support for one Intent at a time.

Hence as per the best practice, while identifying a list of Intents for the project, you should keep in mind not to mix multiple Intents.

While creating Intents, you need to provide a list of possible phrases which the end-user might use. For example, to initiate an order, the user might speak anything from the following but not limited to:

  • Place an order
  • Help me placing an order
  • Take an order
  • I want to place an order
  • I would like to place an order

List of intents we need today,

  1. Initiate the Order

No alt text provided for this image

  1. Order placement

Few examples, how a user may place an order:

  • Let me get an Espresso with Honey
  • Let me have a Black Coffee with Butter and Honey, Cinnamon and Chocolate Syrup
  • I would like an Espresso with Cinnamon and Honey

Ideally, Dialogflow would automatically identify the Entities used in the Intent and tag them. However, if it is not detected automatically, we can select the word and then the Entity.

You can see in the following screenshot, Dialogflow has automatically identified coffee types and toppings.

No alt text provided for this image

You must have observed that toppings can be more than one. So while placing an order, we would require an array of toppings which we need to inform Dialogflow by mentioning that toppings as “List” of items.

No alt text provided for this image

Routing

Routing, in Dialogflow, is used to traverse between Pages and Flows. We have already defined Intents and Flows, so let’s connect the dots now!

Order initiation

Starting from Default Start Flow, we need to route the flow to Order Flow, if the user intends to initiate the order.

Let’s create a new route, select the Intent, and redirect it to the Order Flow.

No alt text provided for this image

Let’s test!

No alt text provided for this image

Order placement

Navigate to the newly created Order Flow and create a route for order placement. It should redirect towards ending the flow. (End Flow - comes out of the box)

No alt text provided for this image

Let’s test!

No alt text provided for this image

Webhook for Order placement

Webhooks are like plugs between Dialogflow and your backend systems. We can expose backend systems over Google Functions or REST APIs, which we configure as Webhook in Dialogflow.

In our use case, once we have information from the user about the coffee, we need to provide the same to the backend to process the order.

Following is a very simple Node/Express example,

Let’s configure the webhook.

No alt text provided for this image

Let’s test end-to-end flow!

No alt text provided for this image

Connect with AudioCodes

Let us convert your smart bot into a smart voice bot using AudioCodes!

AudioCodes helps you assign a phone number to your Dialogflow bot. So whenever your users call the number, it makes conversation with the Dialogflow.

Dialogflow provides AudioCodes integration out of the box, which you can configure with just a few clicks. Go to the integration section and click on connect for AudioCodes. Then follow the steps further, and you'll be able to integrate it.

No alt text provided for this image

Once you connect Dialogflow with AudioCodes, add a Phone Number to your bot from the AudioCodes portal.

No alt text provided for this image

Make a call to the number and give it a try!

Conclusion

Now that you've understood how to create a Voicebot for ordering a coffee using Dialogflow CX, try it out for your list of items, maybe for food or grocery, or any other e-commerce catalog. Scale it according to your list of items, and give your customers a rich experience.

Here are some advantages of using a Voicebot ordering system:

  1. Growth in the number of orders as multiple customers can be attended simultaneously
  2. Reduction in average response time
  3. Same Voicebot can also be used for solving customer queries with a little modification
  4. It is available 24/7 without any supervision

We, at Seaflux, are?AI & Machine Learning?enthusiast who is helping enterprises worldwide. Have a query or want to discuss AI or Machine Learning projects? Schedule a meeting with us here,?we'll be happy to talk to you!

Jaydeep Hardikar

Principal Business Analyst - Salesforce

1 周

What if we want the Voicebot to update the CRM based on caller's input?

回复
Karl zu Ortenburg, MSc Sloan ??

Smart Automation Workflows, AI Agents for Investments ??

1 年

Hi, Dialogflow cannot be used to build demonstration chatbots, by indexing a potential client's website because you need to prove ownership of the website to be able to index the website into the data store. Is that right?

要查看或添加评论,请登录

Seaflux的更多文章

社区洞察

其他会员也浏览了