I want to create Azure Logic App which will constantly request a specific website on the Internet and parse received HTML.
I've created Logic App and set up interval and HTTP request action.
Which action should I choose as the next step for simple regex operation on HTML code?
What comes to my mind is creating Azure Function which will do the job, but I wonder if there is any other solution, more suitable for such task.
I want it the be simple as possible.
Edit:
Just found out some cool feature. Logic Apps contain some basic expressions for primitive types.
Unfortunetly it lacks of any regex
or string.contains
.
For now, I'll try with Azure Functions.
I've managed to solve my problem with use of Workflow Definition Language and building blocks provided by Azure.
The Azure Function idea was not that bad and would fit perfectly for any more complex case, but as I mentioned, I wanted it as simple as possible, so here it is.
This is how my flow looks now.
For sake of completeness, here is the flow in JSON format
{
"$connections": {
"value": {
"wunderlist": {
"connectionId": "/subscriptions/.../providers/Microsoft.Web/connections/wunderlist",
"connectionName": "wunderlist",
"id": "/subscriptions/.../providers/Microsoft.Web/locations/northeurope/managedApis/wunderlist"
}
}
},
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Condition": {
"actions": {
"Create_a_task": {
"inputs": {
"body": {
"completed": false,
"list_id": 000000000,
"starred": true,
"title": "@{variables('today date')}"
},
"host": {
"connection": {
"name": "@parameters('$connections')['wunderlist']['connectionId']"
}
},
"method": "post",
"path": "/tasks",
"retryPolicy": {
"type": "none"
}
},
"limit": {
"timeout": "PT20S"
},
"runAfter": {},
"type": "ApiConnection"
},
"Set_a_reminder": {
"inputs": {
"body": {
"date": "@{addHours(utcNow(), 3)}",
"list_id": 000000,
"task_id": "@body('Create_a_task')?.id"
},
"host": {
"connection": {
"name": "@parameters('$connections')['wunderlist']['connectionId']"
}
},
"method": "post",
"path": "/reminders",
"retryPolicy": {
"type": "none"
}
},
"limit": {
"timeout": "PT20S"
},
"runAfter": {
"Create_a_task": [
"Succeeded"
]
},
"type": "ApiConnection"
}
},
"expression": "@contains(body('HTTP'), variables('today date'))",
"runAfter": {
"Initialize_variable": [
"Succeeded"
]
},
"type": "If"
},
"HTTP": {
"inputs": {
"method": "GET",
"uri": "..."
},
"runAfter": {},
"type": "Http"
},
"Initialize_variable": {
"inputs": {
"variables": [
{
"name": "today date",
"type": "String",
"value": "@{utcNow('yyyy/MM/dd')}"
}
]
},
"runAfter": {
"HTTP": [
"Succeeded"
]
},
"type": "InitializeVariable"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
}
},
"triggers": {
"Recurrence": {
"recurrence": {
"frequency": "Day",
"interval": 1,
"startTime": "2017-08-01T23:55:00Z",
"timeZone": "UTC"
},
"type": "Recurrence"
}
}
}
}