1

[1]IntentWe have a Dialogflow bot consisting of two intents. Each intent contains some set of questions. The user answers the questions(prompts) and this process continues. We are getting the fulfillment text only after the intent is completed but we need to get the fulfillment text(Each and every prompt) after completing every question in that particular intent.

Help us in finding the solution.

2 Answers2

2

You can use webhook for slot filling. (under the "Enable webhook call for this intent", enable Enable webhook call for slot filling button). By doing this, you can still stay in intent handler function and prompt what you need until you can finish your steps.

For example:

  function flight(agent) {
    const city = agent.parameters['geo-city'];
    const time = agent.parameters['time'];
    const gotCity = city.length > 0;
    const gotTime = time.length > 0;

    if(gotCity && gotTime) {
        agent.add(`Nice, you want to fly to ${city} at ${time}.`);
    } else if (gotCity && !gotTime) {
        agent.add('Let me know which time you want to fly');
    } else if (gotTime && !gotCity) {
        agent.add('Let me know which city you want to fly to');
    } else {
        agent.add('Let me know which city and time you want to fly');
    }
  }

Also you can use this functionality on actions-on-google library.

Check for more information:

Webhook for slot filling

hfurkanvural
  • 420
  • 2
  • 16
1

Enable Webhook for Slot Filling. Dialogflow will call your server to see if you can provide the pending information that your user didn’t.

Kshitij Saxena
  • 930
  • 8
  • 19
  • Do you mean creating an intent for each question? If that is the case it is soo complex as we have 12 intents and each intent contains around 20 questions. Is there any way of getting the question or user says each time because we need the track of that particular user – Keerthi Kothuri May 24 '19 at 04:45
  • No, I mean, you should un-tick the required checkbox for all parameters under the header "Action and Parameters" – Kshitij Saxena May 24 '19 at 05:13
  • But doing un-tick doesn't display the question for that particular parameter right? – Keerthi Kothuri May 24 '19 at 05:18
  • Have you enabled webhook for slot filling? Without that you can’t get fulfilment webhook until all your parameters are filled. Slot filling assumes your server can fill the pending information and calls the webhook. – Kshitij Saxena May 26 '19 at 06:08
  • I have enabled slot filling. After enabling it, I am getting the responses very slow. What may be the reason? – Keerthi Kothuri May 29 '19 at 06:26
  • 1
    That is because Dialogflow makes an API call to your server before returning the response. I suggest you to try to optimise your code and make your server scalable to such traffic. Please mark it as the correct answer if it helped. – Kshitij Saxena May 29 '19 at 07:43
  • Is there any way to exit the conversation in the middle of the intent in dialogflow enterprise edition bot? – Keerthi Kothuri May 29 '19 at 08:44
  • If you use slot filling to complete the pending information with default values, the intent will complete and the conversation will end. You can handle default values on your server in webhook – Kshitij Saxena May 29 '19 at 08:47
  • Please find the updated screenshot above. I am getting the next question even after telling "stop"(in enterprise edition with slot filling enabled). The other bot which is not enterprise one and enabled slot filling is getting stopped when said "stop". – Keerthi Kothuri May 29 '19 at 09:06
  • Please find the updated screenshot above. I am getting the next question even after telling "stop"(in enterprise edition with slot filling enabled). The other bot which is not enterprise one and enabled slot filling is getting stopped when said "stop". – Keerthi Kothuri May 29 '19 at 09:06
  • Your intent changes when you say stop in the non-enterprise edition. Compare other intents and see if default intents are same and smalltalk is enabled in both. – Kshitij Saxena May 29 '19 at 09:26
  • Could you please provide your mail address so that I can discuss in detail as it is urgent for us. I had no reputation to chat. – Keerthi Kothuri May 29 '19 at 09:37
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/194169/discussion-between-kshitij-saxena-and-keerthi-kothuri). – Kshitij Saxena May 30 '19 at 11:02