Integrating VSTS with different communication channels (Slack, Skype etc) using BotFramework and LUIS

Early last year (Jan 2016), a few months before the Microsoft Bot Framework had released I had written the post Why integrate Visual Studio Team Services(VSTS) with Slack? How do I customize VSTS / Slack integrations? . There were a couple of major drawbacks with this bot :

  • The bot relied on pattern matching for intent detection. Which means if the exact pattern was not found the intent would be missed
  • The bot was utilized the node-slack-client library and only connected to the slack channel. If I wanted to connect the bot to a different channel like skype I would need to use channel specific connectors to connect the bot, which would mean more work

Let us Look at how the Microsoft Bot Framework, and Language Understanding and Intelligence Service (LUIS) mitigate these issues. The github repository for this solution is

Let us look a the key differences in this solution :

  • The file vsts-bot-LUIS-model.json is the LUIS Model to recognize intents and entities associated with this application. This model can be imported when creating your application at . In the old version of the application patterns like "/task #(\d{1,9})(.*)/i" (view task/issue pattern) were used to identify user intents. In this version LUIS identify intents based on the training utterances shown in the LUIS model JSON file
  • Since This version of the application is built using the Microsoft Bot Framework, after we have built our bot we can separately enable the bot on the several supported channels including slack, skype, facebook messenger etc
  • Interaction with VSTS is similar to the earlier version of the bot except the fact that earlier version of code was in coffeescript, and this one is in javascript
  • The main entry point of this solution is the app.js file. The key lines of code are shown below :

    var builder = require('botbuilder');
    var restify = require('restify');
    var request = require('request');

    builder represents the Microsoft Botframework nodejs SDK which has abstractions for communicating with the Bot Connector (which connects bot to various channels) and also abstractions to communicate with LUIS to get the intents and associated entities. restify is used to expose a REST endpoint which the bot connector can use to communicate with our bot. request library will be used to make call to the VSTS REST endpoints.

    // Bind to REST endpoint where the Bot Connector will communicate with our bot
    var server = restify.createServer();
    server.listen(process.env.port || process.env.PORT || 4141, function () {
    console.log('%s listening to %s',, server.url);
    // Create chat bot which can be linked to various channels like slack and skype
    var connector = new builder.ChatConnector({
    appId: process.env.MICROSOFT_APP_ID,
    appPassword: process.env.MICROSOFT_APP_PASSWORD
    var bot = new builder.UniversalBot(connector);'/api/messages', connector.listen());
    // Initialize the LUIS intent recognizer
    // This Url can be obtained by uploading or creating your model from the LUIS portal:
    const LuisModelUrl = process.env.LUIS_MODEL_URL;
    // Main dialog with LUIS
    var recognizer = new builder.LuisRecognizer(LuisModelUrl);
    var intents = new builder.IntentDialog({ recognizers: [recognizer] })
    // If User greeted the bot, i.e. LUIS identified the intent as greeting the send message to user
    .matches('greeting', (session, args) => {
    session.send('Hi There');
    // Similar code for other intents
    // Simlarly match next set of events and perform actions

  • This version of the bot acts on an additional intent "userfacingissue". When user confirms this intent the bot creates an issue in VSTS

Thanks for reading my blog. I hope you liked it. Please feel free to write your comments and views about the same over here or at @manisbindra.

Comments (0)

Skip to main content