public async Task StartAsync(IDialogContext context) { if (context == null) { throw new ArgumentNullException(nameof(context)); } if (await ConversationHelpers.RelayMessageToAgentIfThereIsAnOpenResearchProject(context)) { // end the context context.Done<object>(null); } else { await context.PostWithRetryAsync("Hi, this is EIBot. I can help with many todos. For instance, booking an appointment. " + "Lets start with what do you need?"); context.Wait(MessageReceivedAsync); } }
public async Task StartAsync(IDialogContext context) { if (context == null) { throw new ArgumentNullException(nameof(context)); } if (await ConversationHelpers.RelayMessageToAgentIfThereIsAnOpenResearchProject(context)) { // end the context context.Done <object>(null); } else { await context.PostWithRetryAsync("Sorry, I am not following you."); context.Call(new UserHelpDialog(), EndHelpDialog); } }
public async Task StartAsync(IDialogContext context) { if (context == null) { throw new ArgumentNullException(nameof(context)); } _isSms = context.Activity.ChannelId == ActivityHelper.SmsChannelId; _minHoursToCompleteResearch = Convert.ToInt32(ConfigurationManager.AppSettings["ResearchProjectViaTeamsMinHours"]); if (await ConversationHelpers.RelayMessageToAgentIfThereIsAnOpenResearchProject(context)) { context.Done <object>(null); } else { // check we know alias associated with this phone number UserTable userTable = new UserTable(); var botUsers = await userTable.GetUserByChannelSpecificId(context.Activity.ChannelId, context.Activity.From.Id); if (botUsers.Length == 0) { context.Call(new PromptText( "Hi, I’m here to help you get started. \n\n" + "When we're done, I'll email you a research report with the info you want.\n\n" + "What's your Microsoft alias?", $"Please try again. Alias needs to be at least {MinAliasCharLength} characters long.", "Sorry, I didn't get that. too many attempts. Please try again later.", 2, MinAliasCharLength), OnAliasReceivedAsync); } else { // we have the alias var user = botUsers.First(); context.UserData.SetValue(UserProfileHelper.UserProfileKey, user); context.Call(new PromptText( $"Hey {user.Alias}, tell me what you want to know and I'll kick off a research project.\n\n\n\n" + "Or say 'example' to see some examples.", $"Please try again. Response needs to be at least {MinDescriptionCharLength} characters long.", "Sorry, I didn't get that. too many attempts. Please try again later.", 2, MinDescriptionCharLength), OnDescriptionOrExampleRequestReceivedAsync); } } }
public async Task StartAsync(IDialogContext context) { if (context == null) { throw new ArgumentNullException(nameof(context)); } _isSms = context.Activity.ChannelId == ActivityHelper.SmsChannelId; if (await ConversationHelpers.RelayMessageToAgentIfThereIsAnOpenResearchProject(context)) { // end the context context.Done <object>(null); } else { var smsPrompt = "Hello, I am Expert Intelligence Bot. I'll collect some information to get started, " + "then a human freelancer will review your request and follow up. \n\n\n\n" + "Would you like web research?\n\n\n\n" + "You can say: 'yes' or 'no'."; var teamsPrompt = "Hello! I am Expert Intelligence Bot.\n\nI am supported by experts who can work for you.\n\n " + "I'll collect some information to get started, then a human freelancer will review your request and follow up. " + $"You can also send me a text request via SMS text message on your phone at {ConfigurationManager.AppSettings["BotPhoneNumber"]} \n\n\n\n" + "Would you like web research?\n\n\n\n" + "You can say: 'yes' or 'no'."; var choiceDialog = new PromptYesNo( _isSms ? smsPrompt : teamsPrompt, "Sorry I didn't get that. Please say 'yes' if you want to continue with requesting web research", "Sorry I still don't get it if you want to continue with web research. Please reply to start again.", 2); context.Call(choiceDialog, OnResearchConfirmationReceivedAsync); // introduce the bot //IMessageActivity message = _isSms ? BuildIntroMessageForSms(context) : BuildIntroMessageForTeams(context); //await context.PostWithRetryAsync(message); //context.Wait(OnProjectTypeReceivedAsync); } }