By defining a _slaaskSettings
object in window
, you can interact with our Slaask chatbox programmatically.
Here is a list of all supported features.
window._slaaskSettings = {
identify: function() {
return {
id: 1234,
name: "John Doe"
}
},
key: "your-public-key",
anonymousToken: "abCDefGHijKLmnOPqrSTuvWXyz",
noCookie: false,
options: {
bot_tree: "8d661a68-f5e7-11eb-9a03-0242ac130003",
cdn_url: "https://proxy.mydomain.com/",
color: "#27c469",
custom_css: {
button: "div { color: black; }",
},
custom_url: "https://proxy.mydomain.com/",
debug: false,
display_bubble: true,
favicon_counter: true,
force_loading: false,
hide_button: false,
language: "en",
make_room_for_topbar: true,
open_in_popup: false,
pulse: true,
save_open_state: false,
team_id: 423
},
autoInit: true,
onInit: function(_slaask) {
_slaask.show();
}
}
This function will help you provide information regarding your Contact to Slaask. More details about this function can be found on your "Deploy" page and in this post: Enabling Slaask to work with Single-Page Application (SPA)
The public brand key that represents a unique identifier for your brand.
Forces the randomly generated token for anonymous users.
By setting this parameter to true
, the token used to track the contact across their navigation won't be stored in any persistent storage. It will be stored in a temporary variable that will be erased after unloading the page. It means that the contact will generate a new identity and won't recover their past conversations upon each page load.
An object containing options that will modify the behavior of your chatbox.
bot_tree
: Ask your widget to start a specific conversation flow instead of the one specified by your flow trigger. You can find its UUID by seleting it in your flows list, then clicking on "Advanced info".
cdn_url
: The widget will load all needed resources using this URL. This URL should be a A or a CNAME pointing to https://cdn.slaask.com servers.
color
: Changes the main color of your widget.
custom_css
: See Add custom CSS to your chatbox for more information.
custom_url
: The widget will load all needed resources and HTTP requests using this URL. This URL should be a A or a CNAME pointing to slaask.com servers.
debug
: Displays more debug info in the console.
display_bubble
: Allows you to remove the welcome bubble to appear programmatically.
favicon_counter
: Allows you to prevent the chatbox from updating your favicon to show the unread messages counter.
force_loading
: Some chatbox configurations may prevent it from loading, when in delayed mode or on mobile for instance. Setting this parameter to true will bypass these configurations and ensure the chatbox is loaded anyway.
hide_button
: Will hide the button that opens the chatbox, while still having it loaded.
language
: Forces the language used in the chatbox.
make_room_for_topbar
: When the "topbar" automated communication appears, it is moving down the whole document to avoid having elements overlapping with it. While it may be desirable on static websites, it may cause side effects on more dynamic websites. Padding false to this option will disable this behavior.
open_in_popup
: The chatbox will open in a separate window instead of being embedded on the page. Note that some features like page screenshots won't be available.
pulse
: Forces the pulse animation to be displayed or hidden.
save_open_state
: By default, changing page with the chatbox open will cause the chatbox to open again. Setting this option to false will prevent the chatbox from storing opening state when it is changed.
team_id
: See Automatically assign a Team to your Contacts for more information.
Your chatbox will use your _slaaskSettings
to initialize itself automatically. If you want it to be initialized by yourself manually, you can set this setting to false
. You will then have to initialize the chatbox using _slaask.identifyContact()
.
By default, the Slaask script is loaded asynchronously. If you need to add a custom JavaScript code that needs the _slaask
object to be available, you can add your code here. Please note that this function is fired as soon as the _slaask
element is available, which mean the chatbox may not be fully initialized yet. Some functions may require the ready
event to be fired beforehand with _slaask.on('ready', function() {})
.