0

I have created a webhook in Azure Automation. I am looking to pass the body when the webhook is called to a logic app. Please see the powershell code designed of runbook.

param
(
    [Parameter(Mandatory=$false)]
    [object] $WebhookData
    #[string] $jobId
)

if ($WebhookData.RequestBody) { 
    $names = (ConvertFrom-Json -InputObject $WebhookData.RequestBody)
        Write-Output $names
        $webhookName = $WebhookData.WebhookName
        $logicappURI = "https://logicapp/api/test/triggers/manual/invoke/properties/"+$webhookName+"?api-version=2022-05-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig={signature_certificate"
        $response = Invoke-WebRequest -Method GET -Uri $logicappURI
}
else {
    Write-Output "Hello World!"
}

Currently I am able to call the logic app and pass the webhook name, but the i would like to pass the complete request body. Below is the request body for webhook.

{
    "WebhookName": "wh-test-webhook-ext-cus-001",
    "RequestBody": "[{\"Name\": \"Hawaii\" },{\"Name\": \"Seattle\"},{ \"Name\": \"Florida\"}]",
    "RequestHeader": {
        "Connection": "Keep-Alive",
        "Host": "14304127-e302-4499-b819-8ac4493555e9.webhook.cus.azure-automation.net",
        "User-Agent": "Mozilla/5.0",
        "x-ms-request-id": "47ca3f1a-2418-4553-94c4-9f20c2095c80"
    }
}

The logic app is designed to trigger when an HTTP request is recieved. As shown in the image I am passing passing webhook name. Similarly is there a way I can pass the complete ReuqestBody.

Thanks in advance.

Logic App Design

0 Answers0