I am currently developing a bot using wit.ai
. I am quite new to node.js
. Basically, I am following the guide provided by node-wit
lib. I construct my wit
object by:
const wit = new Wit({
accessToken: WIT_TOKEN,
actions,
logger: new log.Logger(log.INFO)
});
In my actions, I have something like:
const actions = {
send({sessionId}, {text}) {
//my sending action goes here.
},
firstaction({context, entities,sessionId}) {
var data = async_function();
context.receiver = data;
return context;
}
}
The issue is that whatever comes after async_function
will be executed first. I tried to let async_function
return a promise. However, this wouldn't work since whatever comes after my first action in node-wit
library will be executed first without waiting for the context to return. I don't want to modify the node-wit
library.
Any idea that would solve my issue is appreciated!