About
Explore
Events & Classes
Support Us
Join
Sign In
Coding with Rumaysa
View Project Page
Run
Fullscreen
Rumchat Demo
HTML
CSS
JS
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Chatbot</title> <script src="https://rumchat.just9tech.com/js/main.js"></script> </head> <body> <h1>I am a sample page</h1> <div id="chatbtn"></div> <div id="chatbox"></div> </body> </html>
rumchat(false,'The Bot','chatbtn','chatbox','#bff','yellow','pink','black'); function respond(appName,clientmsg,support,writeto) { if(clientmsg=="hello"||clientmsg=="hi"||clientmsg=="hiya"||clientmsg=="hey there") { var supportmsg = document.createElement("div"); supportmsg.classList.add("msg"); supportmsg.classList.add("support"); supportmsg.setAttribute("style","background-color:"+support+";"); responses = ['Hello!','Hello! How can I help you today?','Hi!','Hello there!']; response = responses[Math.floor(Math.random() * responses.length)]; supportmsg.innerHTML = response; writeto.appendChild(supportmsg); } else if(clientmsg=="fine"||clientmsg=="good"||clientmsg=="okay"||clientmsg=="ok") { var supportmsg = document.createElement("div"); supportmsg.classList.add("msg"); supportmsg.classList.add("support"); supportmsg.setAttribute("style","background-color:"+support+";"); responses = ["That's good. How can I help?","That's good."]; response = responses[Math.floor(Math.random() * responses.length)]; supportmsg.innerHTML = response; writeto.appendChild(supportmsg); } else if(clientmsg=="how to use rumchat"||clientmsg=="how do i use rumchat"||clientmsg=="how to do i use rumchat?") { var supportmsg = document.createElement("div"); supportmsg.classList.add("msg"); supportmsg.classList.add("support"); supportmsg.setAttribute("style","background-color:"+support+";"); responses = ['Go to https://website.com/blog/rumchat','I can explain. Would you like me to tell you?','You can subscribe to Coding with Rumaysa, she has a tutorial there.']; response = responses[Math.floor(Math.random() * responses.length)]; supportmsg.innerHTML = response; writeto.appendChild(supportmsg); } else { var supportmsg = document.createElement("div"); supportmsg.classList.add("msg"); supportmsg.classList.add("support"); supportmsg.setAttribute("style","background-color:"+support+";"); supportmsg.innerHTML = "Sorry, I don't understand."; writeto.appendChild(supportmsg); } }