I'm trying to test an Azure runbook that normally accepts JSON from a webhook from Salesforce. The existing runbook works fine in production, but I'd like to run some code edits in "Test" inside Azure if possible. I found this article Webhook Data Input Parameter Syntax in Azure's Runbook but it's more for using JSON as part of a production runbook, not for testing purposes within the "Edit mode" screen where you can run a Test and type your inputs for the Test.
Code Snippet that matters:
param (
[object]
$WebhookData
)
if ($WebhookData.RequestBody) {
DO SOME THINGS
}
else {
Write-Error "Webhook request body missing."
An example of the JSON input I'm trying to use:
{"WebhookName":"SF_CommunityWebHook","RequestBody":"{\n \"attributes\" : {\n \"type\" : \"User\",\n \"url\" : \"/services/data/v54.0/sobjects/User/0056Q000fd7nH9RQAU\"\n },\n \"Username\" : \"TheCleaner@gmail.moc\",\n \"Name\" : \"The Cleaner\",\n \"FirstName\" : \"The\",\n \"LastName\" : \"Cleaner\",\n \"Email\" : \"TheCleaner@gmail.moc\",\n \"ContactId\" : \"0036Q003002kmA7mQAE\",\n \"AccountId\" : \"0011U000I3nK7QAJ\",\n \"Account_Customer_Number__c\" : \"C0f5988\",\n \"Account_Name__c\" : \"The Cleaner Laundromat\",\n \"Community_Experience__c\" : \"Channel Partner Community\",\n \"Id\" : \"0056Q0ffnffH9RQAU\"\n}","RequestHeader":{"Cache-Control":"no-cache","Connection":"keep-alive","Pragma":"no-cache","Accept":"text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2","Host":"0b33c0bb-fab4354053eb28.webhook.scus.azure-automation.net","User-Agent":"SFDC-Callout/54.0","SFDC_STACK_DEPTH":"1","x-ms-request-id":"d1992daa-2cfa-4aa7-a212-b18879"}}
When I attempt the test by copying a known good JSON input that Salesforce creates into the test parameter window, I get the error from the Else statement as the output.
Is there a way to actually test in the Azure GUI a JSON input here? I would prefer not to have to create a test Webhook in Salesforce just to test changes to the code or be required to store the JSON as an object in Azure (like the original article I linked) just to create a test runbook.
-Infrastructure Manager...not a developer...have some pity...