Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Facebook Quick replies doens't work #3590

Closed
RogersNtr opened this issue May 25, 2019 · 8 comments · Fixed by #3791
Closed

Facebook Quick replies doens't work #3590

RogersNtr opened this issue May 25, 2019 · 8 comments · Fixed by #3791
Labels
type:bug 🐛 Inconsistencies or issues which will cause an issue or problem for users or implementors.

Comments

@RogersNtr
Copy link

RogersNtr commented May 25, 2019

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):

@akelad
Copy link
Contributor

akelad commented May 27, 2019

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

@tmbo tmbo added the type:bug 🐛 Inconsistencies or issues which will cause an issue or problem for users or implementors. label May 27, 2019
@erohmensing
Copy link
Contributor

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.

@RogersNtr
Copy link
Author

RogersNtr commented May 27, 2019

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.

@erohmensing
Copy link
Contributor

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

@erohmensing
Copy link
Contributor

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

@RogersNtr
Copy link
Author

RogersNtr commented May 30, 2019

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.

@akelad
Copy link
Contributor

akelad commented Jun 3, 2019

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

@akelad akelad added the status:more-details-needed Waiting for the user to provide more details / stacktraces / answer a question label Jun 3, 2019
@RogersNtr
Copy link
Author

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.

@no-response no-response bot removed the status:more-details-needed Waiting for the user to provide more details / stacktraces / answer a question label Jun 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug 🐛 Inconsistencies or issues which will cause an issue or problem for users or implementors.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants