HTML SDK
Install the Chatness SDK for HTML by injecting the Chatness script tag into a website. The SDK provides a simple way to interact with Chatness API and customize the widget behavior.
Installation
To install the Chatness widget using just HTML, click the rocket
button in the top/right corner and copy the code snippet provided into the website's HTML inside the <head>
tag.
<html>
<head>
<script>
// code snippet
// goes here...
</script>
</head>
<body>
<!-- Your content -->
</body>
</html>
The code snippet will look like this:
(function() {
const script = document.createElement('script');
script.id = 'chatness';
script.type = 'module';
script.src = 'https://cdn.chatness.ai/scripts/widget.mjs?bot={botId}';
script.async = true;
document.head.appendChild(script);
})();
The {botId}
part can be replaced with the bot's ID. The bot ID is available on the Chatness app settings page, or it may be mentioned in the email received from the developer during the quick onboarding process.
Widget interactivity
After installing the widget, all methods provided by the window
object for interacting with the widget. Below is an example of opening the widget programmatically:
<button id="openChatness">Open Chatness Widget</button>
<script>
document
.getElementById('openChatness')
.addEventListener('click', function() {
// call the SDK method to open the widget
window.Chatness.widget.open();
});
</script>
Get started with Chatness this afternoon
Each subscription goes towards aggressively adding new features built with customers' best interests at heart, including your privacy.