Created
May 18, 2018 18:40
-
-
Save dbarkol/dd7422ebdae6824adbaf8ebf56c3a32b 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
<when condition="@(context.Variables.GetValueOrDefault<bool>("isEventGridNotification"))"> | |
<send-one-way-request mode="new"> | |
<set-url>https://hooks.slack.com/services/{{slack-key}}</set-url> | |
<set-method>POST</set-method> | |
<set-body>@{ | |
var events = context.Request.Body.As<string>(); | |
JArray a = JArray.Parse(events); | |
var eventGridData = a.First["data"]; | |
var station = eventGridData["station"]; | |
var artist = eventGridData["artist"]; | |
var song = eventGridData["song"]; | |
return new JObject( | |
new JProperty("username", station), | |
new JProperty("icon_emoji", ":musical_note:"), | |
new JProperty("text", String.Format("Just added: {0}, {1}", | |
song, artist)) | |
).ToString(); | |
}</set-body> | |
</send-one-way-request> | |
<return-response> | |
<set-status code="200" reason="OK" /> | |
</return-response> | |
</when> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment