0

I am trying to create a quiz-bot, in which I wish to verify the users answers. I have created an intent to show questions and then a follow up intent to verify answers. Following is the brief idea:

When the user is shown the question, he/she is also shown the one word options as suggestion tiles, the user selects the suggestion tile (which he/she thinks is a correct answer), then the follow up intent should be triggered to verify the answer and the bot should respond as correct or incorrect answer.

As of now, I am able to show the question and options in the chat box, but as soon as the user selects the option, default fallback intent is triggered. Also I have included all the answers in the intent's training and these answers are of one word length.

Is there a way to trigger intent using user's input? Also if there is any other approach to create quiz-bot in dialogflow, please do comment?

monte
  • 1,482
  • 1
  • 10
  • 26
  • We can help you better if you include as part of your question some screen shots of the Intents in question that illustrate the problem you're encountering. – Prisoner Jun 19 '19 at 19:45

1 Answers1

2

I have also created a quiz on Google home. The same problem occurred to me and I came up with the following solution:

The Default Welcome Intent has an output context of await_answer and I ask the question in this intent. Then there is the getAnswerIntent that has the await_answer as input context and has the answerCodeEntity as trainingsphrase. This entity consists of:

A: 1, A, answer 1, answer A, first, first one, the first one
B: 2, 2nd answer, second answer, answer B, B, ...
C: ...
D: ...

E.g.: How far away is the moon from the earth? A: 384.000km B: 50.000km or C: 1.000.000 km

This way users know how to answer. You will avoid having users that can't say the answer or just don't remember. Always try to expect how a user will respond.

This way you can handle the user's answer in the getAnswerIntent.

I hope this helps you!

Mathias Schrooten
  • 722
  • 2
  • 11
  • 20
  • He;y Mathias, thanks for the answer. Just to check if I have understood it right, you have defined a separate entity for each option? And how do you assign option to entity, is it through entering option in training phrases tab (under intent) and then tagging it to entity. This might not work in my case, as I have quite a few options to upload, roughly 1000+ – monte Jun 20 '19 at 07:38
  • I just keep track of which questionId is currently active for the user that's talking now. In my Firestore database I keep track of the questions and have a field 'correctAnswerCode'. Then I in the getAnswerIntent I get the question with the corresponding questionId and check if the entity === correctAnswerCode. Hope this makes sense! – Mathias Schrooten Jun 20 '19 at 11:53