title: Node.js: How to send a direct message in Slack with MS Bot Framework?
body: <p>I am trying to create a Slack bot using LUIS where when the bot sees a greeting in a channel it is added to, it sends a direct message to the user that sent the greeting. </p>
  
  <p>I have looked at Issue <a href="https://github.com/Microsoft/BotBuilder/issues/431" rel="nofollow noreferrer">#431</a> and wrote a bot. Here is my code:</p>
  
  <pre><code>var builder = require('botbuilder');
  var restify = require('restify');
  // Setup Restify Server
  var server = restify.createServer();
  server.listen(process.env.port || process.env.PORT || 3978, function () {
      console.log("%s listening to %s", server.name, server.url);
  });
  server.get(/.*/, restify.serveStatic({
      'directory': '.',
      'default': 'index.html'
  }));
  
  // Create Chat Bot
  var connector = new builder.ChatConnector({
      appId: process.env.MICROSOFT_APP_ID,
      appPassword: process.env.MICROSOFT_APP_PASSWORD
  });
  var bot = new builder.UniversalBot(connector, {
      persistConversationData: true // need persistent data for dictionary
  });
  server.post('/api/messages', connector.listen());
  
  // Create LUIS recognizer that points at our model and add it as the root '/' dialog
  var model = (omitted);
  var recognizer = new builder.LuisRecognizer(model);
  var dialog = new builder.IntentDialog({ recognizers: [recognizer] });
  bot.dialog('/', dialog);
  
  // Add intent handlers
  dialog.matches('Greeting', [
      function(session, args, next) {
          var language = builder.EntityRecognizer.findEntity(args.entities, 'Language');
          next({ response: language });
      },
      function(session, results) {
  
          bot.beginDialog({
              text: 'Hello',
              to: {channelId: "emulator", address:"User1", id:"(omitted)", isBot:false},
              from: { channelId:"emulator", address:"Bot1", id:"(omitted)", isBot:true}
          }, '/');
      }
  ]);
  </code></pre>
  
  <p>However, currently when the bot receives a greeting, it gives the following error message:</p>
  
  <pre><code>ERROR: ChatConnector: startConversation - address is invalid.
  Error: Invalid address.
      at ChatConnector.startConversation (C:\..\node_modules\botbuilder\lib\bots\ChatConnector.js:173:18)
      at C:\..\node_modules\botbuilder\lib\bots\UniversalBot.js:308:27
      at UniversalBot.tryCatch (C:\..\node_modules\botbuilder\lib\bots\UniversalBot.js:381:13)
      at UniversalBot.ensureConversation (C:\..\node_modules\botbuilder\lib\bots\UniversalBot.js:302:14)
      at C:\..\node_modules\botbuilder\lib\bots\UniversalBot.js:163:19
      at C:\..\node_modules\botbuilder\lib\bots\UniversalBot.js:337:53
      at UniversalBot.tryCatch (C:\..\node_modules\botbuilder\lib\bots\UniversalBot.js:381:13)
      at C:\..\node_modules\botbuilder\lib\bots\UniversalBot.js:337:23
      at UniversalBot.tryCatch (C:\..\node_modules\botbuilder\lib\bots\UniversalBot.js:381:13)
      at UniversalBot.lookupUser (C:\..\node_modules\botbuilder\lib\bots\UniversalBot.js:324:14)
  </code></pre>
  
  <p>(I've omitted part of directory)</p>
  
  <p>I have looked at Issue <a href="https://github.com/Microsoft/BotBuilder/issues/687" rel="nofollow noreferrer">#687</a> but still I couldn't figure out the problem. How can I make the bot work?</p>
  
  <p>I am using Botbuilder v3.4.4 and Node v4.6.0.</p>