4min

Event handling

There may be times when you want even more fine tuned control of your client application, and to synchronise your website with the state of the digital human. For this, we provide message events from the digital human application that may be consumed by your web client. To do this, you may listen to window event UneeqMessage.



Example

The below code example demonstrates how you can listen for messages, and in this case update the class list of the body element when the session becomes live. There are many more message events you may want to listen for, these are listed in the table below.

JS
|



Message List

Event Name

Description

SessionStateUpdate

Session state has been updated (Initial, WaitingToStart, AvatarUnavailable, MajorError, Live, Paused, Ended)

SessionId

The digital human session ID

AvatarAvailable

At least one digital human is available to be started

AvatarUnavailable

No digital humans are available to be started

AvatarQuestionText

A question was asked to the Digital Human

AvatarAnswer

Digital human has a response

AvatarAnswerContent

Content has been provided by the NLP system to be rendered

Instructions

Full JSON instructions that were provided to the NLP. This data can be used to pass custom instructions from the NLP system into your front end application

StartedSpeaking

Digital human has begun speaking

FinishedSpeaking

Digital human has finished speaking

DeviceEnabled

Permission to use recording devices has been granted by the user.

RecordingStarted

A voice recording has been initiated

RecordingStopped

A voice recording has been ended

DevicePermissionAllowed

[Deprecated]

AvatarTextInputFinished

[Deprecated]