JavaScript API

The main library for interacting with the system through browser window. The code for the connection, which is provided on carrot app registration, asynchronously loads this library (https://cdn.dashly.app/api.min.js).

After the code is added to the site, a global dashly object will be created, which is needed for access to interactions with the Javascript API. For example, to call the track method, you need to write dashly.track (...)

Methods

Method Description
connect Connection to the system
track Event tracking
identify User properties identification
auth Sending User ID
open Chat opening
onReady Put a callback, which will be called after the script is loaded
addCallback Set callback
removeCallback Remove callback
trackMessageInteraction Tracking the message interactions (reading, clicking, replying)

Callbacks

Dashly allows adding handler functions which are called when certain conditions occur. For example, when you open a chat, receive an auto message, send a message to the dialog, when the conversation starts, etc. We call these functions callbacks.

Use the addCallback method to set the callback and removeCallback to remove.

Dashly ID

After downloading the script and establishing a connection to the system, each user has an identifier. It is stored in the cookie dashly_uid.

You can store this ID for yourself to access the Web API in the future.

Important! Not that dashly_uid can change its value during chat lifetime in case user auth process is called.