Events - Agent Workspace

Events

StateChanged (Subscribing)

Subscribes a callback function to-be-invoked whenever an agent state changed event occurs.

Signature

onStateChanged(handler: AgentStateChangedHandler)

Usage

const handler: AgentStateChangedHandler = async (data: AgentStateChangedEventData) => { console.log("Agent state change occurred! " + data); }; agentClient.onStateChanged(handler); // AgentStateChangedEventData Structure { state: string; previous: { state: string; }; }

Permissions required:

User.Status.View

StateChanged (Unsubscribing)

Unsubscribes the callback function from the agent stated change event.

Signature

offStateChanged(handler: AgentStateChangedHandler)

Usage

agentClient.offStateChanged(handler);