Being there when your customer needs you most shows how much your company values responsiveness and commitment to customers. Having a chatbot empowers your business with these capabilities and more. A chatbot is a computer algorithm that simulates a human conversation. People interact with these bots by selecting predefined options. To provide valid responses, chatbots require people to make some selections.
With Drupal, you can try your hands at different chatbots using modules like Drupal Chatbot or other integration modules and APIs. In this article, we will explore more about Drupal Chatbot using Dialogflow as an NLP agent.
Why use a chatbot?
A Chatbot is an excellent marketing tool for a business to boost customer engagement. Chatbots allow a business to:
- Gather customer insights
- Increase sales
- Availability 24 hours a day, 7 days a week
- Save of time and money
- Improve customer satisfaction.
How do chatbots built with Dialogflow work?
In a nutshell, this is how a chatbot typically works:
- User sends text message through chat window
- Chat app transfers message to Dialogflow
- Message matches intent (intents manually updated by developers or administrator in Dialogflow console)
- Based on the matching intent, a response is returned. (Each attempt will have its own response defined by the developer)
- The user receives a response.
Why Dialogflow?
Dialogflow is a natural language understanding platform that makes it easy to design and integrate a conversational user interface into your mobile app, web app, device, bot, interactive voice response system, etc. Dialogflow can analyze various types of input like text or audio. It can also respond to the user in various ways, either through text or voice.
Building a Chatbot in Drupal using Dialogflow
Step 1 – Create a new agent
- Create and log in to your Dialogflow account
- Click create agent in the navigation bar and complete the required fields.
- Give it a name and select the agent language and then click the Save button.
Step 2: Create an intention
But first, what is an intention? An intent links what a user says to what their agent does. Dialogflow matches the end user's phrase with your agent's best intent.
A basic intent contains the following:
- Training Phrases: These are examples of phrases or sentences of what end users might say. This should be updated in the Dialogflow console by the developer. When an end user utterance resembles one of these, Dialogflow matches the intent. It is not necessary to define all possible phrases, Dialogflows built-in machine learning handles other similar example sentences.
- Responses: Text response defined by the developer in exchange for the end user. These can provide answers or ask the end user to select more or end the conversation.
To create an intention:
- Select the agent you created in step 1
- Click the add button next to Intents in the menu.
- Enter a name for the intent.
- Enter training phrases
- Enter answer test
- Click Save.
Context:
Dialogflow contexts are similar to natural language context. If a person tells you “they are green,” you need context to understand what “they” means. In order for Dialogflow to handle an end-user phrase like this, input or output context must be provided to match an intent.
There are 2 types of contexts:
- Output Contexts: Controls the active contexts. When an intent is matched, all output contexts configured for that intent become active.
- Input contexts: control intent matching. While contexts are active, Dialogflow is more likely to match the intents configured with the input contexts.
Input and output contexts apply to intentions. They work together to control the bots' conversation flow.
Taken and translated from: https://www.specbee.com/blogs/building-chatbots-drupal-using-dialogflow?utm_source=drupal-newsletter&utm_medium=email&utm_campaign=drupal-newsletter-20210722