DEV Community

Cover image for Partial Response Feature in Dialogflow CX
Dhruv Rajkotia
Dhruv Rajkotia

Posted on

Partial Response Feature in Dialogflow CX

Dialogflow CX short for Dialogflow Customer Experience is a recent launch from Google in December 2020. It provides a new way for designing agents, taking a state machine approach to agent design. This gives you a clear and explicit control over a conversation, a better end-user experience, and a better development workflow. The older version of Dialogflow which is Dialogflow ES short for Dialogflow Essentials is still supported but the Dialogflow CX should allow chatbots with higher complexity to be built more seamlessly using a visual editor and not require one to write complex code.

With Dialogflow CX, Google has come up with a lots of new features and overcomes some of the limitation of the Dialogflow ES. Today we are going to discuss about the one of the feature of Dialogflow CX which is the partial response. You probably have seen that option when setuping webhook in Dialogflow CX. Let's have a deeper discussion on that.

What is Partial Response? Why we need it?

Sometimes we got into a problem where API takes more time to respond back to the end users and if we need to integrate those API in our bot then probably it's not a good experience to the end users as they need to wait until the API response. Let's understand this issue with some practical example.

Like, If we have food ordering bot and user has reached to payment flow. User has asked "what is my bill amount?". So here we need to go back to our system and generate bill for the user. So let's assume that our generate bill API takes more than 5s(Dialogflow CX support the webhook timeout till 30s). So here user needs to wait until the API response which may feels user like Is he/she disconnected? or what happened to bot? which leads to a very bad user experience.

Image description

To overcome this problem Dialogflow CX comes up with partial Response feature which has ability to notify users while we are fetching details through webhook. notify users and fetching details from webhook will perform parallel. So here we can notify users with some text like "One moment please while I look that up." So using end user will notified while we are fetching details in backend.

Image description

How to add partial response in Dialogflow CX

Step 1

Go to the Route which has the webhook integrated. like from which route you are going to call your webhook. For reference I have attached a screenshot below.

Image description

Step 2

Add the fulfillment message for that route as per the screenshot. (One moment please while I look that up.)

Image description

Step 3

Enabled Return Partial Response option.

Image description

That's it, you have configured the partial response successfully.

Now let's have a quick test.

Go to your Simulator and click on the 3 dots setting and enabled the partial response option. please take reference from screenshot.

Image description

Now try with your query which execute the route and call the webhook. After some time you'll received the defined message from bot site before your webhook success message.

Hope you liked this blog. Please FOLLOW me on Twitter to get notified regarding my upcoming blogs. Have a nice day..!!

Top comments (2)

anjaneyparasar profile image
Anjaney Parasar

How can I turn on partial responses in dialogflow CX messenger integration, like we do in test agent simulator?

nd7 profile image
nd7 • Edited

How can I put a condition on a partial response so it only plays if the webhook delay is more than x seconds?