Created
September 16, 2019 21:43
-
-
Save norberttech/a62654b7cf894bd64f753a0b9e90a2e8 to your computer and use it in GitHub Desktop.
Azure Logic Apps connector that translates PagerDuty extension requests into Google Chat expected webhooks
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
{ | |
"definition": { | |
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#", | |
"actions": { | |
"For_each": { | |
"actions": { | |
"Condition": { | |
"actions": { | |
"HTTP": { | |
"inputs": { | |
"body": { | |
"text": "*event*: @{items('For_each')?['event']}\n*title*: `@{items('For_each')?['incident']?['title']}`\n*url*: <@{items('For_each')?['incident']?['html_url']}|url>" | |
}, | |
"method": "POST", | |
"uri": "https://chat.googleapis.com/v1/spaces/XXXXXXXXX/messages?key=XXXXXXXXXXXXX&token=XXXXXXXXXXXXX" | |
}, | |
"runAfter": {}, | |
"type": "Http" | |
} | |
}, | |
"expression": { | |
"and": [ | |
{ | |
"not": { | |
"equals": [ | |
"@items('For_each')?['event']", | |
"incident.annotate" | |
] | |
} | |
}, | |
{ | |
"not": { | |
"equals": [ | |
"@items('For_each')?['event']", | |
"incident.assign" | |
] | |
} | |
}, | |
{ | |
"not": { | |
"equals": [ | |
"@items('For_each')?['event']", | |
"incident.escalate" | |
] | |
} | |
} | |
] | |
}, | |
"runAfter": {}, | |
"type": "If" | |
} | |
}, | |
"foreach": "@body('Parse_JSON')?['messages']", | |
"runAfter": { | |
"Parse_JSON": [ | |
"Succeeded" | |
] | |
}, | |
"type": "Foreach" | |
}, | |
"Parse_JSON": { | |
"inputs": { | |
"content": "@triggerBody()", | |
"schema": { | |
"properties": { | |
"messages": { | |
"items": { | |
"properties": { | |
"created_on": { | |
"type": "string" | |
}, | |
"event": { | |
"type": "string" | |
}, | |
"id": { | |
"type": "string" | |
}, | |
"incident": { | |
"properties": { | |
"html_url": { | |
"type": "string" | |
}, | |
"title": { | |
"type": "string" | |
} | |
}, | |
"type": "object" | |
} | |
}, | |
"required": [ | |
"event", | |
"incident" | |
], | |
"type": "object" | |
}, | |
"type": "array" | |
} | |
}, | |
"type": "object" | |
} | |
}, | |
"runAfter": {}, | |
"type": "ParseJson" | |
} | |
}, | |
"contentVersion": "1.0.0.0", | |
"outputs": {}, | |
"parameters": {}, | |
"triggers": { | |
"manual": { | |
"inputs": { | |
"schema": {} | |
}, | |
"kind": "Http", | |
"type": "Request" | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment