We provide a Javascript API that allows you to have control over the functionality of the TrueEngage widget.

Once you have embedded the TrueEngage code, the trueengage object will be accessible globally. You can utilize this object to engage with the TrueEngage widget.

Events API

The Events API allows you to bind a custom JavaScript function to an event. For example, your function can be invoked every time the interaction is started.

Available events:

widget_opened

The event occurs when the widget window has been opened.

trueengage.on("widget_opened", () => { 
	console.info("Widget window has been opened"); 
});

chat_started

The event occurs when the user has started the chat session. Two parameters are passed to the callback: messageId and visitorId.

trueengage.on("chat_started", (messageId, visitorId) => { 
	console.info(messageId); 
});

Data API

This API allows you to retrieve useful information stored in the widget, such as visitor and widget status.

Available properties:

trueengage.get("visitorId"); //returns 'fc9ba53a-f862-416e-a852-44206d793df8'
trueengage.get("audioRemoteName"); //returns 'TrueEngage webrtc +href' or custom