Search code examples
dialogflow-eschatbot

Do we need webhook when our server is interacting with dialogflow?


We are implementing our customized chatbot using dialog flow. When user enters any text, our javascript code sends this text to our python server and the server interacts with google dialog flow and server gets complete response. I just have couple of questions as below.

  1. When server gets the response from dialog flow, it will process the response and sends some response to UI. Do we still need to have fulfillment enabled as our server is getting response? Basically if server is interacting with dialog flow and getting response, what is the use of webhook?

  2. Is there anyway to enforce the dialog flow intents require at least one of entities? I went through Can I make Dialogflow intents require atleast one of the trained entities? which says to enable webhook fulfillment for that intent and if no entities were provided, re prompt the user for at least one of a list of entities. So in my case, if webhook is not needed, do I need to do it in the server once server receives response or is there anyway dialog flow will automatically enforce the condition with out server taking the responsibility?


Solution

  • In your case, no, you don't need to use webhook fulfillment.

    You may still wish to use it, however, if you want to separate business logic (which would be in the webhook) from UI/UX logic (which would be in your python server and in the javascript client). But there is no requirement that you separate things this way.

    Similarly, you can use your python code to enforce "at least one of" the parameters matching - you're moving that logic from the webhook into your existing server.

    Either way, this is a bit kludgy. One alternative if you have different entity types is to have multiple Intents, one for each possible type, and to mark the parameter as required. This way the Intent will only match if the parameter is provided. If you then need to report each of these Intents as the "same" Intent, you can add that logic to your python code.