Skip to content
2 contributors

Users who have contributed to this file

@sgellock @JasonSowers
32 lines (30 sloc) 1.4 KB
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Bot.Builder;
using Microsoft.Bot.Schema;
namespace Console_EchoBot
public class EchoBot : IBot
// Every Conversation turn for our EchoBot will call this method. In here
// the bot checks the <see cref="Activity"/> type to verify it's a <see cref="ActivityTypes.Message"/>
// message, and then echoes the user's typing back to them.
public async Task OnTurnAsync(ITurnContext turnContext, CancellationToken cancellationToken = default(CancellationToken))
// Handle Message activity type, which is the main activity type within a conversational interface
// Message activities may contain text, speech, interactive cards, and binary or unknown attachments.
// see to learn more about the message and other activity types
if (turnContext.Activity.Type == ActivityTypes.Message)
// Echo back to the user whatever they typed.
await turnContext.SendActivityAsync($"You sent '{turnContext.Activity.Text}'");
await turnContext.SendActivityAsync($"{turnContext.Activity.Type} event detected");
You can’t perform that action at this time.