@vineethpai99/mybot
v2.0.9
Published
This package allows to add chatbot to your application.
Downloads
13
Maintainers
Readme
Qualetics Chatbot
This package allows to add chatbot to your application.
npm.js
https://www.npmjs.com/package/@vineethpai99/mybot
Usage
Example:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Chatbot SDK Example</title>
<link rel="stylesheet" href="style.css" />
</head>
<body id="page_body_id">
<button onclick="openMyBot" style="padding: 20px; margin: 40px">
click to open chatbot
</button>
<script type="module">
import "https://cdn.jsdelivr.net/npm/@vineethpai99/mybot@<version-here>/dist/bundle.js";
// Wait for the bundle to be loaded
window.addEventListener("load", () => {
// Access the ChatbotSDK class from the global scope
const chatbot = new window.ChatbotSDK({
BASE_URL: "<API_BASE_URL>",
headers: {}, // api headers
payload: {}, // api payload
});
let config = {
color: "<YOUR_APP_COLOR_CODE>", //default --> "#6d47e0"
fontFamily: "<YOUR_APP_FONT_FAMILY>", //default -->"Poppins, sans-serif"
};
chatbot.initChatbot(config);
function openMyBot() {
chatbot.openChatbot("page_body_id"); // --> pass html body id
}
});
</script>
</body>
</html>