Taboola

How to Create NLP Chatbots Using Dialogflow with Landbot

Posted April 2nd, 2020 in Communications. Tagged: , , .

Did you hear about chatbots and would like to get in on the benefits? Would you like to create an assistant that helps you increase your conversion rate? Are you new to the virtual assistant scene and not sure how to choose the best platform for building an intelligent chatbot that converts? You landed on the right page.

While more and more businesses are becoming aware of the power and potential of chatbots, many hesitate with adoption struggling with concerns about the cost and complexity. If you, too, are worried about the lack of extensive resources or technical skills, I recommend using Dialogflow with Landbot.

Dialogflow   Landbot

There are many good platforms out there but Landbot stands out with scalable pricing and a complete no-code approach that make it attractive and, most of all, accessible to freelancers, SMBs as well as big companies.

Hence, without further ado, let’s look at how to build an intelligent NLP chatbot without coding, using Dialogflow with Landbot builder.

What are Dialogflow and Landbot? How They Work Together?

Dialogflow console – formerly API.AI – forms part of the Google Cloud Platform feature offering. It is, essentially, a Natural Language Processing engine with a key focus on natural language understanding (NLU), the “understanding” part of NLP. In other words, the platforms help software understand human language, retrieve data from it and provide appropriate responses. It can be used to build chat as well as voice assistants.

The two main highlights?

  • Dialogflow enables you to design chatbot conversation flow without coding.
  • It has a free tier, allowing you to use the tool for free (unless you are interested in the enterprise package that includes sentiment analysis – which can be useful but is not essential to chatbot success).

Designing the dialogue and training the chatbot in Dialogflow is code-free and so, despite has a small learning curve, it’s friendly to non-tech professionals.

However, when it comes to connecting the chatbot to third party databases, introducing rich formats into the front-end interface or publishing the bot in different formats (web, messaging apps, etc.). This is where Landbot comes into play.

Landbot is a no-code chatbot builder and manager which allows you to manage all the processes related to your chatbot under one roof. Furthermore, the building is done via a simple and intuitive drag-and-drop interface.

In Landbot, you can easily and intuitively – without coding – integrate the chatbot agent created in Dialogflow and add the finishing touch by enriching it with:

  • Rich responses like buttons and carousels
  • 3rd-party apps and tools
  • Typing emulation customization
  • Unique visual design & avatar personalization, etc.

Any of the actions above would require programming knowledge if you were to execute them using Dialogflow only.

Now, let’s look at a practical example of how to build an NLP chatbot with Landbot and Dialogflow.

How to Create NLP Bot with Dialogflow and Landbot

To demonstrate how to build an NLP bot with Landbot and Dialogflow, we will create a simple registration chatbot step by step.

1. Create a New Bot in Landbot

To begin, you first need to sign up with Landbot and create your account, no credit card required. Plus you get a 5-day trial to try out all the bonus features like the Dialogflow integrations.

Simply enter the app’s dashboard, click “Build a Chatbot”, select chatbot channel, and click to build one from scratch.

Landbot - screenshot 1

2. Setup Welcome Message

Once you are inside the builder interface, it’s time to customize your welcome message. This is the message that will kick-start the conversation. The best practice is to let the bot introduce itself and say what it can do in order to manage user expectations.

Landbot - screenshot 2

You can personalize your welcome message with text bubbles but also by adding images, gifs or videos. It’s very easy. When you want to add a new chat “bubble”, click the plus icon and choose from the options available options: MESSAGE, MEDIA, BUTTONS.

Landbot - screenshot 3

When you select MEDIA, a popup will appear allowing you to upload or embed any image, YouTube video, URL or file.

Landbot - screenshot 4

Once you are ready, you can move on to integrating Dialogflow.

3. Implement Dialogflow Block

Draw an arrow from the green point of the Welcome message to create a new conversation block. Instead of selecting other rule-based block options, search for Dialogflow integration and select.

Landbot - screenshot 5

Dialogflow’s integration block is made up of 3 key steps. The first one – as seen in the Gif – is to upload “Google Project JSON Key”. You’ll only be able to see the following two steps once this one has been completed. To do so, we must go to Dialogflow.

4. Create New Agent with Dialogflow

Go to Dialogflow console.

Note: If you haven’t done so yet, set up an account. Google will ask for the credit card info but more so as a precaution to ensure you are a legitimate human being. As mentioned before, Dialogflow service is free unless you are interested in advanced functions like sentiment analysis.

Create your first agent either by clicking “+Create Agent” on the left or the “Create Agent” button at the bottom.

Landbot - screenshot 6

To get started, you need to:

  • Fill in the Agent name (“agent” is how Dialogflow refers to individual chatbots)
  • Set default Language of the agent
  • Set default time zone you want the agent to recognize
  • Last but not least, create a new Google Project (so we can get the JSON key – a data file that allows Landbot to seamlessly communicate with a specific Dialogflow agent)

