Articles → MICROSOFT BOT FRAMEWORK → Prompt Dialog In Microsoft Bot Framework

Prompt Dialog In Microsoft Bot Framework



  1. Create a new class "PromptDemo".
  2. Inherit it with the "IDialog" interface.
  3. Implement the "StartASync" method and enter the welcome message.
  4. Create a method "GetNameAsync" to get the name from the user.
  5. Create a call back method "ResumeGetName".

using Microsoft.Bot.Builder.Dialogs;
using Microsoft.Bot.Connector;
using System;
using System.Threading.Tasks;

namespace Bot_Application1.Dialogs { [Serializable]
	public class PromptDemo: IDialog < object > {
		public async Task StartAsync(IDialogContext context) {
			await context.PostAsync("Welcome to");

		private Task GetNameAsync(IDialogContext context, IAwaitable < IMessageActivity > activity) {
			context: context, resume: ResumeGetName, prompt: "Please enter your name", retry: "Please enter the name again");

			return Task.CompletedTask;

		private async Task ResumeGetName(IDialogContext context, IAwaitable < string > result) {
			string name = await result;
			await context.PostAsync($ "Thank you {name}");


Picture showing the output of prompt dialog in Microsoft bot framework
Click to Enlarge

Posted By  -  Karan Gupta
Posted On  -  Monday, October 12, 2020


Your Email Id  
Query/FeedbackCharacters remaining 250