0
votes

I built a slack bot with rasa core and nlu and it is working fine. I can easily process user input. But when I tried the same process with facebook channel, my rasa facebook app is not responding if some user say any thing in page messenger.

My webhook is working fine.

se 'load(stream, Loader=ruamel.yaml.Loader)' explicitly if that is OK.

Alternatively include the following in your code:

import warnings warnings.simplefilter('ignore', ruamel.yaml.error.UnsafeLoaderWarning)

In most other cases you should consider using 'safe_load(stream)' data = yaml.load(stream) 127.0.0.1 - - [2018-11-16 10:52:50] "GET /webhooks/slack/webhook?hub.mode=subscribe& hub.challenge=343235800&hub.verify_token=rasa-bot HTTP/1.1" 404 342 0.005916 127.0.0.1 - - [2018-11-16 10:53:51] "GET /webhooks/facebook/webhook?hub.mode=subscribe&hub.challenge=923059630&hub.verify_token=rasa-bot HTTP/1.1" 200 124 0.001723

and here is my server script.

nlu_interpreter = RasaNLUInterpreter('./models/default/model_20181116-102101')
action_endpoint = EndpointConfig(url="http://localhost:5055/webhook")
agent = Agent.load('./models/dialogue', interpreter=nlu_interpreter, action_endpoint=action_endpoint)


credentials = yaml.load(open('./credentials.yml'))
fb_access_token = credentials['facebook']['verify']
fb_secret = credentials['facebook']['secret']
fb_verify = credentials['facebook']['verify']

input_channel = FacebookInput(fb_access_token=fb_access_token,fb_secret=fb_secret,  fb_verify=fb_verify)

logLevel = "DEBUG"
logfile = "log.txt"


utils.configure_colored_logging(logLevel)
utils.configure_file_logging(logLevel, logfile)

agent.handle_channels([input_channel], 5004, serve_forever=True)

Do I have to extend import some class to process user message. Because during slack bot, it was not needed. I am using rasa core 0.11.12 and latest rasa NLU.

I am not receiving user message in my rasa server.

Any help guys.

Thanks

1

1 Answers

0
votes

Change the line

fb_access_token = credentials['facebook']['verify']

to

fb_access_token = credentials['facebook']['page-access-token']

In general I recommend using Rasa Core from the command line instead of writing custom code. For example you can instruct Core to set up Facebook as channel by providing a credentials file like

facebook:
  verify: "rasa-bot"
  secret: "1234"
  page-access-token: "3123020"

and then starting Rasa Core with:

python -m rasa_core.run -d models/dialogue \
   -u models/nlu/current \
   --credentials credentials.yml

This is also documented in the Rasa Core docs.