Created
May 25, 2016 22:19
-
-
Save jeffhollan/76eab2341be739ea92c3d84db61dd09a to your computer and use it in GitHub Desktop.
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.Verbose($"Webhook was triggered!"); | |
string jsonContent = await req.Content.ReadAsStringAsync(); | |
dynamic data = JsonConvert.DeserializeObject(jsonContent); | |
string msgBody = data.body; | |
log.Verbose($"Message Received: {msgBody}"); | |
int length = msgBody.Length; | |
log.Verbose($"Message Length: {length.ToString()}"); | |
int start = msgBody.IndexOf("{"); | |
string result = msgBody.Substring(start, length - start); | |
return req.CreateResponse(HttpStatusCode.OK, JsonConvert.DeserializeObject(result)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Would call this function from a Logic app with the object:
{
"body": "@\u0006string\b3http://schemas.microsoft.com/2003/10/Serialization/�H{\"heartbeatprocessed\":0,\"time\":\"2016-04-12T03:42:18.0000000Z\",\"count\":1}"
}
or
{
"body": "[Content]"
}
Where [Content] is my service bus token in the designer