Microsoft Bot Framework
Create a bot API key
Each bot needs its own API key for tracking.
Create a bot to get an API key. Make sure to choose Microsoft as the platform.
NOTE: This integration only works with bot framework v4
If you are using a previous version of Microsoft Bot Framework, please see our deprecated integration here.
Install Dashbot via NPM
npm install --save dashbot
Include Dashbot
Use the API key created above.
const dashbot = require('dashbot')(process.env.DASHBOT_API_KEY).microsoft;
Use Dashbot Middleware for MS Bot Framework
const adapter = new BotFrameworkAdapter({ appId: process.env.MicrosoftAppId, appPassword: process.env.MicrosoftAppPassword });
adapter.use(dashbot.middleware());
Example
Once you install the Dashbot npm module, you can take a look at node_modules/dashbot/src/microsoft-botframework-example.js for a working example.
Integrate Dashbot with Luis to capture intents
const adapter = new BotFrameworkAdapter({
appId: process.env.MicrosoftAppId,
appPassword: process.env.MicrosoftAppPassword
});
const model = new LuisRecognizer({
appId: process.env.LuisAppId,
subscriptionKey: process.env.LuisSubscriptionKey,
serviceEndpoint: 'https://westus.api.cognitive.microsoft.com'
});
adapter.use(model);
adapter.use(dashbot.middleware(model));