Anish
Anish

Reputation: 758

Bot Framework: Handle incorrect user inputs

I've built a bot that asks user to upload an attachment. But I also want to give the ability to the user to just type any text instead of uploading an attachment, but whenever I do that it says

I didn't receive a file. Please try again.

In the command line, I can see it says no intent handler found for null. How do I handle these nulls/incorrect inputs?

Sample code:

intents.matchesAny([/lost and found/i], [
    function (session) {
        builder.Prompts.attachment(session,"Please upload a picture of the item.");  
     },

    function (session) {
        session.endConversation('Thank you');
    }
]);

Upvotes: 0

Views: 99

Answers (1)

Gary Liu
Gary Liu

Reputation: 13918

Per your issue message, no intent handler found for null, which seems that you are using builder.IntentDialog, and the issue means that your bot didn't match any intents provided in your bot.

Also I notice that your are using intents.matchesAny, according to the comment:

Invokes a handler when any of the given intents are detected in the users utterance. So I think you forget to set such intent lost and found in your LUIS server.

If you want to trigger any miss catched user utterance, you can try to use:

intents.onDefault([
    function (session) {
        builder.Prompts.attachment(session,"Please upload a picture of the item.");  
     },

    function (session) {
        session.endConversation('Thank you');
    }
]);

Upvotes: 1

Related Questions