5 Steps To Build NLP WhatsApp Chatbot with Dialogflow

0
361

Share on LinkedIn

The need for quick, personalized and 24*7 customer service has seen an unparalleled rise of chatbots. Chatbots, in most cases, predominantly function as scripted, linear conversations where the output of the bot is predetermined based on the users’ choice. And yet, in many situations, the linear chatbots do not suffice the needs of the customers. This is where NLP WhatsApp chatbot comes to the rescue.

Natural Language Processing or NLP-based chatbots mirror the ease of being understood as in real-life conversations by grasping the nuances of the human language. NLP makes it possible for software programs/non-human entities to comprehend human language and respond accordingly. NLP chatbots are increasingly being adopted by businesses to provide stellar customer service. Add to that the reach and popularity of WhatsApp messenger and your business has an intelligent chatbot engaging your customers on the most widely-used messaging platform – WhatsApp.

Natural Language Processing (NLP) – What exactly is it?

Natural Language Processing or NLP is a concept based on deep-learning that enables computers to make sense of human language and gather meaning from inputs given by users. In the context of chatbots, NLP plays a key role in assessing the intent of the query asked by the users, followed by creating appropriate responses based on a contextual analysis similar to that in human interaction.

With NLP, you can appropriately train your chatbot on the different interactions it will go through to allow it to streamline the responses as per the intent of the query.

NLP

Here, training the chatbot means creating a repository of phrases which have the same intent/meaning and helping the chatbot identify the intent from the question. The aim here is to give your chatbot enough references, allowing it to interpret and answer questions and commands in a more accurate manner.

Let’s understand this better with an example.

Suppose a user wants to know about the availability of the different colors available for a product. There are many different ways of asking this question such as –

  • Are there other colors available?
  • Do you have it in white color?
  • How many color variants are available for ‘x’ product?

NLP, in this case, lets your bot develop a deeper knowledge base and understanding by studying previous examples of such chats to tackle such variations in questions. Bots can also be trained to watch live conversations (either via text in emails or IM chats or on the phone through a type of voice understanding such as Alexa/Siri) and learn from them.

The Need For NLP WhatsApp Chatbot

The NLP function might not apply to every chatbot. However, if you’re building a chatbot wherein your customers can type in queries and do not follow a preset sequence of conversation then investing in NLP can be a complete game-changer.

NLP is extremely beneficial for WhatsApp chatbots, that allow users to type in their queries. Using sequential chatbot for WhatsApp is inconvenient as users are required to type in the exact option they want to choose.

WhatsApp chatbots are created for various purposes, such as to offer enhanced customer service, dealing with FAQs, and more. In the case of chatbots without NLP, the functioning of the bot is primarily based on pre-fed static information, making the bot less-equipped to handle human languages with variations in intent, emotions, and sentiments.

Being the leader of the messaging world, your WhatsApp chatbot continuously faces a significant amount of questions. Not being able to understand customers’ queries as per their intended meaning can negatively affect the customer experience. NLP chatbot, on the other hand, can serve as an excellent solution for enhancing the user experience by delivering contextual answers in a much more consistent way. WhatsApp NLP chatbots bring a human touch to the conversations by making them identical to the conversation between two humans.

NLP WhatsApp chatbot development can also help enterprises perform a range of other different tasks, including:

  • Easy sending of alerts, reminders, and notifications
  • Answering queries/complaints in real-time and sending updates on the query status & resolution
  • Helping clients explore services offered and product catalogue
  • Collecting customer feedback

How to Create NLP WhatsApp Chatbot Using Dialogflow – 5 Easy Steps

Building an NLP-based, intelligent chatbot on WhatsApp, with cognitive capabitlites, can enable enterprises to perform a range of tasks automatically, including customer support, product research, sales & conversion, follow-up communication, and more.

Before going into the details of creating NLP WhatsApp chatbot using Dialogflow, let’s first understand a little bit about the platform and how it assists in building robust WhatsApp chatbots with NLP.

Dialogflow

Dialogflow is a complete development suite for building highly useful and conversational interfaces for websites, messaging platforms, mobile applications, and IoT devices. The platform is also used to build robust chatbots and voice assistants that are capable of having natural and rich interactions with users.

How does Dialogflow work?

Powered by Google, Dialogflow provides a Natural Language Understanding engine to help build conversational interfaces. It is, in fact, considered as the standard choice among AI and Natural Language Processing platforms.

What makes Dialogflow the most popular and well-known chatbot language processing tool for enterprises with a huge customer base is its ability to work with both voice and text-based AI applications on various platforms, including Google Assistant, Amazon Alexa, and Microsoft Cortana.

Further, Dialogflow’s voice recognition and text integration are also applicable to popular social media channels such as Twitter, Facebook Messenger, Telegram, Slack, Skype, and more. The fact that Dialogflow keeps on evolving and updating itself, based on specific business requirements, to manage the ever-changing language preferences of users makes it the undisputed leader among NLP platforms.

Understanding Intents and Entities in Dialogflow

Understanding Intents and Entities in Dialogflow

An intent in Dialogflow basically represents a mapping between what a user asks/says and the kind of action that should be taken by the software. For example, the queries given below intend to ask the same thing, i.e. price of properties:

  • How much do the 3 BHK apartments on Upper East Manhattan cost?
  • Price of 3 BHK apartments on Upper East Manhattan
  • What is the rate of 3 BHK apartments on Upper East Manhattan?

After the mapping the query with the knowledge base, the chatbot identifies the intent of the query.
Training the chatbot to identify intent includes the following points:

  • Responses
  • Training Phrases
  • Action
  • Contexts

