/// <summary> /// On Teams Messaging Extension Fetch Task Async. /// </summary> /// <param name="turnContext">turnContext.</param> /// <param name="action">action.</param> /// <param name="cancellationToken">cancellationToken.</param> /// <returns>response.</returns> protected override async Task <MessagingExtensionActionResponse> OnTeamsMessagingExtensionFetchTaskAsync(ITurnContext <IInvokeActivity> turnContext, MessagingExtensionAction action, CancellationToken cancellationToken) { _telemetry.TrackEvent("OnTeamsMessagingExtensionFetchTaskAsync"); try { var url = this._configuration["BaseUri"]; if (action.CommandId == ReflectConstants.RecurringPosts) { var postCreatedByEmail = await _dbHelper.GetUserEmailId(turnContext); url = this._configuration["BaseUri"] + "/ManageRecurringPosts/" + postCreatedByEmail; var response = new MessagingExtensionActionResponse() { Task = new TaskModuleContinueResponse() { Value = new TaskModuleTaskInfo() { Height = 620, Width = 800, Title = "Track how you're feeling every day.", Url = url }, }, }; return(response); } else if (action.CommandId == ReflectConstants.RemovePosts) { if (turnContext.Activity.Conversation.Id != null) { var replymessageid = turnContext.Activity.Conversation.Id.Split("="); string messageId = replymessageid[1]; var confirmcard = _cardHelper.ConfirmationCard(messageId); Attachment attachmentfeedback = new Attachment() { ContentType = AdaptiveCard.ContentType, Content = confirmcard, }; var response = new MessagingExtensionActionResponse() { Task = new TaskModuleContinueResponse() { Value = new TaskModuleTaskInfo() { Height = 100, Width = 300, Title = "Track how you're feeling every day.", Card = attachmentfeedback }, }, }; return(response); } return(null); } else if (action.CommandId == ReflectConstants.CreateReflect) { var name = (turnContext.Activity.From.Name).Split(); var userName = name[0] + ' ' + name[1]; url = this._configuration["BaseUri"] + "/" + userName; var response = new MessagingExtensionActionResponse() { Task = new TaskModuleContinueResponse() { Value = new TaskModuleTaskInfo() { Height = 620, Width = 800, Title = "Track how you're feeling every day.", Url = url }, }, }; return(response); } else { return(null); } } catch (Exception ex) { _telemetry.TrackException(ex); return(null); } }