
I’ve been working on a chatbot using the open-source Rasa framework. This article describes my experience using Facebook Messenger as a front-end for the chatbot.
Prior to getting Facebook Messenger set up with Rasa, I had been using the Rasa X as a GUI front-end for the chatbot. As I used Rasa X to test the chatbot I became familiar with its pros:
- Smooth integration with the rest of the Rasa stack. When I first started working with Rasa, it was simple to get Rasa Xworking to exercise a Rasa chatbot.
- Transparency to what’s happening. Rasa X displays details about what’s happening behind the scenes that really helps you to understand what your chatbot is doing, particularly as you are getting started with Rasa. In the following exchange, Rasa X shows: intents (“greet”, “condition_by_movie”), slots (“ranked_col”, “cast_name”), slot values (“movies”, “De Niro”) and actions (“action_condition_by_movie”)

- Training — you can use Rasa X to make direct changes to the training input for Rasa. I had a mixed experience with this feature and stopped using it when I got unexpected updates to the domain.yml file.
However, Rasa X has its limitations as well:
- It’s slow, in particular when Rasa X is set up with ngrok so you can serve the chatbot from your local machine
- It’s ugly. When it’s time to show your chatbot to a wider audience the utilitarian interface in Rasa X is a distraction
- No pictures. I couldn’t get images to display in Rasa X
To get around these limitations of Rasa X and to get exercise the chatbot in a real delivery channel, I decided to connect it with Facebook Messenger. The Rasa documentation on how to connect with Facebook Messenger is very minimal, so I took advantage of this article to get the rest of the details.
Even with these two sources there were a few gotchas that I have listed below in hopes that it’s useful for others who want to connect Facebook Messenger to Rasa.
First, it’s not obvious that the token required in Message settings for defining the webhook callback URL is the token from the Rasa credentials.yml file and not the application token from Facebook.

Second, the order of operation to get the whole stack going is not obvious, particularly when you need restart everything. Here’s the order that’s worked for me starting the whole stack from scratch:
- start ngrok and note the https URL returned:
ngrok http 5005

2. start Rasa with option to indicate credentials:
rasa run --credentials credentials.yml
3. in the app you added in Facebook for Developers, under Messenger Settings, select Edit Callback URL. Enter the URL from ngrok as the prefix in the Callback URL field and the verify value from the Facebook section of your Rasa credentials.yml file in the Verify Token field. Click Verify and Save.
If the above steps worked, you should see a 200 message in the ngrok terminal:

Third, one of the benefits of using Facebook Messenger as a front end is making it easy to share your chatbot. If you are developing your chatbot on your local machine you can make it available to others with Facebook Messenger more easily than with Rasa X, but there is a catch — see below.
To give another Facebook user access to your chatbot via Facebook Messenger, go to Roles in your Facebook for Developers app.

When you click on Add for the user type you want (Administrator, Developer or Tester) you can enter the user’s name or username and click Submit. However, the user shows up as Pending. The user won’t have access to your chatbot until the click on the Notification that they receive to accept the role you have given them.
Getting the Rasa chatbot working with Facebook Messenger has been well worth the effort despite the problems described in this article. I now have a stable, presentable platform for the chatbot that I can share with others directly from my laptop:
