import {connect} from 'diarupt';
...
    const next = (event, data) => {
        // handle events
        console.log(event, data);
    }

    // starts the interaction
    await connect(
        session_id,
        options,
        next
    )
...

Interaction Events are events that are triggered when interaction with and AI. These event help you manage state and other workflows in your application.

See Connect on how to handle these events

Event Types

Open

event
open
required

This event is triggered when the Interaction connection is opened and ready to send and receive data

data
string
required

This is a string message, e.g “data channel opened”

User Started Talking

(Hands-on mode event)

event
user-started-talking
required

This event is triggered when the user starts talking

data
null
required

No data is returned

User Stopped Talking

(Hands-on mode event)

event
user-stopped-talking
required

Emitted after user stop talking plus the when handsOnTimeout elapses.

data
string
required

No data is returned

Close

event
close
required

This event is triggered when the Interaction connection is close. This can happen for a number of reasons, including the user closing the browser tab or window, calling the disconnect function, or the connection being lost.

data
string
required

This is a string message, e.g “data channel closed”

Transcript

event
error
required

This event is used to sends a real-time interaction transcript to client from the server

data
object
required

This return an object with the following properties

Error

event
error
required

This event is triggered when their is an error with the webrtc connection or any other error duting the interaction

data
Error
required

This return a javascript javascript Error object