Wednesday, July 17, 2024

Embed Dialogflow ES Chatbot with Messaging Apps & Websites

Dialogflow ES or Dialogflow Essentials

Dialogflow, a service provided by Google Cloud that enables the creation of conversational agents that comprehend and react to natural language, is frequently used by organisations seeking to develop chatbots. Because Dialogflow CX comes in two variants and has sophisticated chatbot features, many organisations opt for it. If you integrate a chatbot with your website without using a middleware solution, you run the danger of using unauthenticated URLs or directly inserting sensitive credentials like service account keys into the frontend. For production-grade systems, this is not a great practice since it can leave your agent and Google project ID vulnerable.

By adding an Apigee layer between your frontend and DialogFlow CX APIs, you can lessen this. Google Cloud provides Apigee, a full lifecycle API management platform that helps companies create, protect, publish, examine, track, and make money from their APIs. Apigee offers a wide range of capabilities and advantages by serving as a strong layer between clients that access backend services and them. In this situation, Apigee offers:

  • Centralised authorization and authentication: Apigee manages all authorization and authentication procedures, serving as a safe gateway. As a result, there’s no need to reveal login credentials on the front end.
  • Controlled access: Using Apigee, you can create fine-grained access controls that specify which frontend elements are able to communicate with which DialogFlow CX APIs.
  • Apigee facilitates the management of API keys by streamlining the rotation and revocation procedures in the event of a compromise.
  • Threat protection: To protect your APIs from abuse and possible attacks, Apigee comes with built-in tools like rate limitation, quota management, and spike arrest.

Dialogueflow CX basics

This guide covers Dialogflow CX basics. It summarises key ideas.


Dialogflow CX agents are virtual agents that handle concurrent end-user discussions. This natural language understanding module understands human language subtleties. Dialogflow converts conversational text or audio into structured data your apps and services can understand. You create a Dialogflow agent for your system’s talks.

Dialogflow agents resemble call centre agents. You prepare them both to handle typical conversation scenarios without being explicit.


Complex conversations often cover numerous topics. Pizza delivery agents may discuss meal order, customer details, and confirmation. An agent needs many conversational turns to get end-user information on each topic.

Flows define themes and conversational pathways. Every agent has a Default Start Flow. One flow may be enough for a simple agent. Different development team members can construct and maintain flows for more complex agents.

Dialogflow CX flows resemble Dialogflow ES mega agent sub-agents. Flows improve conversation control without costing more.

Dialogflow ES

A Google Cloud service called Dialogflow ES, or Dialogflow Essentials, lets you create virtual assistants and chatbots. It’s a viable choice for building chatbots that manage easier interactions and chores.

The following is an overview of Dialogflow ES’s features:

  • Dialogflow ES uses natural language understanding, or NLU, to decipher user text or spoken words. It determines the purpose of the user’s query and retrieves pertinent data (entities) such as names, locations, and dates.
  • Pre-built features: To facilitate conversation management, Dialogflow ES includes pre-built functionality. In addition to handling small talk and asking customers if they need any additional help, it can refer users to human agents in the event that it is unable to understand them.
  • Integrations: Dialogflow ES may be integrated with a number of different platforms, including websites, phone systems, and messaging apps. This enables you to use your chatbot in many locations.

The following are a few Dialogflow ES usage cases:

  • Chatbots for customer service: Respond to often asked queries, solve issues, and get user input.
  • Make it possible for people to make appointments via a chat interface.
  • Information retrieval: Give consumers details about goods, services, or corporate guidelines.
  • The alternative edition of Dialogflow, called Dialogflow CX, is a viable option if you’re searching for a strong solution for sophisticated chatbots with cutting-edge features. Still, Dialogflow ES is a decent choice if you want to start building chatbots for easier jobs.


A Dialogflow CX session is a state machine. Pages reflect CX session states.

For each flow, you define several pages that can cover its topics. At any one time, one page is active and its flow is active. All flows have unique start pages. The start page becomes the current page when a flow starts. Every conversational turn, the page either stays the same or changes.

You configure each page to capture end-user information related to its conversational state.

Entity types

Entity types control end-user data extraction. CX entity types like ES entity types.
Dialogflow predefined system entities match many common data types. There are system entities for matching dates, timings, colours, email addresses, etc. You can also create custom entities to match specific data. You may define a vegetable object to match grocery shop agent veggie selections.


Parameters store and reference end-user session values. Parameters have names and object types. Instead of raw end-user input, parameters are structured data that can be used for logic or answers.

The syntax of CX parameters has changed, but they are the same as ES parameters in terms of usability and scope.


