Rasa: Facebook Quick replies doens't work

Created on 25 May 2019  路  8Comments  路  Source: RasaHQ/rasa

Rasa version: 1.0.0

Python version: 3.7.0

Operating system (windows, osx, ...):Ubuntu Linux

Issue: I get the following error When adding Quick replies for messenger :

Traceback (most recent call last):
  File "/home/rogers/paysikabot/lib/python3.7/site-packages/rasa/core/channels/facebook.py", line 94, in _handle_user_message
    await self.on_new_message(user_msg)
  File "/home/rogers/paysikabot/lib/python3.7/site-packages/rasa/core/channels/channel.py", line 68, in handler
    await app.agent.handle_message(*args, **kwargs)
  File "/home/rogers/paysikabot/lib/python3.7/site-packages/rasa/core/agent.py", line 441, in handle_message
    return await processor.handle_message(message)
  File "/home/rogers/paysikabot/lib/python3.7/site-packages/rasa/core/processor.py", line 74, in handle_message
    await self._predict_and_execute_next_action(message, tracker)
  File "/home/rogers/paysikabot/lib/python3.7/site-packages/rasa/core/processor.py", line 342, in _predict_and_execute_next_action
    action, tracker, message.output_channel, self.nlg, policy, confidence
  File "/home/rogers/paysikabot/lib/python3.7/site-packages/rasa/core/processor.py", line 453, in _run_action
    await self._send_bot_messages(events, tracker, output_channel)
  File "/home/rogers/paysikabot/lib/python3.7/site-packages/rasa/core/processor.py", line 374, in _send_bot_messages
    await output_channel.send_response(tracker.sender_id, e.message())
  File "/home/rogers/paysikabot/lib/python3.7/site-packages/rasa/core/channels/channel.py", line 173, in send_response
    **message
  File "/home/rogers/paysikabot/lib/python3.7/site-packages/rasa/core/channels/facebook.py", line 181, in send_quick_replies
    self.send(recipient_id, FBText(text=text, quick_replies=quick_replies))
  File "/home/rogers/paysikabot/lib/python3.7/site-packages/rasa/core/channels/facebook.py", line 120, in send
    self.messenger_client.send(element.to_dict(), recipient_id, "RESPONSE")
  File "/home/rogers/paysikabot/lib/python3.7/site-packages/fbmessenger/elements.py", line 27, in to_dict
    d['quick_replies'] = self.quick_replies.to_dict()
AttributeError: 'list' object has no attribute 'to_dict'

The error is due to the fact that you are using elements module from _fbmessenger_ and in this element module, there is a Text class, which takes as constructor parameter, a _quick_replies_. But this _quick_replies_ must be a list of _QuickReply_ object. So you are not converting the information provide for Quick replies from the domain.yml into QuickReply Object. Kind of.

Content of configuration file (config.yml):

language: en
pipeline: supervised_embeddings   #  pretrained_embeddings_spacy

# Configuration for Rasa Core.
# https://rasa.com/docs/rasa/core/policies/
policies:
  - name: MemoizationPolicy
  - name: KerasPolicy
  - name: FormPolicy

Content of domain file (domain.yml) (if used & relevant):


type

Most helpful comment

Hey @erohmensing
Yes, regular postback buttons like with "Buttons" key work fine. The ones which bug is the persistent Menu and QuickReplies (even when tried with custom). I just do a pull request with the bug fix.

All 8 comments

Thanks for raising this issue, @erohmensing will get back to you about it soon.

Hey @RogersNtr, thanks for pointing this out. You seem like you know pretty well what's going on here, would you be interested in contributing a fix? If not, we will of course take care of fixing the bug.

Hey @RogersNtr, thanks for pointing this out. You seem like you know pretty well what's going on here, would you be interested in contributing a fix? If not, we will of course take care of fixing the bug.

Hey @erohmensing .
I fork the project and fix the bug on my side. I also add some support for PersitentMenu (using Custom from domain.yml), Which were also giving bugs and the modification that I did was in the facebook.py module. I just don't know how to submit it on your side.

Hm okay that sounds interesting! If possible it would be good to keep the bug fix PR separate from the new feature support. All you have to do is create a new PR here. Then you can pick out the branch of your fork like so (your fork on the right)
Screen Shot 2019-05-28 at 09 04 38

Hey @RogersNtr, do regular postback buttons work for you? We're also trying to get down to fixing a problem here

Hey @erohmensing
Yes, regular postback buttons like with "Buttons" key work fine. The ones which bug is the persistent Menu and QuickReplies (even when tried with custom). I just do a pull request with the bug fix.

@RogersNtr have you had a chance to submit a PR yet?

Yes @akelad I just resubmit a PR. I get some stuffs that I need to do for the certificate on my local repo; I did itand now it is pending.

Was this page helpful?
0 / 5 - 0 ratings