Landbot - screenshot 7

5. Download JSON Key & Upload it to DF Block

Now, to retrieve the JSON file, select the Settings icon of your agent and click on the link featured in the “Service Account” field.

Landbot - screenshot 8

Download the JSON as follows:

Landbot - screenshot 9

Simply click on the three dots under “Actions” and select “Create key”. Confirm you want to create a JSON file & download the file.

Next, go back to the Landbot builder, open the Dialogflow block manager and select to add a new JSON file.

Landbot - screenshot 10

Click SAVE.

Now, your Dialogflow agent and Landbot are connected and any changes and developments done on the Dialogflow agent will reflect on your Landbot chatbot.

So, let’s go train our event registration chatbot!

7. Understand Intents and Entities

Dialogflow agent (chatbot) works on the premise of intents and entities.

The agent’s intent identifies and categorizes the intention of the end-user for each conversation turn.

Every intent is made up of:

  • Training Phrases (phrases users are likely to use to activate given intent – See examples for welcome phrases below)

Landbot - screenshot 11

  • Actions & Parameters (structured data retrieved from unstructured user input in the form of entities – Observe the example below

Landbot - screenshot 12

  • Responses (a variety of responses your bot can reply to the end-user after intent is identified and necessary entities collected)

The whole process works as follows:

Landbot - screenshot 13

A bot can have an unlimited number of intents that can be grouped via contexts – but these are more advanced features you don’t need to worry about at the moment.

Every DF agent comes with pre-set Welcome and Fallback intents.

  • Welcome intent, naturally, deals with common welcome phrases like “hey” and “how are you doing?” – still, it’s easy to check on it and make sure all of the pre-set responses fit your bot personality and purpose.
  • Fallback intent activates when your agent is unable to match user input with any of the intents you created and includes phrases like “Sorry, I didn’t get that, can you rephrase?” – once again, you can adjust the pre-set fallback responses to fit your bot/brand image.

8. Create Your Intent

Now it’s time to customize your agent by creating your very own intent(s).

Select “Intents” on the left-side menu and click “Create Intent”.

Landbot - screenshot 14

Before anything else, name it (clearly so you can identify what the intent does when you have a much greater number of intents).

Landbot - screenshot 15

Turn your attention to the training phrases section.

You need to define the type of phrases that would activate this intent.

Remember! The first user input will be a direct response welcome message we defined on the Landbot interface and include simple answers like “Yes” and “Sure”

Landbot - screenshot 16

But! You also have to account for users first, just answering with a greeting like “Hi” or “Hello”.

Landbot - screenshot 17

Try to think of as many possible inputs as possible.

Tip: Before releasing the bot to the public let your co-workers or friends test it to get more ideas about possible user inputs to diminish a chance of failure.

9. Define Entities

Next, move on to the Actions & Parameters section.

Landbot - screenshot 18

Focus on the parameters table. For the purpose of this sample registration, we decided to keep things simple and collect:

  • Name
  • Email
  • Country
  • Background (Tech or Non-Tech)

Dialogflow offers a database of predefined entities called system entities. These include common parameters like name, country, city, phone number, email, ordinal and cardinal numbers, amounts with units, locations, etc.

In practice, this means you don’t need to train your bot to recognize these entities from scratch. You can either input them:

  • Manually into the parameters field

Landbot - screenshot 19

  • Introduce them in your training phrases so they are picked up and appear in parameters automatically.

Landbot - screenshot 20

So, Name, Email, and Country are all system entities.

But what about our “Background” parameter?

For the (fake) no-code chatbot conference, we wanted to see which attendees have tech background (developers) and which don’t (marketers, small business owners, etc.). Since this is not a general type of information, we will have to create a “Custom Entity”.

Save all your training progress of your intent and click on the “Entities” option in the left-side menu. Then, select “Create Entity”

Landbot - screenshot 21

Start by creating a name for your entity – in our case “Background”.

Landbot - screenshot 22

Then “Click to Create an Entry” below.

You will be able to fill in the “Reference Value” and synonyms associated with that value.

The synonyms are important because natural language is diverse and people will express their background in a variety. So, for instance, for tech background, we created these synonyms:

Landbot - screenshot 23

Once done adding all synonyms you can think of, remember to also tick and activate Fuzzy matching. This will enable your bot to understand and accept misspelled entries like “dvloper”.

Click save and return to your intent to add this entity to your list!

To ensure every registrant completes the entire process and provides all the information before leaving this intent, we’ll mark all entities as “Required”.

Landbot - screenshot 24

And, define a prompting question for all of them.

Thanks to this little setup, the bot will not let the user leave this intent unless it has obtained all of the required information.

To define the prompts, just click on the field in the line corresponding to the entity you want to configure and type it in the question:

Landbot - screenshot 25

After defining all essential prompts move on to the final Responses section and write several different versions of a possible response (so the bot doesn’t always say the same thing). You can also use the collected entities to personalize your answers!

Landbot - screenshot 26

Now it’s time to go to the Landbot Builder!

10. Return to Finish Dialogflow Block Setup in Landbot

Back in the builder, return to set up the rest of the sections in the Dialogflow block:

Landbot - screenshot 27

A. Set up the Request

The single important field in the setup section is the Intent Text represented by a Landbot variable which will be used to export user input to Dialogflow:

Landbot - screenshot 28

Our event registration bot connects the welcome block directly to the Dialogflow integration which means the user response will be saved under @welcome variable.

Landbot - screenshot 29

B. Save the Response

The two fields that will interest us in the 3rd section are the entities we want to import from Dialogflow and the setting the variable that will allow us to import intent responses we created earlier:

Landbot - screenshot 30

Under “Response”, create a brand new variable to save your Dialogflow responses. In our case, let’s call it @df_response.

Under “Entities” add all the entities you want to export from Dialogflow and bring to Landbot by writing the parameter name in the top field and associating with Landbot variable in the bottom field.

Landbot - screenshot 31

Click SAVE. Now that the integration is set up, we can proceed to manage the three outputs:

  • Green – Success (agent matched and fulfilled intent)
  • Yellow – Partial Success (agent matched intent but a few of required entities are still missing so prompts are activated)
  • Pink – Fail (Agent failed to identify the intent so the fallback response is activated)

The simplest scenario of Dialogflow-Landbot co-operation would look much like the setup below.

It’s activated just including the @df_response variable in the question blocks (because you want the bot to use the answers you set up in your Dialogflow agent) and @welcome in the answer variable (because that’s the variable we used to store user input for DF).

Landbot - screenshot 32

11. Do Final Tweaks

Before testing and going live, do some final tweaks to make your bot unique

Customize Design

By clicking on the “Design” section, you are able to personalize the look of your bot including the background, avatar, colors and shape of chat bubbles etc.

Landbot - screenshot 33

Configure Settings

Next, proceed to the “Settings” section and configure details such as SEO and tracking via Google Analytics or Facebook pixel, typing emulation (how long it takes the bot to “type” it’s messages so it feels natural) and others to ensure you get the most out of your bot.

Landbot - screenshot 34

Share

Last but not least, you are ready to share. You can share your Landbot bot in four web formats:

  1. Landing page
  2. Pop-up
  3. Embed
  4. Widget

All you need to do is select the format you prefer and copy-paste the automatically generated code below.

Landbot - screenshot 35

Alternatively, if you don’t care about the bot to have your URL, just click “Share with a Link” and it’s done.

Landbot - screenshot 36

Using the sharing link is also a great way to test the bot in the end-user environment and make sure everything is working properly:

Landbot - screenshot 37

When you check the results in analytics, you can see the NLP bot collected the required information and saved them as clean structured data despite being communicated in an unstructured form:

Landbot - screenshot 38

12. Bonus Tip

The combination of Landbot and Dialogflow has a few clever advantages.

Firstly, it allows you to combine rule-based bot features like button answers with NLP functions. Secondly, it enables you to incorporate several simpler Dialogflow agents inside a single Landbot bot keeping your NLP agent simple.

Below you can see an example of using buttons to send people who are ready to register to the registration agent while those who aren’t yet, are directed to another FAQ agent. The FAQ agents will redirect them to the registration process once the user indicates what they want to do.

Landbot - screenshot 39

This is how the division will appear on the front-end:

Landbot - screenshot 40

In a Nutshell

Well, that was quite a ride! Building an NLP bot is not the simplest of tasks. However, thanks to Landbot and Dialogflow it can be completely coded free. The example in this tutorial is simple and straightforward but it’s only a stepping stone to a realm of new possibilities in lead generation, lead qualification, customer service, etc.

Marketers and professionals with little or no programming experience have a chance to build, maintain, update and analyze their bots without delays caused by cross-departmental communication or misunderstandings. Likewise, freelancers, as well as small and medium businesses, have the chance to leverage conversational NLP in businesses without breaking their budget.


About the Author

Barbora Jassova

Barbora Jassova is a content writer and strategist at Landbot.io, a nocode chatbot builder and management platform based in Spain. As a non-tech enthusiast, she is an avid supporter of the nocode movement who enjoys testing her writing skills in chatbot narrative design.

Leave a response:

  • Browse Categories


  • Super Monitoring

    Superhero-powered monitoring of website or web application availability & performance


    Try it out for free

    or learn more
Read previous post:
A Guide To SentryOne SQL Server MonitoringA Guide To SentryOne SQL Server Monitoring

SentryOne is one of the best SQL server monitoring tools. Here is a look at the features and functions that...

Close
This website uses cookie files to improve user experience. If you don't approve, please turn off the cookie usage in your browser settings. close