You can construct a form for each page to collect end-user parameters. The agent talks to the end-user many times until it collects all form parameters, or page parameters. The agent collects these parameters in page order. You give the agent prompts to ask the end-user for each form parameter. A process called form filling.

A Collect Customer Info page might employ a form to collect the end-user’s name and phone number.

CX form filling resembles ES slot filling.


An end-user’s conversation turn intent is categorised. Compared to ES intentions, CX intents are simpler and more reusable.

Display nameName displayed on the console for the intent.
LabelsLabels that help categorize intents. For example: head intent.
Training phrasesTraining phrases are example phrases for what end-users might type or say, known as end-user input. When end-user input resembles one of these phrases, Dialogflow matches the intent. You don’t have to define every possible example, because Dialogflow’s built-in machine learning expands on your list with other, similar phrases.
ParametersYou define your training phrases to use parameters to extract values from specific parts of the end-user input.
DTMF patternsSee DTMF for telephony integrations.


Webhooks are programmes that can call other programmes or host your business logic. Webhooks let you use the information that Dialogflow’s natural language processing extracts throughout a session to validate data that has been collected, generate dynamic answers, or start backend activities.

There are two types of webhooks: standard and adaptable. Dialogflow defines the request and response fields for a typical webhook. You can specify the request and response fields when using a flexible webhook.


An agent’s response to an end-user inquiry, information request, or session termination marks the beginning of the conversational turn. In order to provide dynamic responses or take action for a turn, your agent might also need to get in touch with your service. All of this is achieved through the use of fulfilment.

Any of the following could be present in a fulfilment:

  • Responses that are static.
  • Webhook requests action and/or dynamic responses.
  • Set or override parameter values with parameter presets.

It is feasible (and occasionally desirable) to call more than one fulfilment during an agent’s turn, and each fulfilment may provide a response message. These answers are kept in a response queue by Dialogflow. Dialogflow sends the end-user the ordered responses after the agent’s turn is over.

The only way to use ES fulfilment is to link a webhook service. For CX, the scope of fulfilment has been expanded to include all possible prompts and responses.

State handlers

State handlers, commonly referred to as handlers, are responsible for managing the conversation by generating responses for end users and/or switching between pages. Handlers are assessed for every conversational turn and have the potential to impact the session.


Dialogflow CX has various built-in discussion platform connections. These integrations call the Dialogflow API for you and provide an end-user experience. Simply design your agent and possibly install a webhook service. The integration documentation outlines how each integration handles interactions on each platform.


Each verbal turn involves interaction. Dialogflow responds to end-user input. You can handle interactions with your system using the API or an integration.

When using API, your system must handle:

  • Make an agent.
  • Create an end-user interface.
  • For each conversational turn, transmit end-user input to the Dialogflow API.
  • A webhook service is needed for webhook-enabled fulfilment unless agent responses are static (uncommon).

Your system just needs to handle the following with an integration:

  • Make an agent.
  • Webhooks are optional.

By acting as a middleman, Apigee gives you a strong tool for managing and monitoring your APIs in addition to improving the security of your chatbot integration. We’ll show you how to set up Apigee to enhance conversational agent security in this post.

DialogFlowCX using Apigee
Image credit to Google cloud

Setting up and customising the conversational agents Apigee Proxy

  1. To begin, launch a new Apigee instance on Google Cloud or utilise an already-existing one. To create an instance of an assessment trail, click this link.
  2. Use this instructions to create a DialogFlow CX Agent.
  3. Retrieve the Agent ID and location from the console and save them for later use.
  4. Establish a service account and assign the function of “DialogFlow API Client.”
  5. Click “Create a Proxy” of type “Reverse Proxy” on Give it a name, such as “myproxy.”
  6. Set up the DialogFlow CX Detect Intent API as the target endpoint, and change the project, agent, and location as needed.
  7. Add and to the HTTP target connection in the Proxy Develop tab as indicated below.
  8. Set up the proxy in the environment that is accessible. It is crucial that you use the Service Account that you previously generated in this stage. Requests to the DialogFlow CX API will be authenticated using this Service Account.
  9. Try your proxy using any API client. An answer from the DialogFlow CX Intent API ought to be visible to you.

Whoa! The DialogFlow CX should be communicating with your proxy and operating as intended.

The complete course of the request can be traced using the Apigee debug console for verification.

Thota nithya
Thota nithya
Thota Nithya has been writing Cloud Computing articles for govindhtech from APR 2023. She was a science graduate. She was an enthusiast of cloud computing.


Please enter your comment!
Please enter your name here

Recent Posts

Popular Post Would you like to receive notifications on latest updates? No Yes