Tiledesk Docs
Search…
Widget SDK

Tiledesk Widget

Widget SDK ver 5.0
Are you interested in the v4 version? Click here.
This guide will show you how to get started as quickly as possible with the Widget SDK from Tiledesk. The Widget SDK will give businesses and developers the flexibility to build and customize a chat experience that meet their specific design/brand requirements.

How to install

To chat with your visitors embed the widget on your site. Copy the following script and insert it in the HTML source between the HEAD tags:
1
<script type="application/javascript">
2
var PROJECT_ID = "<<TILEDESK_PROJECT_ID>>"
3
window.tiledeskSettings=
4
{
5
projectid: PROJECT_ID
6
};
7
(function(d, s, id) {
8
var w=window; var d=document; var i=function(){i.c(arguments);};
9
i.q=[]; i.c=function(args){i.q.push(args);}; w.Tiledesk=i;
10
var js, fjs=d.getElementsByTagName(s)[0];
11
if (d.getElementById(id)) return;
12
js=d.createElement(s);
13
js.id=id; js.async=true; js.src="https://widget.tiledesk.com/v5/launch.js";
14
fjs.parentNode.insertBefore(js, fjs);
15
}(document,'script','tiledesk-jssdk'));
16
</script>
Copied!
To get your TILEDESK_PROJECT_ID go to the Tiledesk Dashboard and click on the Widget item of the menu:
Tiledesk Dashboard

Install with visitor basic information

Website visitors are generally leads (visitors if they have not communicated via the Messenger) whereas logged in users are Tiledesk users already logged in onces. The main difference is the amount of information you know about them. You can pass basic information throught tiledeskSettings object. An example is provided below.
1
<script type="application/javascript">
2
var PROJECT_ID = "<<TILEDESK_PROJECT_ID>>"
3
const USER_FULLNAME = "James Smith";
4
const USER_EMAIL = james.[email protected].com"
5
window.tiledeskSettings=
6
{
7
projectid: PROJECT_ID,
8
userFullname: USER_FULLNAME,
9
userEmail: USER_EMAIL
10
};
11
(function(d, s, id) {
12
var w=window; var d=document; var i=function(){i.c(arguments);};
13
i.q=[]; i.c=function(args){i.q.push(args);}; w.Tiledesk=i;
14
var js, fjs=d.getElementsByTagName(s)[0];
15
if (d.getElementById(id)) return;
16
js=d.createElement(s);
17
js.id=id; js.async=true; js.src="https://widget.tiledesk.com/v5/launch.js";
18
fjs.parentNode.insertBefore(js, fjs);
19
}(document,'script','tiledesk-jssdk'));
20
</script>
Copied!

Install with custom position

Sometimes you may want to show Tiledesk Widget on left or right side of your website. Moreover, you may also want to get more/less distance between widget and website margin. The following example shows a widget aligned on left side and with custom margin from X and Y axis.
1
<script type="application/javascript">
2
var PROJECT_ID = "<<TILEDESK_PROJECT_ID>>"
3
4
window.tiledeskSettings=
5
{
6
projectid: PROJECT_ID,
7
align: 'left',
8
marginX: '200px',
9
marginY: '150px'
10
};
11
(function(d, s, id) {
12
var w=window; var d=document; var i=function(){i.c(arguments);};
13
i.q=[]; i.c=function(args){i.q.push(args);}; w.Tiledesk=i;
14
var js, fjs=d.getElementsByTagName(s)[0];
15
if (d.getElementById(id)) return;
16
js=d.createElement(s);
17
js.id=id; js.async=true; js.src="https://widget.tiledesk.com/v5/launch.js";
18
fjs.parentNode.insertBefore(js, fjs);
19
}(document,'script','tiledesk-jssdk'));
20
</script>
Copied!
Custom position of the widget: property explanation

Enabling authenticated visitors in the Chat widget

You can configure your widget to authenticate visitors using the Javascript API and JWT token. More info Widget Authentication