Assistant
The Assistant class is the main entry point of the Assistants SDK. It runs in Node.js and provides everything that you need to connect an AI agent into a Whereby room - to access in-room audio and video streams, manage in-room actions and integrate with external services of your choice.
Constructor
const assistant = new Assistant(options: AssistantOptions)AssistantOptions
assistantKey
string
-
Assistant key generated from the Whereby Dashboard
Methods
Room Lifecycle
To join a room or to then subsequenty perform any in-room actions, the following methods are available.
joinRoom
roomUrl: string
Promise<RoomJoinedSuccess>
Connects the assistant to the specified room. In case the room can not be joined the Promise will be rejected with a room joined error code.
Media
To obtain audio and/or media streams from the room or if you want to inject audio and/or video back in to the room from the Assistant then you can use the following media APIs to do so.
startLocalMedia
Creates and starts local audio and/or video media for the assistant based on parameters and returns media objects that can be used to inject media data in to the room
stopLocalMedia
void
Stops local media for the assistant
getCombinedAudioSink
AudioSink | null
Returns a raw audio sink object containing all in-room audio combined on a single audio channel.
Events
Assistant extends EventEmitter . You can listen to lifecycle and state change events directly:
ASSISTANT_JOINED_ROOM
{ roomUrl: string }
Assistant has joined the room
ASSISTANT_LEFT_ROOM
{ roomUrl: string }
Assistant has left the room
PARTICIPANT_VIDEO_TRACK_ADDED
A remote participant has added or changed a video track
PARTICIPANT_VIDEO_TRACK_REMOVED
{
participantId: string;
trackId: string
}
A remote participant has removed a video track
PARTICIPANT_AUDIO_TRACK_ADDED
A remote participant has added or changed an audio track
PARTICIPANT_AUDIO_TRACK_REMOVED
{
participantId: string;
trackId: string
}
A remote participant has removed an audio track
Last updated
Was this helpful?

