Tiledesk Developer Hub
WebsiteCommunityTutorialsGet started
  • Introduction
  • Community
  • Ask for Support
  • Public Roadmap and Changelog
  • Tutorials
  • Widget
    • Widget SDK
    • Javascript API: Methods
    • Javascript API: Attributes
    • Javascript API: Listeners/Events
    • Widget Authentication
    • Widget Angular integration
    • Widget React integration
    • Widget for Android with WebView
    • Widget for iOS with WKWebView
    • Widget for Flutter with WebView
    • Widget for React with WebView
    • Widget for Wix Website platform
    • Tutorials
      • Hide widget
      • Show/Hide widget programmatically
      • Force widget loading without user interaction
      • Mobile positioning
      • Custom size (width/height)
      • Installing widget on selected pages
    • Conversation Embedded Apps
      • Payment App Tutorial
      • Prechat form App Tutorial
    • Advanced
      • Preset the Widget on a specific Department
      • Authentication Flow
      • Widget protocol specs
      • Prechat Form JSON specs
      • Prevent multiple conversations
      • Old versions
        • Web SDK v4
  • External Chatbot
    • Introduction
    • Hello World tutorial
    • Chatbot to Human handoff
    • Send Text Buttons
    • Advanced Tutorials
      • Introduction
      • Tutorial 1 - Dialogflow as external chatbot
      • Tutorial 2 - Buttons and images
      • Tutorial 3 - Automatic human handoff with fallback intent
      • Tutorial 4 - Explicit Human handoff with user intent
      • Tutorial 5 - Gracefully handling operating hours during handoff
      • Generate Dialogflow Google Credentials file
    • Rasa tutorials
      • Rasa Tutorial 1 - Rasa as external chatbot
  • Resolution bot
    • Introduction
    • Quickstart
    • Webhook service
    • Rich messages
    • Tutorials
      • Chatbot chooser (multilanguage)
      • Department chooser
      • Order info (webhook)
  • APIs
    • REST APIs
      • Introduction
      • Authentication
      • Requests
      • Leads
      • Messages
      • Activities
      • Projects
      • Team
      • User
      • Analytics
      • Canned responses
      • Tags
      • Events
      • Jwt
      • Labels
      • Images
      • Files
      • Segments
      • Chatbots
      • Knowledge Bases
        • Knowledge Base
        • Contents
        • Question & Answer
      • Management Api
        • Departments
        • Groups
    • NodeJS SDK
    • Webhooks
      • Subscriptions
    • Conversation Messages APIs tips
    • Realtime API
    • JWT Authentication
      • JWT Custom authentication Tutorial
    • Tutorials
      • REST API
        • Sending and receiving messages with Tiledesk APIs
        • PHP Tiledesk REST API example
        • Import multiple messages into Tiledesk using REST APIs from third party app
      • Webhooks
        • Custom Request assignment
        • Request transcript on close
  • Apps
    • Build Custom App - Quick start
    • External Channels integration flow diagram
    • Telegram integration tutorial
  • Dashboard & AgentChat SDK
    • Dashboard SDK
    • Agent Chat SDK
  • Architecture
    • Architecture overview
    • Components list
    • Bot Design diagram
    • Multi Channel Message Flow
  • Installation
    • Installation
    • Running Tiledesk using Docker Compose
    • Running Tiledesk with Kubernetes using Helm
    • Choosing Hardware
  • Configuration
    • Chat21 channel configuration
    • Email parameters and templates configuration
    • Configure the logging system
Powered by GitBook
On this page
  • Open the widget
  • Minimize the widget
  • Hide the widget
  • Show the widget
  • Dispose the widget
  • Reinitialize the widget
  • Restart the widget
  • Signin with anonymously
  • Signin with JWT Custom Token
  • Make a logout
  • Show callout
  • Show or hide the PreChatForm
  • Set custom PreChatForm Json
  • Get custom PreChatForm Json
  • Set new value to Widget parameter
  • Set new value to Widget attribute parameter
  • Start a new conversation
  • Open a conversation from a specif ID
  • Clear site data

Was this helpful?

  1. Widget

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:

window.Tiledesk('open');

Minimize the widget

This will minimize the widget:

window.Tiledesk('close');

Hide the widget

This will hide the widget:

window.Tiledesk('hide');

Show the widget

This will show the widget:

window.Tiledesk('show');

Dispose the widget

This will clear the widget html elements from the DOM:

window.Tiledesk('dispose');

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.

window.Tiledesk('reInit');

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.

window.Tiledesk('restart');

Signin with anonymously

This method make a signin anonymously

window.Tiledesk('signInAnonymous');

Signin with JWT Custom Token

window.Tiledesk('signInWithCustomToken', customJwt);

Make a logout

This will logout the widget:

window.Tiledesk('logout');

Show callout

This will show the widget callout if it is not open:

window.Tiledesk('showCallout');

Show or hide the PreChatForm

This parameter configures the PreChatForm visibility:

window.Tiledesk('setPreChatForm', true|false);

Set custom PreChatForm Json

window.Tiledesk('setPreChatFormJson', customFormArray);

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):

window.Tiledesk('setPreChatFormJson', customFormArray);

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:

window.Tiledesk('setParameter', {key: string, value: string});

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:

window.Tiledesk('setAttributeParameter', {key: string, value: string});

Start a new conversation

You can programatically start a new conversation:

window.Tiledesk('startConversation');

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

window.Tiledesk('openConversationById', conversation_id);

Clear site data

You can programatically clear saved session data :

window.Tiledesk('clearStorage');
PreviousWidget SDKNextJavascript API: Attributes

Last updated 12 months ago

Was this helpful?

This method make a signin using a JWT Custom Token as described .

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 for more detail about customize it):

here
docs