Using functions with async callback
We're having a situation where we want to call a function with an async callback.
The issue that arises is that the script thread terminates before the callback is executed.
Is there any way to prevent the script thread from terminating before we get the callback?
We're intending to read a collection containing phone numbers, call Twilio Api (an sms service) to send a message, and finally store the status from Twilio into another collection.
Immensely thankfull for any kind of help, input or suggestion that can make us able to achieve this.
PS! This task is an ad-hoc task in our work flow, otherwise we would have done this as part of our application.