Use the Vocalization API to submit a text message to PhoneMyBot, and receive back a voice file with the text spoken in the language and voice of your choice.
Use this method to cause PhoneMyBot to render a text as a voice message:
The output is an audio in '.ogg' or '.wav' format.
The following parameters should be included in the JSON body of the request:
Name | Type | Description |
---|---|---|
subscription | string | the subscriptionId provided in the set-up of the API configuration |
requestid | string | unique identifier of this request, an arbitrary identifier choosen by the sender and that can help to correlate requests with responses (the value provided in the request is returned "as-is" in the response) |
text | string | Text to be synthetized. |
audioformat | string | the output format: 'audio/ogg' or 'audio/wav' |
language | string | language user to generate the speech |
The HTTP header of the message must include basic authentication as authorization: Basic {security-token}
, where the 'security token' is provided in the set-up of the API configuration.
Possible responses:
Where the response will include the audio file.
{
"subscription": "{subscription-id}",
"requestid": "{request-id}",
"requesttype": "vocalize",
"result": {
"success": false,
"code": "OFFLINE_002",
"description": "Mandatory field subscription is missing"
}
}
Example:
{
"subscription": "{subscription-id}",
"requestid": "{request-id}",
"requesttype": "vocalize",
"result": {
"success": false,
"code": "OFFLINE_003",
"description": "Subscription disabled"
}
}
{
"subscription": "{subscription-id}",
"requestid": "{request-id}",
"requesttype": "transcribe",
"result": {
"success": false,
"code": "OFFLINE_009",
"description": "System error"
},
}