Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
#r "Newtonsoft.Json"
using System;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using Newtonsoft.Json;
public static async Task<object> Run(HttpRequestMessage req, TraceWriter log)
var jsonContent = await req.Content.ReadAsStringAsync();
dynamic data = JsonConvert.DeserializeObject(jsonContent);
if (data.comment == null || data.comment.body == null) {
return req.CreateResponse(HttpStatusCode.BadRequest, new {
error = "Please pass comment:body properties in the input object"
log.Verbose($"GitHub WebHook triggered!, {data}");
var message = $@"New GitHub comment posted by {data.comment.user.login} at {},
Url : {data.comment.url}
Tite : {data.issue.title}
return req.CreateResponse(HttpStatusCode.OK, new {
body = message
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment