public async Task SendProxyMessageAsync(ProxyEndpoint endpoint, string text) { string url = _partyEndpointProvider.GetPartyUrl(endpoint.PartyType); using (HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, url)) { request.Headers.Add(ProxyIdHeaderName, endpoint.ProxyId); request.Content = new StringContent(text); using (HttpResponseMessage response = await _httpClient.SendAsync(request)) { response.EnsureSuccessStatusCode(); } } }
private async Task SendSupportConnected(ProxyEndpoint endpoint, SessionState userSession) { await SendProxyMessageAsync(endpoint, "Connected to a user, grabbing background info..."); await SendProxyMessageAsync(endpoint, "---"); IEnumerable <string> info = await GetSessionBackgroundAsync(userSession.SessionId); foreach (string s in info) { await SendProxyMessageAsync(endpoint, s); } await SendProxyMessageAsync(endpoint, "---"); await SendProxyMessageAsync(endpoint, "Ready to talk:"); }
private Task SendUserWelcome(ProxyEndpoint endpoint) => SendProxyMessageAsync(endpoint, "You have been connected with a support agent");