Rasa: facebook connector on py36 not working

Created on 8 Nov 2017  路  13Comments  路  Source: RasaHQ/rasa

Rasa Core version (e.g. 0.7.3):
0.7.3

Operating system (windows, osx, ...):
ubuntu 16.04
anaconda python 3.6

Issue:
trying to hook up with Messenger, in verifying webhook got strange stuff showing up on the terminal

following the tutorial: https://core.rasa.ai/tutorial_basics.html#bonus-handle-messages-from-facebook

code ran:

python -m rasa_core.run -d models/dialogue -u models/nlu/current --port 5002 --connector facebook --credentials credentials.yml

result when configuring webhook on facbeook app:

INFO:root:Finished loading agent, starting input channel & server.
<gevent._socket3.socket object, fd=8, family=2, type=2049, proto=0>: Invalid http version: '\x16\x03\x01\x00矛\x01\x00\x00猫\x03\x03z脣,\x01脦Z\x13\x8ay\x1b卢茅酶芦脢茅WsYt脨猫\rY{C\x96陇\x12i\x87\x0f\x00\x00&脌/脌+脌\x13脌\t脌0脌,脌\x14脌\n'
Y{C聳陇i聡&脌/脌+脌脌- 脌0脌,脌脌" 400 - 0.000157] "矛猫z脣,脦Z聤ysYt脨猫
<gevent._socket3.socket object, fd=8, family=2, type=2049, proto=0>: Expected GET method: '\x16\x03\x01\x00矛\x01\x00\x00猫\x03\x03\x96p每\x97陋\x91脜脙h/毛-\x03氓赂3t脧G\x97s=~陋\x91/S\x04脡\x18I\x08\x00\x00&脌/脌+脌\x13脌\t脌0脌,脌\x14脌\n'
[ip] - - [2017-11-08 13:35:28] "矛猫聳p每聴陋聭脜脙h/毛-氓赂3t脧G聴s=~陋聭/S脡&脌/脌+脌脌  脌0脌,脌脌" 400 - 0.039399

Content of domain file (if used & relevant):


Most helpful comment

@yipcma sounds reasonable, mind adding a line or two to https://github.com/RasaHQ/rasa_core/blob/master/docs/tutorial_basics.rst#bonus-handle-messages-from-facebook ?

You mean a version that can properly handle unicode? Not sure there is a version of pymessenger that does that, might make sense to use a different facebook python libraray.

All 13 comments

You need to use tunneling concept to connect your bot to facebook. You can use ngrok tool to do so.....

@Deep-09 a code-sample that would work with the tutorial would be much appreciated.

The issue is not ngrok, I finally realize the authentication should run under /webhook.

@yipcma is there anything in the docs we can improve?

same issue on python 3.6... issues strictly with the unicode and parsing with pymessenger

@tmbo somehow i didn't get the format of the webhook, could be helpful to have it stated under the facebook connector section in the simple bot tutorial.

On pymessenger, any chance to bundle with a working version in rasa_core?

@yipcma sounds reasonable, mind adding a line or two to https://github.com/RasaHQ/rasa_core/blob/master/docs/tutorial_basics.rst#bonus-handle-messages-from-facebook ?

You mean a version that can properly handle unicode? Not sure there is a version of pymessenger that does that, might make sense to use a different facebook python libraray.

@tmbo not being able to even complete the tutorial is a bit frustrating... look forward to updates about the use of a different fb python library.

@yipcma you can try to complete the tutorial using basic terminal

there is an issue with facebook connector if you use python 3.6
everything working fine when I use python 2.7, because rasa_core requires Flask 0.12, which has unicode method, and it's not compatible with python 3.6

I think we should put that this awesome library uses python 2.7 in the README.md

I mean we test on 3.6 and I want this to move into the 3.x direction and abandon 2.x as soon as possible. The issue is with the facebook api library which hasn't been updated for ages and didn't accept (or even comment) on a PR I created half a year ago which fixes unicode issues.

https://github.com/rehabstudio/fbmessenger seems like an option to move away from pymessenger.

So this package would work as a workaround?

https://github.com/mukesh-mehta/Pymessenger-modified

I haven't used it but might work, yes.

We moved to fbmessenger so this shouldn't be an issue anymore

Was this page helpful?
0 / 5 - 0 ratings