0

I have started using dialog flow couple of days back. I have used Java API to act as a webhook where every intent invoke the API and it produces response that can be understandable by dialog flow.

There are some occasions where my dialog flow agent request failed with the input from the intents. In this case I couldn't catch the exception in API and it produces 400 Bad request and dialog flow doesn't repsond anything to the user.

Let me know how to do this. There is an inline editor with js and it was handled with exception like this

res.on('error', (error) => { console.log(Error calling the weather API: ${error}) reject(); });

Arun
  • 609
  • 2
  • 12
  • 33
  • What's wrong with sending a 400 Bad request from your Java API to Dialogflow? – Aza T Jun 09 '18 at 02:30
  • When you do some change in dialog flow UI, at times some parameters changes to list. And my API failed to parse the payload as it was expecting an object.(We cannot afford to have No proper response from the API's) – Arun Jun 11 '18 at 04:23

1 Answers1

2

There is no specific way to handle exceptions in the webhook dictated by Dialogflow, which is why inline editor produced that generic snippet.

If you send a 400 Bad Request from your webhook to Dialogflow, Dialogflow will respond to the user with whatever default response you provided in Dialogflow console for the failed intent. If you didn't provide a default intent response in Dialoflow console and the webhook failed, then your app will not respond anything to user, which is what seems to be happening.

I suggest providing default responses for all intents in the Dialogflow console.

Default response in Dialogflow

Aza T
  • 589
  • 4
  • 11
  • I agree with your comment. I did the same way for other integrations. But when you try with webdemo powered by dialog flow, it simply displays 400 bad request without proper message. – Arun Jun 11 '18 at 23:50