2
votes

Just set up a Azure Bot essentially following this tutorial https://docs.microsoft.com/en-us/azure/cognitive-services/luis/luis-nodejs-tutorial-build-bot-framework-sample and the code works fine when I test it in the online web chat - intent is recognised and the bot responds.

However, when I try to run the same code copied down and set up as a local git repository through Visual Studio Community 2017, the bot doesn't seem to reply.

I'm not hitting any errors right now when I send the bot a message through the emulator (chatconnector registers it as message received).

Any ideas on how to fix this?

http://i1376.photobucket.com/albums/ah21/michael_liang1/stack%20overflow_zpsrvsazqvt.png

(don't have enough reputation to post images yet - sorry!)

2

2 Answers

1
votes

It's possible that you didn't configure the LuisAppId, LuisAPIKey and LuisAPIHostName in the .env file when you copy the code into the local VS.

In portal, it will automatically get these keys from app settings, but on local side, we need to configure them in our code.

According to the tutorial, the LuisAppId, LuisAPIKey and LuisAPIHostName should be configured in .env, for example like this:

# Bot Framework Variables
MICROSOFT_APP_ID=<YOURAPPID>
MICROSOFT_APP_PASSWORD=<YOURAPPPASSWORD>


LuisAppId=<YOURLUISAPPID>
LuisAPIKey=<YOURLUISKEY>
LuisAPIHostName=<YOURAPIHOSTNAME>

Then the code in toturial uses these three parameters to generate a LuisModelUrl, you can actually directly configure this url which is generated after you publish your luis app, into your .env file. For more information, you can refer to the official LUIS Bot Sample.

1
votes

Solved the issue. It seems you need to add parameters into the AzureTableClient method of botbuilder SDK to include the name and key of an existing storage account hosted in Azure.

var tableName = 'botdata';
var azureTableClient = new botbuilder_azure.AzureTableClient(tableName, process.env.AzureTableName, process.env.AzureTableKey); //process.env['AzureWebJobsStorage']
var tableStorage = new botbuilder_azure.AzureBotStorage({ gzipData: false }, azureTableClient);

I added process.env.AzureTableName and process.env.AzureTableKey which is the name and access key for the Azure Storage Account I created. The variables key and name are specified in my .env file.