Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielok1993/76eee7eed1564f04dad093f11d9b0d7e to your computer and use it in GitHub Desktop.
Save danielok1993/76eee7eed1564f04dad093f11d9b0d7e to your computer and use it in GitHub Desktop.
ServiceBus360 - Create Freshservice Ticket
{
"$connections": {
"value": {
"freshservice": {
"connectionId": "/subscriptions/{your-subscription-id}/resourceGroups/sb360_webhook_blog_rg/providers/Microsoft.Web/connections/freshservice-1",
"connectionName": "freshservice-1",
"id": "/subscriptions/{your-subscription-id}/providers/Microsoft.Web/locations/ukwest/managedApis/freshservice"
}
}
},
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"For_each": {
"actions": {
"Create_a_ticket": {
"inputs": {
"body": {
"helpdesk_ticket": {
"description": "@{body('FilterIssuesArray')}\n\n\n\n\n\n\n",
"priority": "Urgent",
"requester_id": 7000151834,
"status": "Open",
"subject": "ServiceBus360 Alert"
}
},
"host": {
"connection": {
"name": "@parameters('$connections')['freshservice']['connectionId']"
}
},
"method": "post",
"path": "/helpdesk/tickets.json"
},
"runAfter": {
"FilterIssuesArray": [
"Succeeded"
]
},
"type": "ApiConnection"
},
"FilterIssuesArray": {
"inputs": {
"body": "@items('For_each')",
"function": {
"id": "/subscriptions/{your-subscription-id}/resourceGroups/danielfunctionapps_rg/providers/Microsoft.Web/sites/danielfunctionapps/functions/FilterIssuesArray"
}
},
"runAfter": {},
"type": "Function"
}
},
"foreach": "@body('Parse_JSON')",
"runAfter": {
"Parse_JSON": [
"Succeeded"
]
},
"type": "Foreach"
},
"Parse_JSON": {
"inputs": {
"content": "@triggerBody()",
"schema": {
"items": {
"properties": {
"Errors": {
"type": "number"
},
"Issues": {
"items": {
"properties": {
"CompositeKey": {
"type": "any"
},
"CompositeKeyType": {
"type": "any"
},
"Information": {
"type": "string"
},
"IsComposite": {
"type": "boolean"
},
"Type": {
"type": "string"
}
},
"required": [
"Type",
"IsComposite",
"CompositeKey",
"CompositeKeyType",
"Information"
],
"type": "object"
},
"type": "array"
},
"NamespaceName": {
"type": "string"
},
"ResourceName": {
"type": "string"
},
"ResourceType": {
"type": "string"
},
"State": {
"type": "number"
},
"Warnings": {
"type": "number"
}
},
"required": [
"ResourceName",
"ResourceType",
"NamespaceName",
"Errors",
"Warnings",
"Issues",
"State"
],
"type": "object"
},
"type": "array"
}
},
"runAfter": {},
"type": "ParseJson"
},
"Response": {
"inputs": {
"statusCode": 200
},
"runAfter": {
"For_each": [
"Succeeded"
]
},
"type": "Response"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
}
},
"triggers": {
"request": {
"inputs": {
"schema": {
"items": {
"properties": {
"Errors": {
"type": "number"
},
"Issues": {
"items": {
"properties": {
"CompositeKey": {
"type": "any"
},
"CompositeKeyType": {
"type": "any"
},
"Information": {
"type": "string"
},
"IsComposite": {
"type": "boolean"
},
"Type": {
"type": "string"
}
},
"required": [
"Type",
"IsComposite",
"CompositeKey",
"CompositeKeyType",
"Information"
],
"type": "object"
},
"type": "array"
},
"NamespaceName": {
"type": "string"
},
"ResourceName": {
"type": "string"
},
"ResourceType": {
"type": "string"
},
"State": {
"type": "number"
},
"Warnings": {
"type": "number"
}
},
"required": [
"ResourceName",
"ResourceType",
"NamespaceName",
"Errors",
"Warnings",
"Issues",
"State"
],
"type": "object"
},
"type": "array"
}
},
"kind": "Http",
"type": "Request"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment