private async Task HandleNotificationMessages(Activity activity, ConnectorClient connector) { var toId = activity.From.Id; var toName = activity.From.Name; var fromId = activity.Recipient.Id; var fromName = activity.Recipient.Name; var serviceUrl = activity.ServiceUrl; var channelId = activity.ChannelId; var conversationId = activity.Conversation.Id; var messageConversation = string.Concat("Activity: ", toId, " toName: " + toName + " fromID: " + fromId + " fromName:", fromName + " serviceurl: " + serviceUrl + " channelid:" + channelId + " conversation: " + conversationId); Activity reply = activity.CreateReply(messageConversation); var botUserRegisterDto = new BoutUserRegisterDto { Activity = toId, ChannelId = channelId, Conversation = conversationId, FromID = fromId, FromName = fromName, UserName = toName, RegistryDate = DateTime.Now, ServiceUrl = serviceUrl }; var homeRestService = new HomeRestService(); await homeRestService.RegisterBotUser(botUserRegisterDto); await connector.Conversations.ReplyToActivityAsync(reply); }
public async Task MakeAuthyRequest(AuthyRequestDto authyRequest) { using (var httpClient = new HttpClient()) { var user = new BoutUserRegisterDto(); var urlService = WebConfigurationManager.AppSettings["homeRestServiceUrl"]; httpClient.BaseAddress = new Uri(urlService); StringContent content = new StringContent(JsonConvert.SerializeObject(authyRequest), Encoding.UTF8, "application/json"); await httpClient.PostAsync(makeAuthyRequestAction, content); } }
public async Task RegisterBotUser(BoutUserRegisterDto boutUserRegisterDto) { using (var httpClient = new HttpClient()) { var user = new BoutUserRegisterDto(); var urlService = WebConfigurationManager.AppSettings["homeRestServiceUrl"]; httpClient.BaseAddress = new Uri(urlService); StringContent content = new StringContent(JsonConvert.SerializeObject(boutUserRegisterDto), Encoding.UTF8, "application/json"); await httpClient.PostAsync("api/registrationbotuser/registerbotuser", content); } }