Blog on using Rasa with Facebook Messenger webview

Blog containing a simple end-to-end example of enhancing the user experience with a Rasa chatbot in Facebook Messenger by incorporating webpages served in webview:

1 Like

Very cool! Thanks for sharing!

In this sample they usesd the Flask How can I use the webview with Django in rasa when I deploy the rasa chatbot into the facebook?

thank you

Hi - I have never used Django, so I can’t say for certain whether there will be any problems adapting this example to use Django instead of Flask. I can say that the Flask part of this example is really simple, and other than having to fiddle around with ngrok to get an https URL served (Webview won’t work without an https URL), there isn’t anything in the Flask solution that had to be tweaked for Webview. So, since a generic Flask solution (that is, you don’t need to worry about Webview at the Flask level) works, there is a decent chance that a generic Django solution will also work. You do need to pay attention to how you define the custom actions at the Rasa level - the custom actions definitely need to be coded with Webview in mind, as shown in the code example pointed to above - but that should not impact how you create the Django server.

I made the webview using the Flask I think django is difficult to make the webview I had another problem when I deploy it into the facebook, I used the ngrok to get the domain address with https In the facebook, they don’t recognize the IP address and http So I have to change the callback url into the https and domain when I register the callback url in the when I use the ngrok, no problem I have done it But If I turn off the ngrok, I have to change the callback url To avoid this I am going to use the subdomain instead of ngrok

http:localhost:5005-> what do I have to do to use this subdomain?

Hi - I understand the issue of having to update the URL in Facebook every time ngrok restarts. The only way I found around that was to get a paid subscription to ngrok (like PRO, described here ngrok - secure introspectable tunnels to localhost) that would allow me to have a fixed URL for localhost forwarding. With that subscription I could keep the same URL for the webhook in Facebook and not have to keep updating it.

Hello I made the webview using the Flask and ngrok the webview is appeared but the content is no How can I solve it?

Hi - I suggest that you use the console in your browser to see specifically what’s going on. There are several places where problems could occur that result in the symptom you’re seeing - webview appears with no content. There could be a problem with the content getting sent from Rasa, or there could be a problem at the Facebook layer. If you re-run your test with the browser console open and watch what’s happening there you might get a clue of what level the problem is at.