We started making use of webviews in Facebook Messenger and have Call-to-Action buttons in some of our webviews (for example, a button to “Schedule a viewing”). When a user click on this button, we want the bot to behave as if the user had said something with the intent /schedule_viewing.
I understand we can use the HTTP API to trigger an action in Rasa which works fine. However, in this case, we would like to trigger an intent for which Rasa will predict the next action depending on the rest of the story.
Right now, we are able to insert user intents in the tracker and call specific actions from a custom endpoint. However, that means doing the story logic within this custom endpoint instead of relying on the stories to do so.
Therefore:
Is there a way to trigger a user intent and let Rasa predict the next actions from the API?
If not, can we force Rasa to predict the next actions through the code or API? (That way, we can just insert the intent in the tracker and force Rasa to predict the next steps)
@btotharye do you mean a button showing up in our bot messages? Our use-case is to embed a button within a Facebook Messenger webview (ie: the button will be displayed outside of the bot as Facebook displays an iframe in the webview).
What about just using the http://localhost:5005/model/parse with a {"text": "hello"} and do it that way and parse the intent from it maybe?
HTTP API has more information on it, maybe something like this or equiv API commands could work for your situation. Sorry I’m not as familiar with webview.
Thanks for your answer @erohmensing! In the webhook, there is a signature validation which checks the signature set in the X-Hub-Signature (which I assume Facebook Messenger sets). What should we put in there?
hmm that’s a good question i don’t know the answer to off the top of my head. I think there are two ways to debug + find out:
use chrome developer tools to inspect the network requests that get sent when you send a regular message
set up ngrok (temporarily) in front of your existing bot and redirect the webhook url to the ngrok server. ngrok provides a nice UI to be able to inspect requests that come in to the server
add some debugging information in the facebook webhook in the rasa code to figure out what it is checking
Hi @j.mosig, that’s great, thanks for the heads-up! We got super excited to see it pops-up in the changelogs (I’m monitoring it not to miss any update!)
We’ll be trying it out in the next days, this should cleanup quite a bit of our hacks
Thanks, @erohmensing, This is good but we won’t get the actual user response right? In my case, I want to trigger the intent to extract some entities and store that in DB.
@sanketchavan08 what is your use case? Do you just want to parse the user message to get the intent name and entities but you don’t care about the actual conversation? If so, you can use the parse endpoint: {{protocole}}://{{url}}/model/parse which will just do the NLU pipeline on the message you pass to it.
See: Rasa Open Source Documentation
There used to be an action trigger endpoint, but we removed (or deprecated) it because using it breaks your stories (they become un-learnable as Rasa cannot know when an external action might be triggered).
If you use Rasa 1.x, you can use the Mapping Policy to ensure that the triggered intent is always followed by your desired action. If you use Rasa 2.x, you can write a simple rule that does the same thing, like
Thanks @j.mosig for replying to my question. I am working on the same thing right now.
I tried using both the versions:
In the previous versions error is : “There is no mapped action for the predicted intent” or “there is no memorized action”
In the new versions: “there is no applicable rule”
I set the stories or rule correctly but rasa is not able to predict next action I want and then it performs default fallback.
I tried using both the versions: In the previous versions error is : “There is no mapped action for the predicted intent” or “there is no memorized action”
In the new versions: “there is no applicable rule”
@sanketchavan08 just to be sure, did you retrain your model after adding the mapped triggers to your domain file (Rasa 1.x) or the rule (2.x)?