Entities, in Dialogflow, represent the keywords that are used by the bot to provide an answer to the user’s query. Any important data needed from the user’s side to provide an answer is an entity, like, in the above example, ‘3 BHK apartments’ and ‘Upper East Manhattan’ are entities that the bot requires in order to provide the cost of.

WotNot

WotNot is a leading chatbot development platform that creates custom chatbots for enterprises. It is one of the few platforms that provide access to WhatsApp APIs to develop a WhatApp chatbot. Put simply, WotNot enables enterprises to reach out to their customers through WhatsApp and other channels.

How does WotNot work?
To get started with WotNot’s WhatsApp chatbot, first of all, you require a phone number using which your business will operate the chatbot on WhatsApp.

Your phone number, along with other details like the organization’s name, employee strength, website, etc need to be provided to WotNot.

WotNot then sends the details to WhatsApp for registration of your business under WhatsApp Business.
Once approved, WotNot sends you the WhatsApp Business APIs using which you can now build the bot with the help of Dialogflow.

Now that we know about how Dialogflow and WotNot work, let’s get into the details of building NLP WhatsApp chatbots using both of these-

Step 1 – Set up the development environment
To begin with the process of building NLP WhatsApp chatbot, you need to first set up the development environment, to be able to create a new directory to host the code. This should be followed by creating appropriate files inside the directory.

Step 2 – Set up the WotNot API WhatsApp sandbox
In this step, you need to activate your WotNot Sandbox for WhatsApp. As soon as you create a new programmable SMS project, you need to select programmable SMS, followed by selecting WhatsApp from the dashboard. You will then be prompted to activate your sandbox.

Step 3 – Set up the Dialogflow account
The next step in the process is to log in to Dialogflow and sign in using your Google account. It is important to note here that a Google account is mandatory for using Dialogflow. If you don’t have the same, you need to create one to go ahead.

Once signed in, you need to create a new agent and name it suitably. Dialogflow usually provides a Default Welcome Intent that you can change as per your need. After this, you need to go to Integrations in the menu tab to enable WotNot (Text Messaging), followed by inputting all the required credentials from WotNot. This allows Dialogflow to manage all incoming messages from the WhatsApp sandbox.

This completes the process of setting up Dialogflow and integrating it with WhatsApp. Make sure to test the integration by sending a text message on WhatsApp. You should get a response from Dialogflow’s default welcome intent if everything is done properly.

Step 4 – Cloud functions and Fulfilments
Fulfilments here consists of Webhook and also Cloud Functions by firebase. Setting up a webhook mainly allows you to pass on the information from a matched intent into a web service and get an appropriate result from it.

Cloud Functions for Firebase area of the fulfilment page are used for webhook testing and implementation.
In Dialogflow, you need to click on the Fulfillment menu and enable the webhook followed by the path to webhook.php, and then save the changes before you proceed.

Step 5 – Test the Webhook
Once everything is done, and the webhook is set, it’s finally the time to test it out on WhatsApp. You need to ask the chatbot specific questions and see if you get the desired response or not.
Using the steps specified above, you can build chatbots for various applications such as weather chatbot, e-commerce store chatbot or a restaurant booking chatbot.

NLP WhatsApp Chatbot – Case Study
To understand the process better and unlock the advantages of NLP WhatsApp chatbot, let’s take an example of a company successfully implementing this.

RedBus is a popular bus booking platform with operations in various countries. With thousands of transactions every day, the company found it difficult to manage the customer support function efficiently mainly due to below hurdles-

  • Time-consuming way of manually checking the queries related to bus cancellations and boarding point
  • Inefficiencies managing the customer request due to the large volume of calls
  • How NLP based WhatsApp chatbot helped?

    How NLP based WhatsApp chatbot helped?

    Introduction of NLP WhatsApp chatbot helps customers to resolve their queries on WhatsApp. They can easily use the chat to get all the information related to their travel, such as bus location, refund status, payment-related information, and so on.

    Whatsapp group is another unique feature that had been instrumental in bringing customers, company and the operator together on the same platform. The feature allows the customers to raise concerns directly to the bus operator as well as the convenience to talk to other customers on the same journey to help them share live locations of the vehicle and discuss other bus-related issues.

    How does it actually work in case of RedBus

    Below is a detailed outline of how the design components and architecture work in this case-

    • Customer writes a specific query on WhatsApp, and the same will be sent to redBus servers by WhatsApp.
    • The request received by redBus be sent to the Natural language processing (NLP) unit, Dialogflow in this case.
    • The intent will be created, and the Dialog flow agent will be trained appropriately on the same intent and training phrases will be done accordingly.
    • Dialogflow will then return the control along with the intent and action.
    • As soon as there are intent and action, the corresponding fulfilment module will be called.
    • The fulfilled request will be sent to translation engine which will translate the message to the specific language before sending it back as Whatsapp message.

    To Sum it Up

    Using NLP WhatsApp chatbots, your business can help bridge the gap between where your business is and where it wants to be. WhatsApp chatbots help place your brand at a position when it comes to retaining customers in the long run.

    WhatsApp chatbots allow you to streamline your business operations by dealing with incoming queries in real-time – which is crucial in the current market scenario to gain an edge over your competitors.
    We, at Maruti Techlabs, have helped organizations across industries tap into the power of chatbots and multiply their conversion rates.

    Simply drop us a note at [email protected] to see how WhatsApp chatbots can help you take your business to where your customers are!

    Mitul Makadia
    Mitul Makadia is Founder of Maruti Techlabs and a true technophile. With his industry experience, he has rapidly developed Maruti Techlabs in specialized services like Chatbot Development, Artificial Intelligence, Natural Language Processing and Machine Learning. Makadia has considerable expertise in Chatbot Development and NLP.