Skip to content

Instantly share code, notes, and snippets.

@kasunkv

kasunkv/run.csx Secret

Last active June 25, 2017 07:44
Show Gist options
  • Save kasunkv/9f63535077c759623ece48d28c47177c to your computer and use it in GitHub Desktop.
Save kasunkv/9f63535077c759623ece48d28c47177c to your computer and use it in GitHub Desktop.
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