I want to send a series of messages through a Messenger bot with some time in between and show the typing effect. Currently I have this code:
sendTextMessage(recipientId, `Howdy ${snapshot.child("userDetails/firstName").val()}! Iām Marco :)`)
sendSenderAction(recipientId, "typing_on")
setTimeout(()=>sendTextMessage(recipientId, "Botting Marco."),1000)
sendSenderAction(recipientId, "typing_on")
setTimeout(()=>sendTextMessage(recipientId, "Let me show you some of my recent work. This is the first portfolio bot ever. (afaik) :p"),5000)
sendSenderAction(recipientId, "typing_on")
setTimeout(()=>sendTextMessage(recipientId, "How many minutes do you have?"),7000)
userRef.update({stage:1, class:1, awaiting: true})
However, the typing effect doesn't appear for some reasons. Do I need to use Promises to make sure each line is executed when the previous is finishes? Can you show me an example?