This sample creates an echo bot that welcomes user when they join the conversation. The welcoming pattern shown in this bot is applicable for personal (1:1) conversation with bots.
- Clone the repository
git clone https://github.com/Microsoft/botbuilder-samples.git
- [Optional] Update the
appsettings.json
file underbotbuilder-samples/samples/csharp_dotnetcore/WelcomeUser.csproj
with your botFileSecret. For Azure Bot Service bots, you can find the botFileSecret under application settings.
- Navigate to the samples folder (
botbuilder-samples/samples/csharp_dotnetcore/03.welcome-user
) and open WelcomeUser.csproj in Visual Studio - Hit F5
- Open
botbuilder-samples/samples/csharp_dotnetcore/03.welcome-user
folder - Bring up a terminal, navigate to botbuilder-samples/samples/csharp_dotnetcore/03.welcome-user
- Type 'dotnet run'.
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
Launch Bot Framework Emulator File -> Open Bot Configuration and navigate to botbuilder-samples/samples/csharp_dotnetcore/03.welcome-user folder Select BotConfiguration.bot file
The ConversationUpdate an Activity type 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 recomended that you test your bot behaivor 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.
The Bot Framework Emulator is following stadnard Activity protocol for Activity messages sent to your bot. With that said, the emulator has unique behaivor that is useful for testing and debugging your bot. For example, pressing the Start Over
button sends a ConversationUpdate
Activity with a fresh set of identifiers (conversation, from, recipient) to which your bot may reply.
The Web Test in Azure Bot Service is where you may test your bot using the Web Chat control. When testing your bot in Azure Bot Service Web Test, your bot receives a ConversationUpdate
Activity only after the first time the user sends a message. Your bot will receive two activaties for ConversationUpdate
(one for the new user and one for the bot) and also a Message
Activity containing the utterance (text) the user sent.
In other channels such as Teams, Skype, or Slack, you can expect to receive the ConversationUpdate
just once in the lifetime of the bot for a given user, and it may arrive as soon as the user joins the channel or sent when the user first interacts with the bot.