How to configure the webhook properly so that i receive notifications when the transcription is completed

296 Views Asked by At

i tried to configure a webhook url using microsoft azure speech to text api v 3.1 so that i receive a notifications when a transcription is completed . I faced an issue when triying to create the webhook url, when searching on some other links and on the docs, there is a secret that will be used to create a hash . there is no many details in the docs about how to do the handshake between the webhook sender and receiver

b'{\n  "displayName": "string",\n  "self": "    https://eastus.api.cognitive.microsoft.com/speechtotext/v3.1/webhooks/6002fb1c-b7d4-4529-ad83-fad53a460228",\n  "links": {\n    "ping": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.1/webhooks/6002fb1c-b7d4-4529-ad83-fad53a460228:ping",\n    "test": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.1/webhooks/6002fb1c-b7d4-4529-ad83-fad53a460228:test"\n  },\n  "properties": {\n    "apiVersion": "v3.1",\n    "error": {\n      "code": "Undefined",\n      "message": "The web hook failed completing the challenge/response handshake at 3/6/2023 9:17:34 AM. Challenge response payload doesn\'t match validation token. Expected: 08d9c88813f34d26b82bbb15334fd75b, actual: "\n    },\n    "secret": "stt"\n  },\n  "webUrl": "https://webhook.site/747fde8d-3915-40cf-a5bf-5338cbcc1195",\n  "events": {\n    "transcriptionCompletion": true\n  },\n  "description": "string",\n  "createdDateTime": "2023-03-06T09:17:34Z",\n  "lastActionDateTime": "2023-03-06T09:17:34Z",\n  "status": "Failed"\n}

i received this when tried to get the webhook by id, so it seems that its not properly configured .

this is the post request that i sent when creating it :

conn = http.client.HTTPSConnection('eastus.api.cognitive.microsoft.com')
     conn.request("POST", "/speechtotext/v3.1/webhooks?", body=json.dumps(datahook), headers=headers)
     response = conn.getresponse()
     data = response.read()

and the body is :

datahook = {
  "webUrl": "https://webhook.site/747fde8d-3915-40cf-a5bf-5338cbcc1195",
  "links": {
    "ping": "https://webhook.site/747fde8d-3915-40cf-a5bf-5338cbcc1195",
    "test": "https://webhook.site/747fde8d-3915-40cf-a5bf-5338cbcc1195"
  },
  "displayName": "string",
  "description": "string",
  "events": {
    "transcriptionCompletion": True,
  },
  "properties": {
    "secret": "stt"
  },
}

should i prepare a get endpoint so that when receiving a request from the sender i verify the secret value and validation token ?

0

There are 0 best solutions below