How do you access using the Python programming language the WebhookData object in the Azure automation webhooks. I read the documentation regarding this, but it is in PowerShell, and not helping in my instance. My Azure webhook URL endpoint is successfully receiving data from a custom external application. I would like to read the received data and run logic driven by the received data. As shown on the below screenshot, I am receiving the data in Azure.

WEBHOOKDATA coming into the Azure

This is the error message I am getting when I attempt to access the WEBHOOKDATA input parameter:

Traceback (most recent call last): File "C:\Temp\rh0xijl1.ayb\3b9ba51c-73e7-44ba-af36-3c910e659c71", line 7, in <module> received_data = WEBHOOKDATA NameError: name 'WEBHOOKDATA' is not defined

This is the code producing the error message:

#!/usr/bin/env python3
import json

# Here is where my question is. How do I get this in Python?
# Surely, I should be able to access this easily. But how. 
# Powershell does have a concept of param in the documentation - but I want to do this in Python.
received_data = WEBHOOKDATA   
#convert JSON to string
received_as_text = json.dumps(received_data)
print(received_as_text)

Solution 1:

You access runbook input parameters with sys.argv. See Tutorial: Create a Python 3 runbook