public virtual async Task <HttpResponseMessage> Post([FromBody] Activity activity) { // check if activity is of type message if (activity != null && activity.GetActivityType() == ActivityTypes.Message) { await Conversation.SendAsync(activity, () => new RootDialog()); } else if (activity.IsO365ConnectorCardActionQuery()) { // this will handle the request coming any action on Actionable messages return(await HandleO365ConnectorCardActionQuery(activity)); } else if (activity != null && activity.GetActivityType() == ActivityTypes.Invoke && activity.Name == "signin/verifyState") { var stateInfo = Newtonsoft.Json.JsonConvert.DeserializeObject <SateValue>(activity.Value.ToString()); // var userInfo = // userData.SetProperty<string>("AccessToken", activity.Value.ToString()); UserInfoRepository.AddUserInfo(new UserInfo() { userId = activity.From.Id, accessToken = stateInfo.state, ExpiryTime = DateTime.Now.AddSeconds(3450) }); //3450 var reply = activity.CreateReply(); reply.Text = "You are successfully signed in. Now, you can use the 'create team' command."; // Get Email Id. var connectorClient = new ConnectorClient(new Uri(activity.ServiceUrl)); var email = string.Empty; var member = connectorClient.Conversations.GetConversationMembersAsync(activity.Conversation.Id).Result.AsTeamsChannelAccounts().FirstOrDefault(); if (member != null) { email = member.Email; } var card = RootDialog.GetFilter(email); reply.Attachments.Add(card); await connectorClient.Conversations.ReplyToActivityAsync(reply); } else { HandleSystemMessage(activity); } return(new HttpResponseMessage(System.Net.HttpStatusCode.Accepted)); }