Condition for error handling

Hello everyone!

I would like to set a condition in the transition so that my chatbot recognizes certain keywords. And if it recognizes them in the user input — goes into the error handling flow.

How should I formulate this condition?
Thank you for your help in advance!

Hello inmeinemarm

It’s possible to modified the input for the failure choice Node. In the Flow editor, Pick your choice node and click on edit for the On failure condition.

A form will appear and you can edit it. I’m suggesting using the Intent Is Choice. In the Intent tab, you can create a list of possible values the user might use to Go in the Catch Flow.

Thanks for your question and your time

1 Like

Hello @Daehli Thank you very much for your reply!

Unfortunately your example doesn’t really fit in my chatbot :cry:

In my chatbot there are different topics and I would like to prevent picking wrong answers from wrong topics. That’s why I want to write a condition that goes into a certain subflow as soon as it detects one of the keywords in the user input.

If I insert a list of keywords as an intent and then formulate the condition using “intent is”, the chatbot doesn’t recognize this. Because the user input usually consists of several words and sentences.

Do you maybe know how could I write this kind of condition? :sweat_smile:

Hie @inmeinemarm, you can check out this thread and check if any of my suggestions fit your use case.

Dear @Michael_BotpressTeam thank you very much for your reply!
I tried to do the same as shown in the example but using my own keywords.
Here you can see the code snippet:

And then I put it in the flow like this:

But when I enter the “tabak” keyword I get an error and the chatbot doesn’t switch the flow as I wanted. Do you maybe have any ideas what am I doing wrong and how this could be fixed? Thanks a lot in advance!

Hie @inmeinemarm, please try this as a hook before incoming middleware. That way, whatever the user says can be checked. Should you require the keyword to be picked up when the user is in a particular node or flow, you can write a conditional statement to test which node or flow the user is in.

Also I suggest you add after your last case statement:

default:
bp.logger.info('No Keywords Detected');