Methods
Call various Trengo methods to execute one of the actions specified below. All methods live on the window.Trengo.Api.Widget
object.
Open the widget
Use this method to open the Trengo widget. You need to specify the channel type as the default tab.
window.Trengo.Api.Widget.open('[CHANNEL_TYPE]');
// For example:
window.Trengo.on_ready = function() {
window.Trengo.Api.Widget.open('chat');
}
Available channel types are: chat
, email
, facebook
, twitter
, sms
, voice
, help_center
, whatsapp
.
Close the widget
Close / collapse the Trengo widget.
window.Trengo.Api.Widget.close()
Check if the vistor is chatting
Returns true
or false
window.Trengo.Api.Widget.is_chatting()
Programmatically render the widget
Only works when window.Trengo.render
is set to false
.
window.Trengo.render = false;
setTimeout(function() {
window.Trengo.Api.Widget.render();
}, 2500);
Notify the Greeter about a new page URL
When using Trengo within a single page application, you need to trigger the greeting mechanism when the page URL is updated.
window.Trengo.Api.Widget.url_updated();
Updated about 3 years ago