Upload Audio or Prompts using API

Hi Team ,

We need to Update a Prompt using API

/api/v2/architect/prompts/{promptId}

We tried providing the below Parameters value ,
{
"id": "21ff494a-3eaf-4af3-8bf0-059882c81e72",
"name": "TestoneAudio",
"description": "TestoneAudio description",
"resources": [
{
"name": "TestoneAudio",
"promptId": "21ff494a-3eaf-4af3-8bf0-059882c81e72",
"language": "en-US",
"mediaUri": "",
"ttsString": "TestoneAudio description",
"text": "TestoneAudio description",
"uploadStatus": "created",
"uploadUri": "D:\testaudio.wav",
"languageDefault": true,
"tags": {},
"durationSeconds": 2333.7
}
]

}

We were able to execute the above with Success message 200 . But we were unable to upload the specified Audio URL path "D:\testaudio.wav" . It was showing empty only Also not able to add TTS .

How can we specify the duration seconds Is that audio recorded time ?

Kindly help provide us the steps to upload the audio file using API

You cannot set the uploadUri or durationSeconds. uploadUri is the location to which you need to post the recording you want use. durationSeconds is calculated for the recording (if there is one).

To upload a prompt resource recording do a POST to the specified uploadUri.
See https://developer.mypurecloud.com/api/tutorials/upload-prompts/index.html?language=nodejs&step=5 for an example.

To set the prompt resource's TTS, 1st do a GET to prompt/id/resource/language endpoint, then add your TTS to the object and PUT it back to the same endpoint.

Thanks for your reply

We were able to add TTS by following the above step .

We tried
https://developer.mypurecloud.com/api/tutorials/upload-prompts/index.html?language=nodejs&step=5

When we try to upload the file using Uploaduri (tried using API explorer under https://developer.mypurecloud.com/developer-tools/#/api-explorer not using any .js )as below But we were not able to upload the prompt but we get the 200 OK Success message . Kindly provide the steps to upload the same (by API)

{
"id": "e97e247b-e581-4228-a3f2-34a12f04d5f6",
"name": "Testtwoaudio",
"description": "TestoneAudio description",
"resources": [
{
"name": "TestoneAudio",
"promptId": "e97e247b-e581-4228-a3f2-34a12f04d5f6",
"language": "en-US",
"mediaUri": "",
"ttsString": "TestoneAudio description",
"text": "TestoneAudio description",
"uploadStatus": "created",
"uploadUri": "https://ccctestwav.s3.amazonaws.com/Liz_5123.wav",
"languageDefault": true,
"tags": {},
"durationSeconds": 2333.7
}
]

}

API explorer doesn't have the upload endpoint in it. You need to write code (in whatever language you choose) to post to the uploadUri. The body will be formdata with your file recording in it. You need to add the Authorization header to your request. You will get a 200 OK back. Purecloud will transcode the file to the appropriate format which can take a couple seconds. When it's done, the prompts/id/resources/language endpoint will show the uploadStatus as transcoded.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.