botpress / v12

Botpress OSS – v12
https://v12.botpress.com
GNU Affero General Public License v3.0
68 stars 83 forks source link

Implement a default fallback or error response. #84

Closed jcampbell05 closed 6 years ago

jcampbell05 commented 7 years ago

We should have a way of having a bot send a message when the server encounters an error for a better experience for users.

Additionally in Bottr I had a way of detecting when a incoming message wasn't handled and have the bot automatically respond to let the user it hadn't been taught what to do with that message.

This catch all was good for UX since the developer could spot code paths they missed out easily and it didn't strand the user.

How it worked is there was a middleware which always was executed last which would send "sorry I wasn't taught anything else". When implementing the equivalent of the Hears middleware in Bottr it would only call the next middleware for the incoming message chain when there wasn't a match.

Eventually if nothing had handled the incoming text then the catch-all middleware would be triggered.

slvnperron commented 7 years ago

Great idea!! Maybe the default would be like you say + we could give the developers a way of switching to:

1 (default) - Respond to the user "I'm sorry, ... " + warn message in logger 2 - Don't say anything but pop a Botpress notifications + a warn message logger 3 - Warn in logger only 4 - Custom handler

What do you think?!

jcampbell05 commented 7 years ago

Yeah maximum flexibility :)

slvnperron commented 7 years ago

Cool! Like this idea. Let's implement this :)

fstn commented 6 years ago

+1

slvnperron commented 6 years ago

@fstn Hey so this has been implemented but isn't documented: https://github.com/botpress/botpress/blob/b862db4a5f3eb39bdbd20afae46b12dc3138398a/src/fallback.js

Would appreciate a PR to the doc

Shivam62 commented 5 years ago

Hi, Can you provide detail explanation for this. Where we can add this script or if it can be handled at UI