private dynamic WebhookPost(dynamic args) { dynamic body = args.body.Value; #if DEBUG #else var table = this.GetTracingTable(); if (table != null) { var now = DateTime.Now; var trace = new FacebookWebhookRequest(); trace.PartitionKey = now.ToString("yyyy-MM-dd"); trace.RowKey = now.ToString("HH-mm|") + now.Ticks; trace.Method = "POST"; trace.Payload = ((JObject)body).ToString(); var op = TableOperation.Insert(trace); table.Execute(op); } #endif if (body["object"] == "page") { if (body.entry != null) { return(this.HandlePageWebhook(body, body.entry[0])); } } return(404); }
public async Task <IActionResult> ProcessCallback() { await _authorizationService.Authorize(Request.HttpContext); FacebookWebhookRequest request = null; using (var reader = new StreamReader(Request.Body)) { var body = reader.ReadToEnd(); request = JsonConvert.DeserializeObject <FacebookWebhookRequest>(body); } var requestProcessor = new FacebookRequestProcessor(); // Fire and forget this service call since the response isn't dependent on the result of this #pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed requestProcessor.ProcessReqeust(request); #pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed return(Ok()); }