Closed MohitDhanjani closed 7 years ago
Hm, doesn't this part of the code doing exactly that? https://github.com/claudiajs/claudia-bot-builder/blob/master/lib/facebook/parse.js#L21-L29
The part highlighted by you is correct.
Problem is that it is never executed even if messageObject
contains a Quick Reply.
The messageObject
of a normal Text message will contain message
and message.text
fields. Which the first if
statement checks. Once the first condition is satisfied, rest are ignored.
A Quick Reply also contains the above fields as well as message.quick_reply
and message.quick_reply.payload
fields.
As both Text and Quick Reply message contains the same fields, the code never enters the Quick Reply else if
statement because the first condition is already satisfied as it contains the two fields which are same to both.
The little modification I made make sure that first condition is only executed if the message does not contain a Quick Reply, so that the actual condition block of Quick Reply gets executed instead of being ignored.
Edit
Attached is the screenshot of one of the request in my CloudWatch log stream.
It is a Quick Reply message from Facebook Messenger, which does not get parsed as postback
.
Makes sense, thanks and thanks for detailed explanation!
Thanks for the merge. And big thanks to you and your team for developing Claudia. It is making life easier for students like me to develop and deploy APIs and bots on AWS! :)
Pushed to npm in v2.9.0, release notes are here.
Thanks again :) Feel free to send PR for anything you think could be useful for Claudia and, of course, to suggest any new features.
This little modification solves the issue of quick reply not being able to parse out as postback. Even if the request contains quick reply, Claudia won't be able to parse it as a postback because the first condition is already fulfilled and it never goes till 'else-if' statement where the quick-reply is actually parsed.