Awaken Conversations User Guide

Please email helpdesk@awaken.io for omissions or errors.
×
Menu

Callback over HTTP

The next section explains what form Callbacks will take when configured using HTTP or HTTPS:
 
Content-Type
The Content-Type of the request will be multipart/form-data
 
Payload
 
The following points are dependant on the requested output(s):
 
 
Retries
Callbacks expect an HTTP response code of 2xx (success)
 
Default retry behaviour is:
 
If the endpoint that has been configured is unavailable, the callback will be triggered once per minute for 30 minutes.
If there is still no response after 30 minutes, the callback will drop off to a retry every 5 minutes.
 
Example code
The following code is example receiver code:
 
C#
var form = Request.Form;
if (form.Keys.Count > 0)
{
     // The requestId is returned by the transcription upload request and if stored can used to join
     // the upload request to this callback response
     if (form.TryGetValue("requestid", out StringValues requestId))
     {
          Console.WriteLine($@"Request Id: {requestId[0]}");
     }
 
     // This contains the key the JSON is stored in. It will be: {call_id}.json
     var jsonFormKey = form.Keys.FirstOrDefault(key => key.EndsWith(".json"));
     if (jsonFormKey != null)
     {
          Console.WriteLine($@"JSON Form Key: {jsonFormKey}");
     }
 
     // This contains the key the text transcription is stored in. It will be: {call_id}.txt
     var transcriptionTextKey = form.Keys.FirstOrDefault(key => key.EndsWith(".txt"));
     if (transcriptionTextKey != null)
     {
          Console.WriteLine($@"Txt Form Key: {transcriptionTextKey}");
     }
}
if (form.Files.Count > 0)
{
     // This file is a byte stream of audio and will have a filename of: {call_id}.mp3
     var file = form.Files[0];
     if (file.ContentType == "audio/mpeg")
     {
          Console.WriteLine($@"Audio Filename: {file.FileName}");
     }
}
return Ok();