Error after sending a message with Facebook connector

Hello everyone,

I’m using Rasa 1.1.4.

I’m trying to set up a Facebook bot, I did all the steps including setting up SSL on the port 5007 (by doing a reverse proxy on Apache2).

However, when sending “Hi” to the bot from the Facebook Messenger, an error is shown on Rasa logs as follows:

rasa_1           | [2019-06-27 10:10:24 +0000] [1] [ERROR] Exception occurred while handling uri: ''
rasa_1           | Traceback (most recent call last):
rasa_1           |   File "/usr/local/lib/python3.6/site-packages/sanic/", line 917, in handle_request
rasa_1           |     response = await response
rasa_1           |   File "/usr/local/lib/python3.6/site-packages/rasa/core/channels/", line 319, in webhook
rasa_1           |     await messenger.handle(request.json)
rasa_1           |   File "/usr/local/lib/python3.6/site-packages/rasa/core/channels/", line 66, in handle
rasa_1           |     for message in entry["messaging"]:
rasa_1           | KeyError: 'messaging'

Does anyone have any idea what’s going on? Also it’s pretty sad that when the webhook throws an error, Facebook stops sending messages for a while so it’s really hard to debug. :frowning:

Looks like the endpoint is getting a request payload that isn’t what it expects to get from facebook. Do you have a copy of the request? Is it possible your proxy or SSL is altering the request format somehow?

1 Like

For some weird reason, it appears that using the --connector option wasn’t helping. After removing it’s working.

By the way, @erohmensing, I really need some clarification about the things we can currently send to Facebook.

I can see that some possible things we can send are the following:

      "data": {
        "elements": null,
        "quick_replies": null,
        "buttons": null,
        "attachment": null,
        "image": null,
        "custom": null

Can you please show me or link me to an example where I can see how these are used in utter_custom_json (in or how to use them in domain.yml?

I would appreciate your help very much and I think your answer will help many developers who are using Facebook channel.

Thanks in advance. :smile:

I have just ran into the same problem, and I wasn’t even using the --connector .

so basically, every time I run the facebook Handover protocol (moving the conversation from done to inbox, so agent humans can see and chat), as soon as a user or a agent human sends a message, I have the same scenario

for message in entry[“messaging”]: rasa_1 | KeyError: ‘messaging’

Hello @jusce17

I have the same problem with the handover protocol, did you find a solution?

In a custom action I made a request to the Pass Thread Control API to pass the thread to the Page Inbox. It worked the first time, but I think my mistake was returning the ConversationPaused event in my custom action. (I’m not sure)

Since then, every message from facebook causes this error (using the same test account and the same page)

And I’m using Rasa 2.8.1