-
-
Save kasunkv/9f63535077c759623ece48d28c47177c to your computer and use it in GitHub Desktop.
Azure Functions: ReceiveNotification Function Initial State.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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