Chatbox API

Integrate your front-end to our chatbox

Function
Description
open()
Opens the chatbox on homepage
close()
Closes the chatbox whenever possible
disable()
Hides the typing input
enable()
Shows the typing input
sendMessage(string message)
Opens the chatbox & goes to the messaging then sends a message from user-side to the chatbot API and injects it to the chatbox
sendBotMessage(string message)
Opens the chatbox & goes to the messaging then sends a message from bot-side and injects it to the chatbox
sendToast(string message)
Sends toast notification to user beside of the chatbox
setUser(string username, string name, object otherData)
Sets specific user information instead of random information generation
setDriver(string driver)
Sets your alternative (live) chatbox to hide and show
setSide(string side)
Sets chatbox side between right or left
setDistance(int distance)
Sets chatbox distance from left or right based on its side by px units
setBottomDistance(int distance)
Sets chatbox distance from bottom by px units
setDirection(string direction)
Sets chatbox direction from rtl or ltr
setScroll(int scroll)
Sets the required margin from top (offset from the top) to show the toast messages by px
set(string name, string value)
Sets any CSS-level changes on the chatbox
setWidth(int width)
Sets chatbox width by px

Example
Uses from window.addEventListener() inside a script tag

window.addEventListener('rotic-start', function (event) {
    Rotic.setScroll(1900);
    Rotic.setSide('left');
    Rotic.setUser("00989121234567", "Dr. Hessabi")
});
                             
Uses from Rotic.function() inside a script tag or as an onClick function argument

Rotic.sendMessage("hello");