kinni/fb-bot-framework

Chain multiple messages.

Closed this issue · 2 comments

Hello! I'm trying to chain some messages. For example:

bot.sendTextMessage(userId, "Message 1...");
bot.sendTextMessage(userId, "Message 2...");

I need these messages to be sent in order. "Message 1..." and then "Message 2...".

I've tried this, but unsuccessful.

bot.sendTextMessage(userId, "Message 1...").then(() => {
    bot.sendTextMessage(userId, "Message 2...");
})

Thanks for the nice job man, bye!

Hey brenohq,

you can use the cb function

function cb() {
 bot.sendTextMessage(userId, "Message 2");
}

bot.sendTextMessage(userId, "Message 1", null, cb");

cheers,

franzus

@franzus888 Tranks bro!