3

I'm trying to understand how to use a webhook in microsoft speech to text V3. According to the docs i was able to create a webhook and ping it. Now whenever a transcription is complete the webhook is called, but the body object in request is empty always and is pretty much of no use. Can anyone tell me what am i doing wrong ?

1 Answers1

2

The body of the request, that you receive, should contain a content similar to this one

{
  "self": "https://{CognitiveServicesEndpoint}/speechtotext/v3.0/transcriptions/{TranscriptionId}",
  "invocationId": "{InvocationId}"
}

You can do an HTTP GET on the self property of the body to get details on the entity. These are deliberately not included, due to possible trust concerns between the web hook receiver and the subscription owner.

Also, there should be a header in the request named X-MicrosoftSpeechServices-Event. It should contain the state of the transcription as one of the following, depending on what you subscribed for

  • TranscriptionCreation
  • TranscriptionProcessing
  • TranscriptionCompletion
  • TranscriptionDeletion

I just created a web hook with all the above transcription event types and I received the expected requests with the expected payload in the body. If you do not see the correct payload in the body, please let me know, which endpoint (region) you are using, so I can check that one specifically. There might be a bug in that specific datacenter.

Kind regards

Dirk

D. Siemer
  • 158
  • 8
  • Hey Dirk, thank you for taking a look :), my location is "eastus" and i'm still not getting anything within the body but it does seem to have `X-MicrosoftSpeechServices-Event` header. If you need any more details about the request i'll share it with you . – Kartik Gupta Jul 06 '21 at 15:23
  • I tried creating a transcription in that region. The web hook receiver reported the body to be { "self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.0/transcriptions/5c1d60b1-148f-4fc7-8eab-338d9e0fc340", "invocationId": "7fcc4c1e-19f3-47fe-a74a-df5db720bc63" } Please make sure, you de-serialize the body of the POST request in the web hook receiver correctly. – D. Siemer Jul 07 '21 at 13:37
  • Oh!! Thanks mate, turns out it was a problem with serialization. – Kartik Gupta Jul 07 '21 at 18:49
  • @D.Siemer any clue what names of X-MicrosoftSpeechServices-Event are allowed? Is there an "OnError" or "OnTranscriptionFailed" event or something? Docs are apparently missing that part completely. – Chris Jan 10 '22 at 16:33
  • 1
    The possible events you can subscribe to are: datasetCreation datasetProcessing datasetCompletion datasetDeletion modelCreation modelProcessing modelCompletion modelDeletion evaluationCreation evaluationProcessing evaluationCompletion evaluationDeletion transcriptionCreation transcriptionProcessing transcriptionCompletion transcriptionDeletion endpointCreation endpointProcessing endpointCompletion endpointDeletion – D. Siemer Jan 11 '22 at 17:42
  • 2
    When looking for failures, you should subscribe to the .*Completion events, do a GET on the self link and look for the Status property of the response. There is only one event for entities reaching a terminal state. We don't offer different events for success and error. – D. Siemer Jan 11 '22 at 17:46
  • 1
    The documentation is a bit frustrating to find, due to a visualization issue in the APIM. The documentation can be found here: https://westus.dev.cognitive.microsoft.com/docs/services/speech-to-text-api-v3-0/operations/CreateHook From there you can download the API definition. In the Swagger you can look for the WebHook definition of the POST body and in there you will find the "events" as property of type object with the allowed property names and types (boolean) for that object. – D. Siemer Jan 11 '22 at 18:07
  • @D.Siemer thanks a lot, that was very helpful – Chris Jan 13 '22 at 23:53
  • An easier access to the Swagger file would be from here: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cognitiveservices/data-plane/Speech/SpeechToText/stable/v3.0 – D. Siemer Jan 19 '22 at 13:13