Javascript API: Methods
Tiledesk provides a Tiledesk JavaScript object that responds to a few methods. These allow you to update widget without a page refresh and interact with the messenger window.
Open the widget
This will open the widget:
Minimize the widget
This will minimize the widget:
Hide the widget
This will hide the widget:
Show the widget
This will show the widget:
Dispose the widget
This will clear the widget html elements from the DOM:
Reinitialize the widget
If your app is characterized by very few page refreshes (ie., content is swapped out on the client side but no page refresh happens, Angular, React, jQuery, etc..) and lots of asynchronous JS, you'll need to update Tiledesk when your user's data changes. A reInit call simulates a page refresh, causing Tiledesk to reload the widget and all the configurations.
Restart the widget
This method allow you to restart widget with the same user's data without make a new authentication. This also mantein all the configurations.
Signin with anonymously
This method make a signin anonymously
Signin with JWT Custom Token
This method make a signin using a JWT Custom Token as described here.
Make a logout
This will logout the widget:
Show callout
This will show the widget callout if it is not open:
Show or hide the PreChatForm
This parameter configures the PreChatForm visibility:
Set custom PreChatForm Json
This method allow you to customize preChatFormJson property, and change preChatForm structure if preChatForm is still active (ensure preChatForm value is set to true, otherwize use window.Tiledesk('setPreChatForm', true) method before call setPreChatFormJson ). This method accept an Array (see docs for more detail about customize it):
Get custom PreChatForm Json
This method allow you to get current preChatForm Json array used in the preChatForm component when is active (check preChatForm value is set to true):
Set new value to Widget parameter
You can change a value to the Tiledesk Widget parameter. Pass an object in the form of key/value, where key represent che name of the property you want to modify, and value is the new value you want to set:
Set new value to Widget attribute parameter
You can change a value to the Tiledesk Widget attribute parameter. Pass an object in the form of key/value, where key represent che name of the property you want to modify, and value is the new value you want to set:
Start a new conversation
You can programatically start a new conversation:
Open a conversation from a specif ID
You can programatically open an already existing conversation by id in the form of 'support-group-'+<project_id>+'-'+uuid
Clear site data
You can programatically clear saved session data :
Last updated