Reputation: 13
I created 3intents.
Intent:lost.password.weblogin
Intent:lost.password.2step
Intent:lost.password.credit
eg)
user says: I forgot login password
->Intent:lost.password.weblogin
user says: I forgot 2 step password
->Intent:lost.password.2step
user says: I forgot Credit card PIN
->Intent:lost.password.credit
In case of user says “ I forgot password.”, what should I do to specify certain intent?
user says: I forgot password. =>???
Upvotes: 1
Views: 145
Reputation: 50701
I think the best way to approach the problem is to re-think how you're using Intents. Yours is a good way to begin thinking about the problem, but when you run into problems like you have, a re-think may be in order.
First - remember that an Intent represents what the user says and not how you handle what they say. It represents what the user is Intending to do.
From this, we can see that all four phrases are really trying to do the same thing - indicate they've forgotten their log in information. How they're trying to do that is an additional detail.
So you may want to approach this by creating just one Intent with a parameter that takes how they want to log in. You can even make this parameter mandatory, so if they don't provide it, Dialogflow will prompt for it specifically. This would be one Intent instead of the three that you propose.
For this, you may want to create an Entity which looks something like this:
Select the plus sign next to Entities on the left. Make sure you give the Entity Type a name (I've set it to "passwordMethod" here) and then enter the three Entities that make sense to you. Click the Save button when you're done.
Once you've done this, you can create your Intent with a few sample phrases that use these Entities. You'll then see that Dialogflow will pick out the parameter for you - make sure you mark this as required. Make sure you've turned the webhook fulfillment on and you save your Intent.
Your webhook will be called with the "lost.password" Intent and the passwordMethod
parameter being set to one of the Entity values: "login", "2fa", or "pin".
You can now respond accordingly based on what the parameter's value is. In the one Intent Handler that you have, you would look at what the parameter is set to, and then call normal functions in your webhook to handle it. This is pretty standard programming at this point - you don't need multiple Intents or Intent Handlers, just different functions that do the work and send back responses.
Upvotes: 2