I have an issue when trying to send 2 consecutive messages via nodejs teilio
My sendMessage
function looks like this
client.messages.create({
body: msg,
to: toNumber,
from: keys.TWILIO_PHONE_NUMBER,
})
.then(async (message) => {
res.send("Ok, good job");
});
And I am using it like this
sendChatMessage(
"Message body to send",
req.body.From,
res
);
And then
sendChatMessage(
"Follow up message body to send",
req.body.From,
res
);
However the follow up message arrives before the first message I tried putting the 2nd message in a timeout for a few seconds but it doesn't feel like the right solution.