Bot Development

Building Chatbots with Dialogflow

The Google Dialogflow chatbot-building framework comes with machine learning capabilities, built-in NLP features, and integrations with popular communication channels. Explore our Dialogflow guide, which covers the pros and cons, unique features, chatbot examples, and pricing information for this chatbot framework.

May 14, 2019
Building a Dialogflow chatbot with tools

For developers seeking a highly capable, scalable, bot-building framework, Dialogflow has a lot to offer. It’s the Google contribution to the world of chatbot development, and it comes packaged with many of the features you’re probably looking for in a framework—natural language processing (NLP), machine learning, and straightforward integrations with popular communication channels.

So should you choose Dialogflow over another framework? That’s where this guide comes in. Let’s take a close look at Dialogflow capabilities, unique features, and chatbot examples. We also consider the developer experience when using Dialogflow and run through the major pros and cons.

What is Dialogflow?

With Dialogflow, Google invites you to build conversational agents for the products or services you offer. You do this using tools included with the framework, which joins Amazon Lex, IBM Watson Assistant, and Microsoft Bot Framework among the world’s most sophisticated options for developing chatbots.

Launched initially as API.AI, Dialogflow includes all the features you expect from a comprehensive framework, including:

  • NLP capabilities for teasing user intents out of any given utterance.
  • Machine learning that trains your bot to deliver increasingly valuable responses (built on its engagement with users).
  • Scalability through adjacent Google services. Dialogflow itself actually runs on Google Cloud Platform.
  • Integration with various messaging apps and communication platforms.

If you only need to build a basic chatbot for a single platform (like a Facebook Messenger bot that sends static, predefined responses), you may not need all the features available in Dialogflow. You certainly can use the framework, but a simpler GUI-based bot-building app might be easier to work with.

However, if you’re planning to develop an intelligent chatbot—one that reacts appropriately to linguistic nuance and can pull information from external data sets—that’s where Dialogflow shines. It could be a good option for your next bot, so let’s explore a little deeper.

Dialogflow chatbot examples

To get a sense of what’s possible with Dialogflow, consider how others are already using the framework. Customer service, e-commerce, and bookings are just a few of the ways that organizations both large and small are taking advantage of Dialogflow tools.

E-commerce

When Domino’s started looking for chatbot tools in 2016, one of the biggest problems developers encountered was the number of intents needed to effectively process orders. In other words, the company needed a tool that had NLP capabilities and could scale to accommodate its needs.

Domino’s chose Dialogflow, and the framework solved those problems. Now customers can place and pay for new orders directly through the bot that the company created, and they can activate the bot through a desktop device, mobile device, or even by voice using Google Assistant.

Ticketmaster made the most of Dialogflow to help it sell event tickets. Using the Ticketmaster Dialogflow-built bot, users can type information, like summer music festivals in North Carolina, and the bot returns a list of results that users can browse. They can even choose an event from the list and immediately purchase tickets.

This bot, in particular, demonstrates how you can use the Dialogflow NLP to identify user intents and integrate it with third-party resources. In this case, those resources include a listing of local events with available tickets.

Customer service

Speaking of connecting your bot to external data sets, the Best Buy Facebook Messenger bot does something similar to the Ticketmaster bot—but for customer service. The Best Buy bot, which was built with Dialogflow, helps existing customers track orders. And it can also send users to a human agent if they need one.

Of course, big companies aren’t the only ones that are taking advantage of Dialogflow tools. Railway Buddy is a chatbot built with Dialogflow that helps travelers find information about railway service in India. They simply type in queries, like [train number] status or [train number] route info, to get information about a particular train.

Reservations

KLM Royal Dutch Airlines used Dialogflow to create a Facebook Messenger bot capable of booking flights. Users just tell the bot where they’re going and where they’re flying from. The bot then helps them book a KLM flight.

Chatbot-led bookings aren’t limited to travel. In a five-part Dialogflow tutorial, developer Adrian Cucolaș provides a useful Dialogflow chatbot example for restaurants. This hospitality bot can understand queries, like book a table, reserve table at 7 pm tomorrow, and make a reservation for 5 people. When the user omits certain information (for instance, the bot might not know what date and time it should reserve a table for five), it prompts the user for the missing details.

Why use Dialogflow? The pros and cons

All tech companies provide ample documentation for their bot frameworks, but the Dialogflow documentation is particularly straightforward. It’s also accompanied by video tutorials, which can help you get started even if you’re completely new to the world of bots.

For example, there are separate videos that teach the different concepts you need to know to use Dialogflow—intents, entities, and dialog control. The first two are standard chatbot development nomenclature, but dialog control is terminology that Google uses to refer to conversation branches. Nailing down the basics is always necessary, but there can be a big learning curve if the documentation launches straight into specialized jargon and assumes existing knowledge of the framework. Dialogflow avoids that problem.

