Handle user command are not any intent

Hi everyone i have some issue with my rasa chatbot
My question is: if user input is a command start with a special character and that input is not any intent in my NLU training file. In this case i will call an other service which use that command and call some api. How can i do that
For example:
user: /command_check
rasabot: (call an api and return the result)
user: hello
rasabot: hello there(nomal response from rasa core)

Note: i can not make any intent for that command because of i will have many command so can not control every command to the nlu file

Thanks for reading.

Hello @vunt39

Do you have control over the front end? In this case, you might call the api directly (instead of sending a message to the bot). Otherwise, I see two options for you.

The first option is to use Rasa’s INTENT_MESSAGE_PREFIX, which is the / character. With this, you can directly input an intent/entity instead of a message (like /stop). With this, you could define an intent command and handle the arguments via entities. Thus, you would have to type /command{"parameters": "check"}. This would classify the intent as command and the entity parameters as check From there you can just call a custom action, e.g. via the mapping policy.

The other option is to modify the Rasa source code at MessageProcessor._parse_message in rasa/core/processor.py and add another elif case for your special commands. Feel free to create a pull request if you think other people might be interested in this feature.

I hope this helps :slight_smile:

1 Like

Hi @j.mosig
Thank you for reply

Yeah i can control over the front end to do that. But i’m trying to do a diffrent solution. If i can control everything in my rasa chatbot. That can change my architecture system. I think your options are so good and i will try to do that to my chatbot.

Hope that i can contribute a pull request

Thank you so much

1 Like

How can I call the api directly from front-end ? I am explaining My Purpose-

refer the figure , it consists of a table and i want when user click on corresponding No of Projects , it display the details.

Hello @vi.kumar

You can do this by letting your front end send a message starting with “/” (the INTENT_MESSAGE_PREFIX) when the user clicks on a button. For each button you could specify a special intent (e.g. pick_first, pick_second, etc.). Also, checkout Domains, in case you just need buttons and not the table.