Closed cesars closed 6 years ago
send your next message on the first one callback like this :
botly.sendText({
id: senderId,
text: "Hello"
}, (err, data) => {
botly.sendText({
id: senderId,
text: "How are you ?"
})
})
or you can do a timeout :)
well, if i need send ten messages? ten callbacks is very inefficient. Any idea?
I would do a loop at least if it's only messages ^^' Or like is said, set timeout to be sure that messages will be send one after one but 10 messages is a lot anyway :s The problem is that nodejs is asynchronous so if you are not setting next messages with timeout or on callbacks of first ones, it will send all your messages randomly when he can send it. At least in cb, he is waiting for facebook reception to send the other part :/
Hi @cesars, Botly is aimed to be a very simple SDK, following the FB API. Since the API does not provide an ability to send multiple messages, Botly doesn't provide it as well.
In order to send multiple messages when there are a lot of callbacks involved, I recommend using async to solve the problem.
Is possible reply with multiple messages using Bolty? some code example?