# Dialogflow CX Basics — Part 2

In the [previous post](https://levelup.gitconnected.com/dialogflow-cx-basics-part-1-76a058e1b90d), we have seen some of the basics of Dialogflow CX. In this post, we will continue with the rest of the basics

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1698055428173/771fae75-47ee-4e19-a041-7a63f0550495.png align="left")

### 1\. Webhook

Webhooks are the services that allow hosting your business logic. webhooks allow you to use the data extracted by Dialogflow’s natural language processing to generate the dynamic responses, validate collected data, or trigger actions on the backend.

CX webhooks are similar to ES webhooks, except that request and response fields have been changed to support CX features.

### 2\. Fulfillment

For the agent’s conversational turn, the agent must respond to the end-user with an answer to the question.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1698055429684/1183b073-07af-4403-be50-9f3acd5d396b.gif align="left")

In the above example, the customer greets the shopkeeper for that the shopkeeper greets back. Once the greeting is completed the shopkeeper asks what does the customer needs? for that, the customer replies what she needs a coffee for which the shopkeeper returns her a coffee.

Fulfillment is used to accomplish the following things

1. Static response message
    
2. Webhook calls for dynamic responses and/or to take actions.
    
3. Parameter presets to set or override parameter values.
    

During an agent’s turn, it is possible to call multiple fulfillments, each of which may generate a response message. like below

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1698055431514/7cf3832f-d690-4b22-9644-02976113e0fa.gif align="left")

Dialogflow maintains these responses in a *response queue*. Once the agent’s turn is over, Dialogflow sends the ordered responses to the end-user.

### 3\. State handlers

State handlers are used to control the conversation by creating responses end-users and/or by transitioning the current page.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1698055433510/36591c6f-63d3-445b-a958-c1232f7d3c03.png align="left")

* **Handler requirements** — These are the requirements that must be satisfied for the handler to have any effect on the session.
    
* **Handler fulfillment —** If a handler is called, an optional [fulfillment](https://cloud.google.com/dialogflow/cx/docs/concept/fulfillment) is used to create responses for end-users.
    
* **Handler transition target —** If a handler is called, an optional transition target is used to change the current page. The next page can only be a [flow start page](https://cloud.google.com/dialogflow/cx/docs/concept/flow#start-page) or a page within the currently active flow.
    

There are two types of state handlers with differing handler requirements:

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1698055435402/ac7b26c3-abf7-4161-a37a-ebfef4df191c.png align="left")

There are three steps to processing a state handler

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1698055437666/602ac77a-faa8-4fb0-8a1e-bbec9ce296be.png align="left")

* **Scope** — A handler must be in [scope](https://cloud.google.com/dialogflow/cx/docs/concept/handler#scope) to have any effect on the session. The scope is determined by whether a handler is applied to a flow, a page, or a form parameter; and by whether the associated flow is active, the associated page is active, or the agent is currently attempting to fill the associated form parameter.
    
* **Evaluation** — Each handler in scope is [evaluated in order](https://cloud.google.com/dialogflow/cx/docs/concept/handler#eval). If a handler’s requirements are met, it passes evaluation.
    
* **Call** — If a handler is in scope and passes the evaluation, it is called. Any associated fulfillment is called, and any associated transition target is applied to the session.
    

### 4\. Regionalization and location settings

When you create an agent, you must specify a [region](https://cloud.google.com/dialogflow/cx/docs/concept/region#avail) as the agent’s location. Requests sent to your agent are handled by Google services in this region and Dialogflow keeps [data-at-rest](https://en.wikipedia.org/wiki/Data_at_rest) physically within the geographical [region or location](https://cloud.google.com/about/locations). For the best performance, you should choose a region that is near your services and end-users.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1698055440234/091c1b3b-3d17-4fbf-a2f1-b5040c6fa07a.png align="left")

Each location has associated settings that apply across your project. In most cases, you do not need to edit these location settings, and the default settings will work well.

### 5\. Console

Dialogflow provides a web user interface called the Dialogflow CX Console ([open console](https://dialogflow.cloud.google.com/cx/projects)). You use this console to create, build, and test CX agents. The CX Console has a similar purpose as the [ES Console](https://cloud.google.com/dialogflow/docs/console), but the CX Console user interface is much more visual. It graphs each flow as a conversational state machine diagram, which makes complex agents easier to design and understand.

In most cases, you should use the Dialogflow CX Console to build agents, but you can also use the **Dialogflow CX API** to build agents for advanced scenarios.

### 6\. Integrations

Dialogflow CX currently provides several built-in [integrations](https://cloud.google.com/dialogflow/cx/docs/concept/integration) with other conversation platforms. These integrations provide a user interface to the end-user, and they call the Dialogflow API for you.

All you need to do is build your agent and optionally implement a [webhook](https://cloud.google.com/dialogflow/cx/docs/concept/webhook) service. Each integration handles interactions in a platform-specific way, so see the specific integration documentation for details.

### 7\. Interactions

For each conversational turn, an *interaction* takes place. During an interaction, an end-user sends input to Dialogflow, and Dialogflow sends a response. You have two options when implementing your system to handle interactions

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1698055442118/29f16a2b-c405-4109-9a6c-c3ccf7a2940e.png align="left")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1698055444065/e1a30f9a-f79f-4bd8-9d7f-9225d6569a0e.png align="left")

### Congratulations 🏆

You have completed the DialogflowCX basics. Catch you up in the next post till then **Happy Learning** 😄
