Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Dialogflow CX: how to differentiate static and webhook response

Hi Team,

I'm currently working with Dialogflow CX detectintent api. I'm facing issues on differentiating static agent response and webhook response. Let me ellaborate. I have a Route Transition for (Default welcome intent) where I have configured agent response (ex: Hello! How I can help you?). I do also enabled Fulfillment response for the same which returns (ex: Hi, thank you for contacting. I'm Nova Bot, your virtual support. How can I help you today?).

In Dialogflow ES, if an intent has webhook enabled, then the text response from webhook is available in fulfillmentText attribute in webhook response and same will be shown to user. If any timeout or error occured in webhook, then user will see the static response configured.

In Dialogflow CX, even when webhook call is success, I'm seeing both responses (static agent response + webhook response) in the responseMessages attribute in webhook response. And in simulator, im seeing both messages. Is there a way in webhook response to differentiate both response types.

Below is the fulfillment response
"responseMessages": [
{"text": {"text": ["Hello! How I can help you?"]}},
{"text": {"text": ["Hi, thank you for contacting. I'm Nova Bot, your virtual support. How can I help you today?"]}}
]

And this is how I'm sending the fulfillment response

fulfillmentResponse: {
      messages: [{text: {text: ["Hi, thank you for contacting. I'm Nova Bot, your virtual support. How can I help you today?"]}
}
 
Need your help to resolve this.
0 3 486
3 REPLIES 3

Hi,

Unfortunately, there is not a way of doing that cleanly. I would suggest using the webhook event handlers and setting the fulfilment there. In this way, you will say Hello! How I can help you? when the webhook fails. Here are the docs: https://cloud.google.com/dialogflow/cx/docs/concept/handler#event-built-in (check the webhook.error).

Best,

Xavi

Hi Xavi, thanks for the response. In my case, it’s not about webhook error. I have an agent response(text response) configured for route. I do also have enabled webhook for dynamic response. So whenever the route is invoked, my webhook gets called. Issue is, webhook response contains both agent response(text response) and my custom dynamic response. 

Below is the fulfillment response returned from webhook. Here i couldn’t differentiate which one is from webhook and which one is from agent text response.


"responseMessages": [
{"text": {"text": ["Hello! How I can help you?"]}},
{"text": {"text": ["Hi, thank you for contacting. I'm Nova Bot, your virtual support. How can I help you today?"]}}
]

 

In that case, what I would suggest is to set a parameter in the parameter pre-set section when you transition and then check in the webhook what to do (if it is from a route or not):

xavidop_0-1707776127614.png