Unsolicited Responses
An unsolicited response is the action of a digital human speaking without a direct request from the end user, in other words, when a digital human speaks without a question being asked.
It should be noted that the digital human speaks an unsolicited response only if it is silent. They do not interrupt the user while they are asking questions or when the digital human is speaking.
UneeQ's platform exposes an API which allows for this kind of response push model - it is authenticated based on customer's JWT secret and is not accessible via the SDK.
You can send multiple unsolicited response payloads to the UneeQ /speak endpoint and they will be queued for processing. In this way you can continuously cause the digital human to speak as though reading from a teleprompter.
In order to make a digital human speak, an unsolicited response and instructions can be sent to the UneeQ server via an HTTP POST request.
To send a request to the UneeQ unsolicited responses (/speak) endpoint, you must use the appropriate host for your region:
Region | Region URL |
---|---|
North America | https://api.us.uneeq.io |
Europe | https://api.eu.uneeq.io |
Oceania | https://api.au.uneeq.io |
In the example above, when a 200 OK message is returned with no body, the request has succeeded and the digital human should have spoken the text passed.
You may see a status 200 with a message that indicates a failure such as the example in the 400 response above, stating that the session has already ended. In this case, the avatarSessionId used belongs to a terminated session. Start a new session with your digital human, and retrieve the new avatarSessionId to try again.
⚠️ If answerAvatar is null or empty, it will be automatically populated with the answer value. You can specify "{}" in answerAvatar if you wish to avoid this.
⚠️By default your answer value will be automatically populated in the AvatarAnswerContentMessage content property, unless you instruct to displayHTML in your request via answerAvatar, in which case the HTML content will be populated.
This is obtained by encrypting the following JSON with the customer JWT secret:
Below are sample javascript codes to generate the sessionIdJWT in two different ways:
The response will be JSON with a content type of application/json.
Code | Status | Response | Reason |
---|---|---|---|
204 | No Content | | Successfully sent unsolicited response |
400 | Bad Request | { "error": ERROR_DESCRIPTION } | Request body/headers are invalid |
401 | Unauthorized | { "error": ERROR_DESCRIPTION } | sessionIdJWT is invalid |
403 | Forbidden | { "error": ERROR_DESCRIPTION } | Authorization failed |
406 | Not Acceptable | { "error": Avatar response queue limit reached } | A message has been requested to speak when 25 existing messages are yet to be delivered |
500 | Server Error | { "error": ERROR_DESCRIPTION } | Error encountered on server |
Currently, the API accepts a maximum of 25 messages to be queued at a time. If more than 25 messages are queued to be spoken, the API returns a 406 Not Acceptable until the existing messages have been dropped, i.e have been spoken by the digital human completely.
This API is secured by verifying that the payload has a sessionId signed using the JWTSecret. This makes sure that the request is coming from a valid client.
This API should always be driven by a backend service, rather than a Front-end app.