How to handle Facebook chatbot multiple back to back messages?

211
September 10, 2017, at 07:09 AM

In my Facebook chatbot, i respond to a user message with multiple replies. One is a text and another is a button template. When the user sends the same message twice in a row my replies are intermingled. As follows:

User: messageA user: messageB

ChatBot: text reply to A ChatBot: text reply to B ChatBot button template reply to A ChatBot button template reply to B

I tried building a sender message Q and store messageB for later until messageA is fully responded to. The strange thing is that when messageB is received the messageQueue is empty even though messageA has not be fully responded to and the messagae has not be removed from the "global recipient" queue.

The short version of my question is: how to handle multiple back to back messages? The twist is that messageA starts a conversation so when messageB arrives, I need to pocket it until messageA conversation is over with.

(stack: Javascript, Note.js, Heroku, mongodb, Facebook API)

READ ALSO
angular html5 mode with nodeJS

angular html5 mode with nodeJS

I have my NodeJS application running on port 11000 and AnularJS running on port 9000

311
How to prepare array from a json in node js

How to prepare array from a json in node js

I have a string like below,

226
Nodejs - npm install permanently freezes

Nodejs - npm install permanently freezes

After nodejs installation, I tried to install angular-cli , but it stuck on the load stage:

387
Can you protect your app/code against copyright and intellectual property rights [on hold]

Can you protect your app/code against copyright and intellectual property rights [on hold]

I'm making app with nodejs and let users use with paid plan

176