Exemplo n.º 1
0
        public async Task <IActionResult> OnIncomingRequestAsync()
        {
            var requestMessage = Request.HttpContext.GetHttpRequestMessage();

            var requestUri = requestMessage.RequestUri;

            // Process the incoming request for current web instance.
            bot.AddCallbackLog($"Process incoming request {requestUri}");

            var token = requestMessage.Headers?.Authorization?.Parameter;

            bot.AddCallbackLog($"Token: {token ?? "null"}");

            graphLogger.Info($"Received HTTP {Request.Method}, {requestUri}");

            // Pass the incoming message to the sdk. The sdk takes care of what to do with it.
            var response = await bot.Client.ProcessNotificationAsync(requestMessage).ConfigureAwait(false);

            // Convert the status code, content of HttpResponseMessage to IActionResult,
            // and copy the headers from response to HttpContext.Response.Headers.
            return(await this.GetActionResultAsync(response).ConfigureAwait(false));
        }