Unable to connect rasa to facebook messenger

I follow the instructions given in Rasa Docs to connect to Facebook.

But when i click “Add Callback URL” and provide this Callback URL "https://0.0.0.0:5002/webhooks/facebook/webhook " and provide a verify token.

Then it shows me the error “The URL couldn’t be validated. Please try again.”

And in terminal where rasa is running it shows this error when i click verify and save button:

Traceback (most recent call last):

File “/usr/local/lib/python3.6/dist-packages/sanic/server.py”, line 267, in data_received self.parser.feed_data(data)

File “httptools/parser/parser.pyx”, line 193, in httptools.parser.parser.HttpParser.feed_data httptools.parser.errors.HttpParserInvalidMethodError: invalid HTTP method

Note: 0.0.0.0 is my server IP

How i can solve this problem, Please help

Hi @PureLogics, in order to expose your IP to HTTP traffic from elsewhere on the internet, you will have to use a service like ngrok. This will open the port 5002 up to some ngrok url that you can include as your callback url.

Thanks @erohmensing :slight_smile: it is solved by using ngrok.

Glad you got it working!

1 Like

@erohmensing when i run rasa shell or rasa run command, it did not create any file to store conversation but when i run rasa x it creates two files events.db and rasa.db. please tell where i can find the conversation between user and bot

By default, rasa run connects to the InMemoryTrackerStore, which is cleared when you shut down the server. If you want to persist those conversations, you should connect to a different tracker store (e.g. the sqlite one that created rasa.db)

That’s great and i understand but inside rasa.db and table named events is created and conversation is stored in that table. How can i get clean conversation from that table?

What do you mean by clean conversation? You would have to do some sql to query the tables. Otherwise I would open them in rasa x since the querying there is already done for you.

clean conversation mean how user and bot’s conversation goes through in a manner… But in DB it creates 4 to 5 lines for one user message in which that extracts entities, buttons etc. like shown in screenshot but i only want the user messages and bot’s replies.

There’s not an easy way to do this directly from the conversation store without creating your own queries. This is specifically what Rasa X is for :slight_smile:

Ooh. Ok thanks :slight_smile:

@erohmensing another problem is that my custom action is not working.

This is the endpoints.yml:

action_endpoint:
    url: "http://localhost:5055/webhook"

and this is my custom action:

from rasa_sdk import Action

class ActionUserOrder(Action):
    def name(self):
        return "action_user_order"

    def run(self, dispatcher, tracker, domain):
        s_id = tracker.sender_id
        dispatcher.utter_message('hello there!' + str(s_id))
        return []

I also added custom action in domain.yml actions and in stories too. and also running action server using this command:

rasa run actions

And i’m using rasa shell and running this command:

rasa shell --endpoints endpoints.yml

But custom action is not working. please help

Did you look for any errors in terminal window where you ran rasa run actions?

No there is no any error

How is it not working then? What is happening?

I’m using that action in out_of_scope story like this:

## fallback story
  • out_of_scope
    • action_default_fallback
    • action_user_order

this calls action_default_fallback but not action_user_order.

That’s because action_default_fallback will revert events by default. You can overwrite the default action to do both events.

but in other stories its not working too :frowning:

sounds like you should create a very simple test story, e.g. greet -> action_user_order and then debug using rasa shell --debug.

i run rasa shell --debug but No any error occurs