-1

I am working with Dialogflow CX and I want to know if it's possible to trigger a fallback message after n times, for example after 3 tries I would like to send this message "Sorry I could not understand you. One of our agents will be online to help you!". Do I have to implemented in my webhooks(Using NodeJS for the webhook) or directly through Dialogflow CX Console? Thanks!

  • Hi @Saer El Masri, If my answer addressed your question, please consider accepting and upvoting it. If not, let me know so that I can improve my answer.Accepting an answer will help the community members with their research as well. – Shipra Sarkar Sep 12 '22 at 13:25

2 Answers2

1

In Dialogflow CX, it is handled by making use of State handlers, which can be categorized into Routes and Event handlers. In particular, there’s a specific kind of event handler that consists of the filling reprompt handler. This would allow you to transition to another page after the number of failed attempts that you desire. This works by defining a reprompt handler for handling unexpected inputs, that is, when sys.no-match-* or sys.no-input-* events are invoked.

You can follow the below steps in Dialogflow CX Console for your requirement :

  1. In the page where you’re collecting the input from your end user to fill your form, go to the parameter for which you want to implement this behavior, scroll down to the “Reprompt event handlers” and add a new one.
  2. Choose the option for “No-match default” event. In the condition for this event handler, fill one rule in this way: “Parameter: $session.params.counter, Operand: =, Value: N”, where N is the amount of attempts that you would like the user to try before routing the conversation.
  3. Add a fulfillment for the event handler, for example, “Sorry I could not understand you”. After that scroll down to the “Transition” section and choose the next page where you want to route the conversation after the N failed attempts. Save the event handler
  4. Go back to the same page and the same parameter and add a new event handler.
  5. Again, choose the option for “No-match default” event. In the condition for this event handler, fill one rule in this way: “Parameter: $session.params.counter, Operand: >=, Value: 1” and add a fulfillment, for example, “I didn't get your response, please choose one of the following options. Yes. No.”. Scroll down to “Parameter presets” and add a parameter in the following way “Parameter: counter, Value: $sys.func.ADD($session.params.counter, 1)”, and save the event handler.
  6. Go back to the same page and the same parameter and add one final event handler.
  7. Again, choose the option for “No-match default” event. In the condition for this event handler, choose the “Customize expression” option and fill it to “true” and add a fulfillment, for example, “I didn't get your response, please choose one of the following options. Yes. No.”. Scroll down to “Parameter presets” and add a parameter in the following way “Parameter: counter, Value: 1”, and save the event handler.

You can repeat all the above steps replacing “No-match default” for “No-input default” instead. Repeat this for any parameter from any page that you would like to have this behavior to happen after the amount of attempts that is most appropriate.

Shipra Sarkar
  • 1,385
  • 3
  • 10
1

Check the sys.no-match-[1-6] handler in the Built-in events documentation.

For your use case, you can add handlers "No-match 1", "No-match 2", and "No-match 3". Then, in "No-match 3", add "Sorry I could not understand you. One of our agents will be online to help you!" in the fulfillment's "Agent says" section and define the corresponding transition:

enter image description here

To add "No-match 1", click + next to the "Event handlers" section on the page, select "No-match 1", and click "Save":

enter image description here

Proceed in a similar fashion to add "No-match 2" and "No-match 3". Don't forget to define fulfillment for each of the added handlers.

Svetlana
  • 88
  • 5