Bot Framework v4 LUIS with AppInsights bot sample
This sample shows how to create a bot that uses Language Understanding (LUIS) with Application Insights to get telemetry around bot and your LUIS application's performance.
LUIS enables you to build, train and publish a simple question and answer bot based on FAQ URLs, structured documents or editorial content in minutes.
The Application Insights enables you to discover actionable insights through application performance management and instant analytics.
In this sample, we demonstrate how to call LUIS to extract the intents from a user's message and use Application Insights to gather user-bot interaction telemetry.
- [Node.js][4] version 8.5 or higher
# determine node version node --version
- Set up LUIS
-
Navigate to LUIS portal.
-
Click the
Sign in
button. -
Click on
My Apps
. -
Click on the
Import new app
button. -
Click on the
Choose File
and select reminders.json from thebotbuilder-samples/samples/javascript_nodejs/21.luis-with-appinsights/cognitiveModels
folder. -
Update luis-with-appinsights.bot file with your AppId, SubscriptionKey, Region and Version. You can find this information under "Publish" tab for your LUIS application at LUIS portal. For example, for https://westus.api.cognitive.microsoft.com/luis/v2.0/apps/XXXXXXXXXXXXX?subscription-key=YYYYYYYYYYYY&verbose=true&timezoneOffset=0&q=
- AppId = XXXXXXXXXXXXX
- SubscriptionKey = YYYYYYYYYYYY
- Region = westus
The Version is listed on the page.
-
Update luis-with-appinsights.bot file with your Authoring Key. You can find this under your user settings at luis.ai. Click on your name in the upper right hand corner of the portal, and click on the "Settings" menu option. NOTE: Once you publish your app on LUIS portal for the first time, it takes some time for the endpoint to become available, about 5 minutes of wait should be sufficient.
-
- Setup Application Insights
- Follow instructions here to set up your Application Insights service.
- Clone the repository
git clone https://github.com/microsoft/botbuilder-samples.git
- In a terminal, navigate to
samples/javascript_nodejs/21.luis-with-appinsights
cd samples/javascript_nodejs/21.luis-with-appinsights
- Install modules
npm install
- Start the bot
npm start
Microsoft Bot Framework Emulator is a desktop application that allows bot developers to test and debug their bots on localhost or running remotely through a tunnel.
- Install the Bot Framework emulator from here
- Launch Bot Framework Emulator
- File -> Open Bot Configuration and navigate to
samples/javascript_nodejs/21.luis-with-appinsights
- Select
luis-with-appinsights.bot
file
Language Understanding service (LUIS) allows your application to understand what a person wants in their own words. LUIS uses machine learning to allow developers to build applications that can receive user input in natural language and extract meaning from it.
- (Optional) Install the LUDown here to help describe language understanding components for your bot.
npm i -g ludown
You can use the MSBot Bot Builder CLI tool to clone and configure any services this sample depends on.
To clone this bot, run
msbot clone services -f deploymentScripts/msbotClone -n <BOT-NAME> -l <Azure-location> --subscriptionId <Azure-subscription-id> --appId <YOUR APP ID> --appSecret <YOUR APP SECRET PASSWORD>
NOTE: You can obtain your appId
and appSecret
at the Microsoft's Application Registration Portal