Kumar Negi, Dhananjay Thanks for getting back, to validate the Event Grid webhook, you need to implement the validation request event in your webhook endpoint. The validation request event is a POST request that contains a validation code in the request body. The endpoint should extract the validation code from the request body and return it in the response body.
In the call-automation-open-ai-sample, you can implement the validation request event in the webhook_handler
function in the app.py
file. You can add the following code to handle the validation request event:
if request.method == 'POST':
event = request.get_json()
if event['eventType'] == 'Microsoft.EventGrid.SubscriptionValidationEvent':
validation_code = event['data']['validationCode']
response_data = {
'validationResponse': validation_code
}
return jsonify(response_data)
This code checks if the incoming request is a POST request and if it is a validation request event. If it is a validation request event, it extracts the validation code from the request body and returns it in the response body.
Once you have implemented the validation request event, you can retry the validation request. If the validation request is successful, the Event Grid service will mark the subscription as validated and start delivering events to the webhook endpoint.
If you need further assistance, i would recommend you create support ticket with us If you don't have a support plan, please let me know