Posts

Showing posts from July, 2017

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...

Registered Tags are droped by Azure Push notification hub

I have been met a strange issue that the registered Tags are dropped by Push Notification hub in some time after registered successfully in Azure. I use the installation mode to register Tags via a controller function in Mobile App back-end service. I can see those tags are added to the hub via the server explorer within Visual Studio. After few days, I run the app again and unable to receive the push notification message target to those tags anymore, and so I went to the server explorer and found those tags are gone!   After investigation, I found the issue was caused by following code: // Register the channel URI with Notification Hubs.  await App.MobileService.GetPush().RegisterAsync(channel.Uri);  As I didn't provide the template contains tags, and so the register function remove those tags from the hub. After remove above the line, the app can receive message consistently and those tags are there forever now. However, if I run above code after regi...