Node.js - Get return value from call back function with Azure Bot Framework
I have been started to built a chatbot using node.js within Azure Bot Framework. I need to get return value from a HTTP request's response result. I was using the "normal" way of function (callback){} in node.s, but no luck to get the return result. I did a research and then found out this article " Microsoft Bot Framework Node SDK and LUIS ". Refer to this article, I finally work out the way of getting return value as below. var rp = require('request'); bot.dialog('SearchHotels', [ function (session) { var destinationUrl="XXXX"; callRemoteSite(destinationUrl, (responseString) => { session.send(responseString); }); } function searchHotels(destinationUrl, callback) { rp(destinationUrl, function(error, response, body) { var json= parseFinance(body); callback(json); }) } The advantage of above function is you can...