Another advantage is the substantial number of prebuilt agents in Dialogflow. It comes with several, including agents for translation, weather forecasts, booking reservations, and shopping. You can start with these and build onto them to create a functional conversational experience for users.

As for integrations, Dialogflow makes it easy to deploy your bot to the most popular messaging apps and to Google Assistant, which could really come in handy for many companies. Communication between your Dialogflow agent and Google Assistant is a straightforward process that receives comprehensive coverage in the documentation.

Curiously, the framework’s biggest strengths, like seamless integration with Google platforms and services, are also its biggest weaknesses. For instance, developers who are already married to Microsoft Azure and its associated services might find it faster and easier to use Microsoft Bot Framework instead. The same goes for organizations heavily invested in AWS. It might be more convenient to build your bot with Amazon Lex and take advantage of the AWS Lambda integration than to suddenly start using Dialogflow on Google Cloud.

The short version? Dialogflow is a feature-rich framework, but if using Google tools represents a significant change for your organization, consider looking elsewhere.

Key features and integrations

Naturally, Google Assistant integration is a big plus for Dialogflow. So are integrations with the following popular messaging apps:

  • Facebook Messenger
  • Slack
  • Kik
  • Line
  • Skype
  • Telegram
  • Twilio
  • Viber

Of course, you don’t have to deploy your Dialogflow bot on individual messaging apps. It’s a good idea to launch your bot on its own .BOT domain name. That way, users can always find your bot, even if they start spending less time on Facebook Messenger, Slack, or wherever it was that they first activated your bot.

To this end, Dialogflow offers a one-click Web Demo integration. For example, if you have a .BOT domain, you can easily embed your bot right into a nameofbot.bot domain by following the steps in the Dialogflow Web Demo documentation.

Another key Dialogflow feature is its powerful machine learning engine, which allows your bot to understand natural language, connect utterances with intents, and pull the data needed to satisfy a request. If recent updates are any indication, machine learning advancements will continue to be a major focus. In 2018, Google pushed to improve natural language understanding (NLU) quality in Dialogflow, and the company succeeded by allowing use of negative examples as training phrases for machine learning.

With support for more than 20 different languages, Dialogflow is also making it easier to build bots for a global audience. Most of these languages are supported for speech to text and vice versa.

Dialogflow pricing model

Pricing for Dialogflow is simple. At the time of this writing, it includes the following options:

  • Free edition. Unlimited text or Google Assistant support, limitations on other services, no SLA
  • Essentials edition. $0.002 per request for text or Google Assistant, $0.0065 per 15 seconds of audio, $0.05 per minute of phone calls, $0.06 per minute of toll-free phone calls
  • Plus edition. $0.004 per request for text or Google Assistant, $0.0085 per 15 seconds of audio, $0.065 per minute of phone calls, $0.075 per minute of toll-free phone calls

The real difference between the Essentials and Plus editions is whether there are limits on knowledge connectors, which grab data from external resources and feed back into your Dialogflow agent. If you accept limits on knowledge connectors, you can pay the lower rates of the Essentials edition. The Plus edition gives you unlimited knowledge connectors. Both paid editions come with an SLA.

If you’re just getting started, you probably don’t have to worry about pricing. You can build your bot and test it on Dialogflow without paying a cent. It’s when people actually start using your bot (and using it a lot) that you may need to upgrade to Essentials or Plus.

Supported programming languages

You can access the Dialogflow detect intent API and agent API through its REST API or client libraries in the following languages:

  • JavaScript (Node.js)
  • Python
  • Java
  • Go
  • Ruby
  • C#
  • PHP

This could be welcome news if, for example, Ruby is your go-to language. Some frameworks, such as Microsoft Bot Framework, might be harder to work with if it’s been a while since you worked in Java or if you don’t already work in .NET/Visual Studio.

How machine learning works in Dialogflow

Your Dialogflow agent learns in two different ways:

  • Training phrases provided by you
  • Prebuilt language models packaged with the framework

With training phrases, the bot is learning from information you specifically feed into it. For example, you might add this phrase: Book a double room at your Milwaukee downtown location. You would then specify entities for that phrase, such as booking.type and hotel.location, annotating the phrase so that the bot understands downtown Milwaukee to be the right hotel and a double room to be the right type of room.

The bot won’t just learn how to do this for a single location in the Upper Midwest but will do so for all similar utterances for different room types and different cities. It recognizes the same entities for all users who want to make reservations.

Getting started with Dialogflow tutorials

Start with the Dialogflow tutorials to get a sense of what it’s like to use the framework. It might be a good idea to work through them alongside similar tutorials for other frameworks to decide which tools you like most.

After running through the basic tutorial, try following the tutorial for advanced concepts. The advanced builds on the one for the basic bot by showing you how to specify confirmation queries (based on intent) and suggestion queries.

By following the tutorials and reading through the documentation, you should have a good idea of whether Dialogflow is the right framework for you. If you already work within the Google ecosystem and like being able to deploy your bot to practically any platform or website without a lot of difficulty, it could be a smart choice.