I\'m playing around with building a simple Facebook Messenger chatbot and I\'m having trouble sending messages in sequence.
In the example above, it should
Instead of adding static timeouts, I would create a queue data structure. When the bot wants to send a message, append the contents to the end of the queue. On the message post callback, check if there are any messages still in the queue and call the function again using recursion and remove from the queue accordingly.