JavaScript APIs
The JavaScript APIs are an optional add-on to the integrated visitor UIs.
-
Floating JS API, previously known as Visitor JS API
They allow JavaScript to access and control certain functions related to the visitor UIs.
The Floating and Embedded JS APIs are both available on npm. This allows you to integrate the Unblu JS APIs into your web application with a simple import '@unblu/floating-js-api'
or import '@unblu/embedded-app-component'
statement in your code.
You can search for @unblu
or use the direct links provided below:
Concepts
The Floating JS API allows you to load, access, and control the Floating Visitor UI inside your website. The API directly accesses and communicates with the loaded Unblu code. Any interaction with the API is reflected in the Floating Visitor UI. For example, if a conversation is opened via the API, it will also be visible in the Floating Visitor UI.
The Floating JS API can only perform actions that the current visitor has the right to perform. For example, if a visitor is allowed to end a conversation, this may be done via the API. If not, an API call to end the conversation fails with an error.
The Floating JS API is meant to be used for actions directly connected to the current visitor and that visitor’s usage of the Floating Visitor UI. This includes things like automatically starting a conversation or starting a call within a conversation that the visitor is already part of.
For actions that require rights beyond those the local visitor has, or that should be independent of the visitor’s UI, consider using the Unblu web API either directly in JS or via custom REST services provided by your own server.
The Embedded JS API is based on the Floating JS API and provides similar functionality for the Embedded Visitor UI.
Reference and examples
For information on how to integrate the JS APIs with your website, see:
The reference documentation is updated with the changes of the latest Unblu version.
The reference documentation includes examples to help get you started. Additional examples for both the Floating and Embedded JS API are available from our GitHub repository.
If you’re running an older version of Unblu, you might prefer to view the documentation pages directly from your Unblu server. Those pages describe the JS APIs as they’re available on your server. To make the pages available, enable com.unblu.server.resources.enableDocResources.
You can find your local documentation pages at the following addresses:
For the Floating JS API:
<unblu-server>/unblu/static/js-api/v8/floating/doc/index.html
For the Embedded JS API:
<unblu-server>/unblu/static/js-api/v8/embedded/doc/index.html