Please add a simple example of using send and receive or at least link to the samples, such as https://github.com/microsoft/BotBuilder-Samples/blob/master/samples/csharp_dotnetcore/01.console-echo/EchoBot.cs and https://github.com/microsoft/BotBuilder-Samples/blob/master/samples/csharp_dotnetcore/02.echo-bot/Bots/EchoBot.cs.
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
The samples that you linked to are available through the templates for each language, so users can see them there or while checking out our samples.
I'm confused though, the simple example of send and receive messages is all the linked article is about. Could you elaborate on what you'd like to see?
The bot documentation is some of MS's worst. It assumes too much and explains too little. If you started on this page, which is super basic for a bot, there are no links to the samples. I didn't know they existed at the time. So I was looking at these two single lines of code and wondering, where are they supposed to go? What's the context? After much frustration, it seems quite obvious now, but I shouldn't need to jump from docs to samples to random blogs to understand how to write a simple bot.
My Javascript example for this tutorial:
const { ActivityHandler } = require('botbuilder');
class MyBot extends ActivityHandler {
constructor(configuration){
super();
this.onMembersAdded(async (context, next) => {
const membersAdded = context.activity.membersAdded;
for (let cnt = 0; cnt < membersAdded.length; ++cnt) {
if (membersAdded[cnt].id !== context.activity.recipient.id) {
await context.sendActivity('Hello and welcome!');
}
}
// By calling next() you ensure that the next BotHandler is run.
await next();
});
this.onMessage(async (context, next) => {
//Continue to normal text response
var text = context.activity.text; //received text
if (text === 'Foo'){
await context.sendActivity('Bar');
}
else{
await next();
}
});
}
}
module.exports.MyBot = MyBot;
Added mention of the samples, where to find information on a basic bot, etc. Most users read through the first concept which provides this information, but for those who don't, this will serve as a worthwhile pointer to that content.
Update will be pushed live next week.
Most helpful comment
The bot documentation is some of MS's worst. It assumes too much and explains too little. If you started on this page, which is super basic for a bot, there are no links to the samples. I didn't know they existed at the time. So I was looking at these two single lines of code and wondering, where are they supposed to go? What's the context? After much frustration, it seems quite obvious now, but I shouldn't need to jump from docs to samples to random blogs to understand how to write a simple bot.