private static Attachment BuildOptionsForNewUserWithResearchPptApptOptions(IDialogContext context) { var heroCard = new HeroCard { Title = $"Hello {UserProfileHelper.GetFriendlyName(context)}! I am Expert Intelligence Bot.", Subtitle = "I am supported by experts who can work for you.", Text = "We can do a few things. Please select one of the options so I can collect few information to get started. " + "After that a project manager will review your request and follow up." + $"You can also reach out to me by sending SMS at {ConfigurationManager.AppSettings["BotPhoneNumber"]}", Buttons = new List <CardAction> { new CardAction(ActionTypes.ImBack, "Internet Research", value: "research"), new CardAction(ActionTypes.ImBack, "PowerPoint Improvements", value: "ppt"), new CardAction(ActionTypes.ImBack, "virtual assistant", value: "virtual assistant"), new CardAction(ActionTypes.ImBack, "Talk to an agent", value: "agent") } }; return(heroCard.ToAttachment()); }
private static async Task SendAutoReplyIfNeeded(IDialogContext context, int?vsoId) { // Check when was the last time we sent message to agent var timeStampWhenLastMessageWasSentByAgent = await OnlineStatus.GetTimeWhenMemberWasLastActive(OnlineStatus.AgentMemberType); var timeSinceLastMessageWasSentByAgent = DateTime.UtcNow.Subtract((DateTime)timeStampWhenLastMessageWasSentByAgent); bool autoReplyWasSentAWhileBack = DateTime.UtcNow.Subtract(GetAutoReplySentOnTimeStamp(context)) .TotalMinutes > MinutesToWaitBeforeSendingAutoReply; if (timeSinceLastMessageWasSentByAgent.TotalMinutes >= MinutesToWaitForAgentOnlineBeforeSendingAutoReply && autoReplyWasSentAWhileBack) { await context.PostWithRetryAsync($"Hi {UserProfileHelper.GetFriendlyName(context)}, " + $"My experts are working on Project #{vsoId}. " + $"Current status of this project is {await VsoHelper.GetProjectStatus((int)vsoId)}. " + "Either experts are busy or offline at the moment. " + $"They were online {timeSinceLastMessageWasSentByAgent.TimeAgo()}. Please wait. "); SetAutoReplySentOnTimeStamp(context); } }