{"id":66,"date":"2024-05-25T12:11:20","date_gmt":"2024-05-25T12:11:20","guid":{"rendered":"https:\/\/moa.mybusinessconsulting.in\/?page_id=66"},"modified":"2024-06-01T09:01:39","modified_gmt":"2024-06-01T09:01:39","slug":"chatbot","status":"publish","type":"page","link":"https:\/\/moa.mybusinessconsulting.in\/index.php\/chatbot\/","title":{"rendered":"Chatbot"},"content":{"rendered":"\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"UTF-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n<title>Consultant Chatbot<\/title>\n<style>\n    body {\n        font-family: Arial, sans-serif;\n        background-color: #f4f4f4;\n        margin: 0;\n        padding: 0;\n        display: flex;\n        justify-content: center;\n        align-items: center;\n        height: 100vh;\n    }\n    \n    #chat-container {\n        width: 100%;\n        max-width: 400px;\n        background-color: #fff;\n        border-radius: 10px;\n        box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);\n        overflow: hidden;\n    }\n    \n    #chatbox {\n        height: 300px;\n        border-bottom: 1px solid #ccc;\n        padding: 10px;\n        overflow-y: scroll;\n    }\n    \n    #userInput {\n        width: calc(100% - 80px);\n        padding: 10px;\n        border: none;\n        border-top: 1px solid #ccc;\n        font-size: 16px;\n    }\n    \n    #sendButton {\n        width: 80px;\n        padding: 10px;\n        border: none;\n        border-top: 1px solid #ccc;\n        background-color: #4CAF50;\n        color: #fff;\n        font-size: 16px;\n        cursor: pointer;\n    }\n    \n    @media only screen and (max-width: 400px) {\n        #chat-container {\n            max-width: 100%;\n        }\n    }\n<\/style>\n<\/head>\n<body>\n<div id=\"chat-container\">\n    <div id=\"chatbox\">\n        <p>Tax Consultant: Hi there! \ud83d\udc4b What&#8217;s your name?<\/p>\n    <\/div>\n    <div style=\"display: flex;\">\n        <input type=\"text\" id=\"userInput\" placeholder=\"Type your answer...\">\n        <button id=\"sendButton\" onclick=\"sendAnswer()\">Send<\/button>\n    <\/div>\n<\/div>\n\n<script>\nvar questions = [\"What's your name?\", \"What's your mobile number?\"];\nvar currentQuestionIndex = 0;\n\nfunction sendAnswer() {\n    var userInput = document.getElementById(\"userInput\").value;\n    var chatbox = document.getElementById(\"chatbox\");\n    \n    \/\/ Display user's answer\n    chatbox.innerHTML += \"<p>User: \" + userInput + \"<\/p>\";\n    \n    \/\/ Validate answer for mobile number\n    if (currentQuestionIndex === 1 && !isValidMobileNumber(userInput)) {\n        chatbox.innerHTML += \"<p>Tax Consultant: Please enter a valid 10-digit mobile number.<\/p>\";\n        return;\n    }\n    \n    \/\/ Store user's answer\n    storeAnswer(userInput);\n    \n    \/\/ Ask next question or redirect if all questions have been asked\n    if (currentQuestionIndex < questions.length - 1) {\n        currentQuestionIndex++;\n        chatbox.innerHTML += \"<p>Tax Consultant: \" + questions[currentQuestionIndex] + \"<\/p>\";\n    } else {\n        \/\/ Redirect to your link\n        window.location.href = \"https:\/\/wa.me\/918460364637?text=Hi%2C%20I%20am%20interested%20to%20file%20my%20ITR%20return.%20Can%20you%20assist%20me%20with%20this%3F\";\n    }\n    \n    \/\/ Scroll chatbox to bottom\n    chatbox.scrollTop = chatbox.scrollHeight;\n    \n    \/\/ Clear user input\n    document.getElementById(\"userInput\").value = \"\";\n}\n\nfunction storeAnswer(answer) {\n    \/\/ You can add code here to store the answer as needed (e.g., in an array or object)\n    console.log(\"Storing answer:\", answer);\n}\n\nfunction isValidMobileNumber(input) {\n    return \/^\\d{10}$\/.test(input);\n}\n<\/script>\n<\/body>\n<\/html>\n\n","protected":false},"excerpt":{"rendered":"<p>Consultant Chatbot Tax Consultant: Hi there! \ud83d\udc4b What&#8217;s your name? Send<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":[],"_links":{"self":[{"href":"https:\/\/moa.mybusinessconsulting.in\/index.php\/wp-json\/wp\/v2\/pages\/66"}],"collection":[{"href":"https:\/\/moa.mybusinessconsulting.in\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/moa.mybusinessconsulting.in\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/moa.mybusinessconsulting.in\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/moa.mybusinessconsulting.in\/index.php\/wp-json\/wp\/v2\/comments?post=66"}],"version-history":[{"count":15,"href":"https:\/\/moa.mybusinessconsulting.in\/index.php\/wp-json\/wp\/v2\/pages\/66\/revisions"}],"predecessor-version":[{"id":83,"href":"https:\/\/moa.mybusinessconsulting.in\/index.php\/wp-json\/wp\/v2\/pages\/66\/revisions\/83"}],"wp:attachment":[{"href":"https:\/\/moa.mybusinessconsulting.in\/index.php\/wp-json\/wp\/v2\/media?parent=66"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}