title: Greeting user upon opening bot
body: <p>I am a beginner with Node.JS and the Microsoft Bot Framework. I am making a chatbot, and I have figured out how to communicate with the LUIS service, but I am still having trouble with one little problem. I have tried a lot of different things, and I should note that I am using the Online App Service Editor in Azure.</p>
  
  <p>I cannot figure out how to greet the user, which I feel should be easy. By greeting, I mean send a message to the user upon them clicking the link to open dialog with my bot. I know that I should be using onMembersAdded command, but when I try to add it I always mess up something else. Here is my current code:</p>
  
  <p>bot.js</p>
  
  <pre class="lang-js prettyprint-override"><code>const { ActivityHandler } = require('botbuilder');
  const { BotFrameworkAdapter } = require('botbuilder');
  const { LuisRecognizer } = require('botbuilder-ai');
  
  class LuisBot {
      constructor(application, luisPredictionOptions) {
          this.luisRecognizer = new LuisRecognizer(application, luisPredictionOptions, true);
          }   
      async onTurn(turnContext) {
          // Make API call to LUIS with turnContext (containing user message)
          try {
              const results = await this.luisRecognizer.recognize(turnContext);
  
              //console.log(results);
              // Extract top intent from results
              const topIntent = results.luisResult.topScoringIntent;
              switch (topIntent.intent) {
                      case 'Greeting':
                      await turnContext.sendActivity('Hello!');
  break;          
                      default:
                      await turnContext.sendActivity('Oops, looks like something went wrong');
              }
          } catch (error) {
          }
      }
  }
  module.exports.LuisBot = LuisBot;
  </code></pre>
  
  <p>index.js</p>
  
  <pre class="lang-js prettyprint-override"><code>const dotenv = require('dotenv');
  const path = require('path');
  const restify = require('restify');
  
  // Import required bot services.
  // See https://aka.ms/bot-services to learn more about the different parts of a bot.
  const { BotFrameworkAdapter } = require('botbuilder');
  
  // This bot's main dialog.
  // const { EchoBot } = require('./bot');
  const { LuisBot } = require('./bot');
  
  // Import required bot configuration.
  const ENV_FILE = path.join(__dirname, '.env');
  dotenv.config({ path: ENV_FILE });
  
  // Create HTTP server
  const server = restify.createServer();
  server.listen(process.env.port || process.env.PORT || 3978, () =&gt; {
      console.log(`\n${ server.name } listening to ${ server.url }`);
      console.log(`\nGet Bot Framework Emulator: https://aka.ms/botframework-emulator`);
      console.log(`\nTo talk to your bot, open the emulator select "Open Bot"`);
  });
  
  // Create adapter.
  const adapter = new BotFrameworkAdapter({
      appId: process.env.MicrosoftAppId,
      appPassword: process.env.MicrosoftAppPassword,
      channelService: process.env.ChannelService,
      openIdMetadata: process.env.BotOpenIdMetadata
  });
  
  const luisApplication = {
      applicationId: process.env.LuisAppId,
      endpointKey: process.env.LuisAuthoringKey,
      azureRegion: process.env.LuisAzureRegion
  };
  const luisPredictionOptions = {
      includeAllIntents: true,
      log: true,
      staging: false
  };
  
  // Catch-all for errors.
  adapter.onTurnError = async (context, error) =&gt; {
      // This check writes out errors to console log .vs. app insights.
      console.error(`\n [onTurnError]: ${ error }`);
      // Send a message to the user
      await context.sendActivity(`Oops. Something went wrong!`);
  };
  
  // Create the main dialog.
  // const bot = new EchoBot();
  // Create the main dialog.
  const bot = new LuisBot(luisApplication, luisPredictionOptions);
  
  // Listen for incoming requests.
  server.post('/api/messages', (req, res) =&gt; {
      // console.log(process.env.LuisAppId);
      adapter.processActivity(req, res, async (context) =&gt; {
          // Route to main dialog.
          // console.log(process.env.LuisAppId);
          await bot.onTurn(context);
      });
  });
  
  </code></pre>
  
  <p>I am obviously new to this and I apologize if this is a bad question, but I have tried everything.</p>