Hi Arun M K,
Thanks for reaching out to Microsoft Q&A.
To pass parameters from a webhook to an azure automation python runbook, you can include the parameter in the webhook payload and modify your runbook to accept it.
Here’s how can set it up:
- Modify the Webhook Request:
- When calling the webhook, pass the parameter in the request body. For example, if you are triggering the webhook from ADF, you can include the parameter in the body like this:
{ "myParameter": "parameterValue" }
- When calling the webhook, pass the parameter in the request body. For example, if you are triggering the webhook from ADF, you can include the parameter in the body like this:
- Modify the Python Runbook:
- In your Python runbook, use the
sys
module to capture the webhook data. ThewebhookData
is passed as a JSON object when the webhook is triggered.
import sys import json
Get the webhook data
webhook_data = json.loads(sys.argv[1])
Extract the parameter
my_parameter = webhook_data.get('myParameter', 'default_value') print(f"Received parameter: {my_parameter}")
- In your Python runbook, use the
- Test the Integration:
- Make sure you are passing the correct JSON format when triggering the webhook. If testing from adf ensure that the parameter is included properly in the body of the HTTP request activity.
This way your python runbook can handle dynamic parameters passed from the webhook.
Please feel free to click the 'Upvote' (Thumbs-up) button and 'Accept as Answer'. This helps the community by allowing others with similar queries to easily find the solution.