Create a gist now

Instantly share code, notes, and snippets.

@kasunkv /run.csx Secret
Last active Jun 25, 2017

What would you like to do?
Azure Functions: ReceiveNotification Function Initial State.
#r "Newtonsoft.Json"
using System;
using System.Net;
using Newtonsoft.Json;
public static async Task<object> Run(HttpRequestMessage req, TraceWriter log)
{
log.Info($"Notification Received.");
string jsonContent = await req.Content.ReadAsStringAsync();
var notification = JsonConvert.DeserializeObject<Notification>(jsonContent);
return req.CreateResponse(HttpStatusCode.OK, new
{
message = $"Notification Request Received From: {notification.Email}"
});
}
public class Notification {
public string NotificationId { get; set; }
public string Email { get; set; }
public string Subject { get; set; }
public string Content { get; set; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment