1

I am building a bot which contains the Slot Filling approach and I want to provide a rich message from a webhook once an exit phrase is input to the bot.

I am building a bot which contains the Slot Filling approach. I came across through "cancelling slot filling dialog" in the documentation from the link https://dialogflow.com/docs/concepts/slot-filling#canceling_slot_filling_dialog

While I was trying it out, I found that not only the mentioned utterances in the documentation, there are more exit phrases like that. Ex: nothing, abort.

I couldn't find any intent/settings to configure/change this behaviour.

  1. Is there a way that I could find out all the exit phrases?
  2. Is there a way to change the output message displayed when the user says an exit phrase?
  3. Can we connect with a webhook after user says an exit phrase to provide a custom rich response?

Attached is the response I get when I say an exit phrase to bot while slot filling

Ershadi
  • 133
  • 10
  • This is not 100% certain, but I suspect the list of cancelling phrases is the same as that found in the "cancel" intent of the prebuilt smalltalk agent. To find this, go to Prebuilt Agents -> Small Talk -> Import. Then navigate to that agent and find the intent "smalltalk.cancellation.cancel" to view the list of phrases. – mintsponge Jan 29 '19 at 15:19
  • Thank you for the information. I tried importing the Small Talk agent and i tried all the training phrases in the "smalltalk.confirmation.cancel" (a small correction of the intent name) intent with my scenario. All of those phrases acted as exit phrases during slot filling too. Seems like this can be considered as an answer to my first question. But I'm still struggling to find answers to the 2nd and 3rd questions. – Ershadi Jan 31 '19 at 05:48
  • @Ershadi Have you got anything answer for your 2nd and 3rd question? – Rajeev Uppala Mar 20 '19 at 14:29

1 Answers1

0

There's no built in way to do it as far as I can tell, but there is a hacky way you could use 3 to achieve 2. I'll assume you are familiar with how Dialogflow webhook requests and responses work generally. Please see here if not.

It basically boils down to checking if Dialogflow is about to respond with one of its stock cancellation phrases, then replacing it with one of your own.

Make sure "enable webhook call for slot filling" is on. When the user types a slot filling exit phrase, the webhook JSON that Dialogflow sends will still have the same intent.name property as the intent you're working with. So you can catch that intent in a switch statement.

Then inside that you can simply use an 'if' statement to check the "FulfillmentText" property of the webhook request and see if it's any of the stock phrases Dialogflow uses to respond to cancellations, such as "Sure, cancelling", or "No problem, cancelling". I don't know how many there are, but I assume there's not too many, you'll have to test to try and find them all.

If it is any of those phrases, you can then change what Dialogflow says to the user by giving back a response to the webhook with your own FulfillmentText set to whatever you want (see the link above with how the JSON response should be structured).

This method isn't exactly ideal as the stock exit responses Dialogflow uses could change and it's hard to know if you've found them all, but it should be a workaround until Dialogflow becomes more flexible.

Also copying my comment about question 1 before since it seems to work (thanks for the typo correction):

I suspect the list of cancelling phrases is the same as that found in the "cancel" intent of the prebuilt smalltalk agent. To find this, go to Prebuilt Agents -> Small Talk -> Import. Then navigate to that agent and find the intent "smalltalk.confirmation.cancel" to view the list of phrases.

Hope this helps.

mintsponge
  • 146
  • 1
  • 5