Talk JavaScript API

This page provides a list of the available JavaScript methods and events available from Ortto’s API for controlling Ortto’s Talk messenger widget programmatically.

The methods and events described on this page can be configured in your website’s JavaScript or in your website’s tracking code, depending on your needs. Learn more at Talk messenger methods.


The set:style and reset:style methods enable you to set/reset custom styling for the widget icon container.

The following example shows a custom background color and border for the widget icon container.

javascript'set:style', { container: { backgroundColor: 'red', border: '1px solid blue', }, });'reset:style');


There are 4 available methods to open/close and show/hide the widget, as shown below.


//open the widget'open'); //close the widget'close'); //hide the widget'hide'); //show the widget'show');


The Talk messenger widget loads asynchronously, so the ready event enables you to check whether the widget is already loaded.

The following shows an example for using ready to notify when the widget is loaded:


//talk.ready flag; //print to notify when ready const notifyWhenReady = () => { console.log('ready'); }; //notify when ready'ready', notifyWhenReady); //stop notifying'ready', notifyWhenReady);


The start-conversation command enables you to start a conversation containing a predefined message sent by the customer or visitor. 

The following shows an example for a conversation starting with the initial message "Call me":

javascript'start-conversation', {initialMessage: 'Call me'})