Skip to content

Latest commit

 

History

History
 
 

03.welcome-users

This sample creates an echo bot that also welcomes user when they join the conversation. The welcoming pattern shown in this bot is applicable for personal (1:1) conversation with bots.

To try this sample

  • Clone the repository
    git clone https://github.com/Microsoft/botbuilder-samples.git
  • In a terminal,
    cd samples/javascript_nodejs/03.welcome-users
  • [Optional] Update the .env file under samples/javascript_nodejs/08.suggested-actions with your botFileSecret For Azure Bot Service bots, you can find the botFileSecret under application settings.
  • Install modules and start the bot
    npm i & npm start
    Alternatively you can also use nodemon via
    npm i & npm run watch

Testing the bot using Bot Framework Emulator V4

Microsoft Bot Framework Emulator is a desktop application that allows bot developers to test and debug their bots on localhost or running remotely through a tunnel.

  • Install the Bot Framework Emulator from here

Connect to bot using Bot Framework Emulator V4

  • Launch Bot Framework Emulator
  • File -> Open Bot Configuration and navigate to samples/javascript_nodejs/03.Welcome-Users folder
  • Select Welcome-Users.bot file

ConversationUpdate Activity Type

The ConversationUpdate Activity describes a change in conversation members, for example when a new user (and/or) a bot joins the conversation. The channel sends this activity when a user (and/or) bot joins the conversation. It is recommended that you test your bot behavior on the target channel.

Bots that are added directly by a user, are mostly personal (1:1) conversation bots. It is a best practice to send a welcome message to introduce the bot tell a bit about its functionality. To do this, ensure that your bot responds to the ConversationUpdate message. Use the membersAdded field to identify the list of channel participants (bots or users) that were added to the conversation.

Your bot may proactively send a welcome message to a personal chat the first time a user initiates a personal chat with your bot. Use UserState to persist a flag indicating first user interaction with a bot.

Deploy this bot to Azure

You can use the MSBot Bot Builder CLI tool to clone and configure any services this sample depends on.

To install all Bot Builder tools -

Ensure you have Node.js version 8.5 or higher

npm i -g msbot chatdown ludown qnamaker luis-apis botdispatch luisgen

To clone this bot, run

msbot clone services -f deploymentScripts/msbotClone -n <BOT-NAME> -l <Azure-location> --subscriptionId <Azure-subscription-id>

Further reading