This framework allows building intelligent bots for user interactions. Analyzing bot conversations and user queries can provide insights into user needs, improving bot responsiveness and user engagement.

Welcome to the Microsoft Bot Framework documentation for Dimension! Integrating Dimension into your chatbot, web bot, SMS bot, voice application, or other conversational interface, is quick and easy.

If you have any questions, comments, or suggestions, please feel free to contact us.

Bot Framework v4

Welcome to the Bot Framework Documentation for Dimension!

If you have any questions, comments, or suggestions, please feel free to contact us.

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 Dimension via NPM

npm install --save dimensionlabs

Include Dimension

Use the API key created above.

const dimension = require('dimension')(process.env.Dimension_API_KEY).microsoft;

Use Dimension Middleware for MS Bot Framework

const adapter = new BotFrameworkAdapter({
    appId: process.env.MicrosoftAppId,
    appPassword: process.env.MicrosoftAppPassword
});

adapter.use(dimension.middleware());

Example

Once you install the Dimension Labs npm module, you can take a look at node_modules/dimension/src/microsoft-botframework-example.js for a working example.

Integrate Dimension 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(dimension.middleware(model));

Bot Framework v3 [Deprecated]

This is the documentation for Microsoft Bot Framework v3.
We recommend you use v4 if possible.

Install Dimension via NPM

npm install --save dimensionlabs

Include Dimension

Since MS Bot Framework allows you to deploy the same bot to multiple platforms, you should configure it using all of the API Keys that you created above.

If you are using this integration, do NOT choose “microsoft” for your platform when you create your bot on Dimension.

For Facebook bots, we need your Facebook Page Token to be set too.

const dimensionApiMap = {
  universal: process.env.DIMENSION_API_KEY_UNIVERSAL, 
  facebook: process.env.DIMENSION_API_KEY_FACEBOOK, 
  slack: process.env.DIMENSION_API_KEY_SLACK, 
  kik: process.env.DIMENSION_API_KEY_KIK, 
  webchat: process.env.DAIMENSION_API_KEY_UNIVERSAL, 
  skype: process.env.DIMENSION_API_KEY_UNIVERSAL
}
const dimension = require('dimension')(dimensionApiMap).microsoftDeprecated;

Include the following line only if supporting a Facebook bot

dimension.setFacebookToken(process.env.FACEBOOK_PAGE_TOKEN)

Use Dimension Middleware for MS Bot Framework

bot.use(dimension);