...
The Chatbot V3 is an extension of the existing chatbot where you can have multiple advantages such as never-ending sessions, multiple bots without the need to change the endpoint, the ability for the admin to take charge of any conversation, the ability for the admin to customize the chatbot UI, and so on.
Features
Never-ending session using V3 - The chatbot user can resume chatting with the chatbot any time so long as he did not close the browser and did not refresh the webpageReal-time Communication - Messages can be pushed from the server to any and all connected clients, allowing requests and responses to be handles asynchronously.
Customize the Chabot UI - You as an admin user will have access to change and modify more UI elements of the default chatbot.
New socket connection each time the Chatbot URL is triggered - A new socket connection is made each time the chatbot is triggered. This gives visibility to the chatbot admins over the chatbot conversations.
The ability of the Bot Admin to take charge of any chatbot conversation - You will have access to take over any specific conversation using the respective socket ID of the chatbotChatbot UI - Use or tweak Orbita’s out of the box UI, or completely customize the chatbot to represent unique branding and layout.
Targeted Messaging - Push communication to singular users or multiple personas with the ability to target message pushes to connected clients.
How do you use it?
To use the Chatbot V3’s capabilities with your existing chatbot.
Login to Experience Manager and Select your project.
Open Experience Designer.
Import the below flow to any Experience Designer tab. Refer How do I export and import flows in Experience Designer
Code Block language json [ { "id": "f16f5c09b8ab9335.8c297dc1", "type": "tab", "label": "ChatV3-TypescriptFlow 3", "disabled": false, "info": "" }, { "id": "908f1007ac8940e2.e287a5555", "type": "alexa-flow-config reff", "z": "f16f5c09b8ab9335.8c297dc1", "skillConfig": "70101b8e.d8b784", "x": 100, "y": 50, "wires": [] }, { "id": "9a0508d2f42dd3c0.0dd98829e68", "type": "orbita-bot-provider-v2", "z": "f16f5c09b8ab9335.8c297dc1", "name": "", "botInParser": "var _ = global.get('lodash');\n// msg.payload.originalRequest.data = {\n// \"surveyID\":\"10000\"\n// }\n\nmsg.payload.originalRequest.data.surveyID=nif(msg && msg.req && msg.req.query.surveyID;) {\n\n//to support the session\n ID from query Param\nmsgmsg.payload.originalRequest.sessionId data.surveyID= msg.req.query.sessionId || msg.payload.sessionId;\nnode.warn(msg);\nmsg.payload.originalRequest.data.chooseflow = msg.originalPayload.customData.chooseFlow;\n\nmsg.payload.socketIOId = msg.socketIOId;\n\nvar querySessionIdsurveyId;\n}\n\nvar socketIOId = _.get(msg, 'req.query.sessionIdsocketIOId', null);\n\nif (querySessionIdsocketIOId) {\n _.set(msg, 'payload.originalRequest.data.sessionIdsocketIOId', querySessionIdsocketIOId);\n}\n\nvar", socketIOId = _.get(msg, 'req.socketIOId', null);\n\nif (socketIOId) {\n _.set(msg, 'payload.originalRequest.data.socketIOId', socketIOId);\n}\n", "botOutParser": "msg.payload.micInput=true;\nmsg.payload.startAlignmentTop = true;\nmsg.enableArrayResponse = true;\n", "transcriptEnabled": false, "ttsconfig": "{\n \"languageCode\": \"en-US\",\n \"ssmlGender\": \"MALE\",\n \"audioEncoding\": \"MP3\"\n}", "providerType": "Google", "skillConfig": "70101b8e.d8b784", "token": "", "noerr": 0, "nlpData": false, "x": 500280, "y": 120200, "wires": [ [ "fc7f35ed.edd178", "3336fa5.30797065d224a8a.48cba4" ] ] }, { "id": "fc7f35edecb0f368.edd1783be75", "type": "debugbot-in", "z": "f16f5c09b8ab9335.8c297dc1", "nameskillConfig": "70101b8e.d8b784", "activename": false"", "consolerules": false[], "completex": "true"90, "xy": 570200, "ywires": 60,[ "wires": [] [ }, { "id": "67302003f42dd3c0.2d2c529e68", "type": "inject", ] "z": "f16f5c09.8c29", ] }, "name": "", { "topicid": "f54043db.c59dc", "payloadtype": "{}bot-out", "payloadTypez": "jsonb8ab9335.7dc1", "repeatskillConfig": "70101b8e.d8b784", "crontabname": "", "oncex": false640, "onceDelayy": 0.1200, "xwires": 170,[] }, "y": 220, { "wiresid": ["5d224a8a.48cba4", "type": "function", [ "z": "b8ab9335.7dc1", "name": "afdc2ad8.4f34d8", "func": "msg.payload.directive = {\n ] \"type\": \"mainmenu\",\n ]\"title\":\"Menu options\",\n },\"buttons\": []\n {}\nreturn msg;", "idoutputs": "a2148e73.1597b"1, "typenoerr": "inject"0, "zx": "f16f5c09.8c29"450, "namey": ""200, "topicwires": "", [ "payload": "{\"text\":\"Hello you are recieving a push message from server!\"}", [ "payloadTypef54043db.c59dc": "json", "repeat": "", ] "crontab": "", ] }, "once": false, { "onceDelayid": 0"c96010c2.13b3b5", "xtype": 170"template", "yz": 280"b8ab9335.7dc1", "wiresname": ["", "field": "payload", [ "fieldType": "msg", "format": "10cd57ac.c26968handlebars", "syntax": "mustache", ] "template": "<!doctype ]html>\n<html lang=\"en\">\n<head>\n <title>Orbita }, v3 Bot</title>\n { "id": "10cd57ac.c26968", "type": "function",<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <style>\n body{\n "z": "f16f5c09.8c29", "name": "Send Message to All",font-family: sans-serif;\n "func": "msg.socketIOEmit = \"emit\";\nreturn msg;",background-color:#fff !important;\n }\n "outputs": 1, </style>\n</head>\n<body>\n "noerr": 0, "x": 380, "y": 280, "wires": [ [ "3008b64.af1714a" ] ] }, { "id": "3008b64.af1714a", "type": "debug", "z": "f16f5c09.8c29", "name": "", "active": true, "console": "false",<link rel=\"preload\" href=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css\" as=\"style\" onload=\"this.onload=null;this.rel='stylesheet'\">\n <script src=\"/chatbot/v2/adaptive-lib/adaptivecards-templating.min.js\"></script>\n <script src=\"/chatbot/v2/adaptive-lib/adaptivecards.js\"></script>\n <script type=\"text/javascript\" src=\"https://unpkg.com/markdown-it/dist/markdown-it.js\"></script>\n <script src=\"https://cdn.socket.io/3.1.3/socket.io.min.js\" integrity=\"sha384-cPwlPLvBTa3sKAgddT6krw0cJat7egBga3DJepJyrLl4Q9/5WLra3rrnMcyTyOnh\" crossorigin=\"anonymous\"></script>\n <script src=\"https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js\" integrity=\"sha512-894YE6QWD5I59HgZOGReFYm4dnWc1Qt5NtvYSaNcOP+u1T9qYdvdihz0PPSiiqn/+/3e7Jo4EaG7TubfWGUrMQ==\" crossorigin=\"anonymous\" referrerpolicy=\"no-referrer\"></script>\n <script src=\"/chatbot/v3/chat-plugins.js\"></script>\n <script src=\"/chatbot/v3/chat.js\"></script>\n <link rel=\"stylesheet\" href=\"/chatbot/v3/style.css\" />\n <link rel=\"stylesheet\" type=\"text/css\" href=\"https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css\" />\n <link href=\"https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css\" rel=\"stylesheet\">\n <script>\n var latestResponse = {};\n\n OrbitaBotPlugins.BotPlugin.init({\n "complete": "false",botId:'bot-v3',\n "x"width: 730,'300px',\n "y" height: 320'600px',\n "wires": []});\n }, OrbitaChatBotV3.init({\n { "id"projectId: "a23a9f64.4c59f\" {{projectId}}\",\n "type": "function", serverUrl: "z": "f16f5c09.8c29",\" {{req.headers.x-forwarded-proto}}\"+\"://\"+\" {{req.headers.host}}\",\n "name": "Send Message to specific socket id",isCustomUi: true,\n botContainerId: 'bot-v3',\n "func": "msg.socketIOId = \"oFLhOqsC2lIb4f08AAAI\";\nreturn msg;", botContentId: 'messages',\n "outputs": 1, "noerr"botInputMessageId: 0'input',\n "x": 420, "y": 340,botSendButtonId: 'orbita-send',\n "wires": [ botMicId: 'chatMic',\n [ botSpeakerId: 'un-mute',\n botMenuId: "3008b64.af1714a"'menu-icon',\n botIcon: ]'chat-icon',\n ] botClose: 'menu',\n }, { botBannerIcon: 'banner-title',\n "id": "7c333bba.96cad4", "type"launchWord: "inject",'opens',\t\n "z": "f16f5c09.8c29", customData : {\t\n "name": "", "topic"chooseFlow: \"",{{req.params.chooseFlow}}\"\t\n "payload": "{\"text\":\"Hello you are lucky today!\"}", }\n });\n "payloadType": "json", function afterResponse(responseData) { \n "repeat": "", const myData "crontab": "",= {...responseData};\n "once": false, latestResponse = myData;\n\n "onceDelay": 0.1, if (myData.directive "x": 170,&& myData.directive.buttons){\n "y": 340, let buttons = "wires": [myData.directive.buttons;\n [ "a23a9f64.4c59f"$('.menu-slider ul').empty();\n ] $.each(buttons, function( key, button ){\n ] }, { "id": "67292972.da9c38", $('.menu-slider ul').append('<li onClick=\"OrbitaChatBotV3.hook(\\'send_message\\',\\''+button.value+'\\');$(\\'.menu-icon\\').trigger(\\'click\\');\">'+button.text+'</li>'); \n "type": "http response", "z": "f16f5c09.8c29", });\n "name": "", }\n }\n OrbitaChatBotV3.registerEvent({eventName: \"statusCodeafterResponse\", callbackFunction: afterResponse});\n "" </script>\n</body>\n</html>", "headersoutput": {}"str", "x": 710460, "y": 420160, "wires": [] }, { [ "id": "6f75b0e9.6fe9b", "typee933f36.93cb91": "template", "z ] ] }, { "id": "f16f5c09e933f36.8c2993cb91", "nametype": "http response", "fieldz": "payloadb8ab9335.7dc1", "fieldTypename": "msg", "formatstatusCode": "html", "syntaxheaders": "mustache"{}, "templatex": "<!DOCTYPE html>\n<html>\n <head>\n <title>Bot Plugin test</title>\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css\" integrity=\"sha512-iBBXm8fW90+nuLcSKlbmrPcLa0OT92xO1BIsZ+ywDWZCvqsWgccV3gFoRBv0z+8dLJgyAHIhR35VZc2oM/gI1w==\" crossorigin=\"anonymous\" />\n <!--<link rel=\"stylesheet\" href=\"https://aurora.orbita.cloud:8443/chatbot/v2/styles/styles.css\" />-->\n <style>\n @import url(\"https://fonts.googleapis.com/css?family=Lato:400,700\");\n body{\n font-family: Lato;\n }\n </style>\n</head>\n<body>\n {{!--<script src=\"/chatbot/v2/adaptive-lib/adaptivecards-templating.min.js\"></script>--}}\n <script src=\"/chatbot/v2/adaptive-lib/adaptivecards.js\"></script>\n <script type=\"text/javascript\" src=\"https://unpkg.com/markdown-it/dist/markdown-it.js\"></script>\n {{!--<script src=\"/chatbot/v2/modules/adaptivecards/hostConfigs.js\"></script>--}}\n {{!--<script src=\"/chatbot/v2/modules/adaptivecards/cardScript.js\"></script>--}}\n <script src=\"https://cdnjs.cloudflare.com/ajax/libs/socket.io/3.1.2/socket.io.js\" integrity=\"sha512-YybopSVjZU0fe8TY4YDuQbP5bhwpGBE/T6eBUEZ0usM72IWBfWrgVI13qfX4V2A/W7Hdqnm7PIOYOwP9YHnICw==\" crossorigin=\"anonymous\"></script>\n \n\n <script src=\"https://code.jquery.com/jquery-3.6.0.min.js\" integrity=\"sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=\" crossorigin=\"anonymous\"></script>\n <script src=\"https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/js/bootstrap.min.js\" integrity=\"sha384-Atwg2Pkwv9vp0ygtn1JAojH0nYbwNJLPhwyoVbhoPwBhjQPR5VtM2+xf0Uwh9KtT\" crossorigin=\"anonymous\"></script>\n <script src=\"https://unpkg.com/adaptivecards-templating/dist/adaptivecards-templating.min.js\"></script>\n <script src=\"/chatbot/v2/adaptive-lib/adaptivecards-templating.min.js\"></script>\n <script src=\"/chatbot/v3/chat-plugins.js\"></script>\n <script src=\"/chatbot/v3/chat.js\"></script>\n <link rel=\"stylesheet\" href=\"/chatbot/v3/style.css\" />\n<link rel=\"stylesheet\" type=\"text/css\" href=\"https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css\" />\n <link href=\"https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css\" rel=\"stylesheet\">\n <script>\n OrbitaBotPlugins.BotPlugin.init({\n botId:'bot-v3',\n width: '450px',\n height: '90vh',\n });\n \n OrbitaChatBotV3.init({\n projectId: \"60dee13abf64170068df5ece\",\n serverUrl: 'https://orbita-vnext.orbita-eng.cloud:8443',\n isCustomUi: true,\n botContainerId: 'bot-v3',\n botContentId: 'messages',\n botInputMessageId: 'input',\n botSendButtonId: 'orbita-send-button',\n botMicId: 'chatMic',\n botSpeakerId: 'un-mute',\n botMenuId: 'chatMenu',\n botIcon: 'chat-icon',\n botClose: 'menu',\n launchWord: 'opens',\n customData : {\n chooseFlow: \"{{payload.chooseFlow}}\"\n }\n });\n </script>\n \n </body>\n</html>", "output": "str", "x": 560630, "y": 160, "wires": [] }, { "id": "eb6d8a59.521f18", "type": "http in", "z": "b8ab9335.7dc1", "name": "", "url": "/v3Bot", "method": "get", "upload": false, "swaggerDoc": "", "x": 120, "y": 160, "wires": [ [ "4658588.f9cd8a8" ] ] }, { "id": "2cf77592.e66cfa", "type": "comment", "z": "b8ab9335.7dc1", "name": "v3Bot View", "info": "", "x": 100, "y": 120, "wires": [] }, { "id": "4658588.f9cd8a8", "type": "function", "z": "b8ab9335.7dc1", "name": "", "func": "const util = global.get('orbitaUtil');\nmsg.projectId = util.getProjectId(node);\nreturn msg;", "outputs": 1, "noerr": 0, "x": 310, "y": 420160, "wires": [ [ "67292972c96010c2.da9c383b3b5" ] ] }, { "id": "b2fd4d7570101b8e.90a46d8b784", "type": "http inalexa-skill-config", "zskillname": "f16f5c09.8c29new", "nameprojectId": "60dee13abf64170068df5ece", "urlintents": "/temp-bot[]", "methodskillstate": "get", }, "upload": false, { "swaggerDocid": "slots", "xtype": 110"slots", "yz": 420"", "wiresslots": [] [ "aa28d8ef.966e58",} ]
Following the above steps will create a new flow in the Experience Designer as shown below.
...
Coming from version 2 of the bot
Bot In Node
Listens to pushes from connected clients
Bot Out Node
Emits a message to the specified socketID
Connected Bots
Returns array of connected socket IDs
No iframes
Customizations
Adding Custom JS
Adding Custom CSS
Embed the Bot in a section
Code Block [ { "id": "b7cf53f8.4464", "
...
type": "template", "z": "cd6c5936.243d78",
...
"name": "",
...
...
...
"field": "payload", "
...
fieldType": "
...
msg", "
...
format": "
...
handlebars", "
...
syntax": "
...
mustache", "
...
template": "
...
<!doctype html>\n<html lang=\"en\">\n<head>\n <title>Orbita v3 Demo</title>\n
...
<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <style>\n
...
...
body #bot-v3.chat-container{\n
...
...
display:block;\n
...
...
}\n
...
#bot-v3,\n #bot-v3
...
.chatbox{\n position: fixed;\n
...
display:block;\n
...
right: 10px;\n
...
bottom: 50px;\n
...
...
height: 550px;\n
...
...
width: 345px;\n
...
border-radius: 10px;\n
...
...
box-shadow: 5px 5px 15px rgb(119 119 119
...
/ 50%);\n
...
...
...
...
overflow: hidden;\n
...
...
...
...
...
...
...
...
...
...
...
z-index: 999;\n
...
...
...
...
...
...
left:
...
calc(50% - 175px);\n
...
...
...
...
top: 150px;\n
...
...
}\n
...
...
#bot-v3 #chatLiveChatTrigger {\n
...
...
position: absolute;\n
...
...
...
right:
...
20px;\n
...
top: 100px;\n z-index: 999;\n
...
cursor:pointer;\n
...
}\n
...
\n
...
#bot-v3 #waitingAgent {\n
...
...
clear:both;\n
...
...
text-align: center;\n
...
...
}\n
...
...
.chat-icon{\n
...
display:
...
none !important;\n
...
}\n\n body{\n
...
...
...
font-family: sans-serif;\n
...
...
background-color:#eee !important;\n
...
...
}\n
...
</style>\n</head>\n<body>\n
...
<link rel=\"preload\" href=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css\" as=\"style\" onload=\"this.onload=null;this.rel='stylesheet'\">\n <script src=\"/chatbot/v2/adaptive-lib/adaptivecards-templating.min.js\"></script>\n <script src=\"/chatbot/v2/adaptive-lib/adaptivecards.js\"></script>\n <script type=\"text/javascript\" src=\"https://unpkg.com/markdown-it/dist/markdown-it.js\"></script>\n <script src=\"https://cdn.socket.io/3.1.3/socket.io.min.js\" integrity=\"sha384-cPwlPLvBTa3sKAgddT6krw0cJat7egBga3DJepJyrLl4Q9/5WLra3rrnMcyTyOnh\" crossorigin=\"anonymous\"></script>\n <script src=\"https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js\" integrity=\"sha512-894YE6QWD5I59HgZOGReFYm4dnWc1Qt5NtvYSaNcOP+u1T9qYdvdihz0PPSiiqn/+/3e7Jo4EaG7TubfWGUrMQ==\" crossorigin=\"anonymous\" referrerpolicy=\"no-referrer\"></script>\n <script src=\"/chatbot/v3/chat-plugins.js\"></script>\n <script src=\"/chatbot/v3/chat.js\"></script>\n <link rel=\"stylesheet\" href=\"/chatbot/v3/style.css\" />\n <link rel=\"stylesheet\" type=\"text/css\" href=\"https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css\" />\n <link href=\"https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css\" rel=\"stylesheet\">\n <script>\n var
...
clickTag = \"https://www.orbita.ai\";\n var latestResponse = {};\n
...
function adClick(){\n
...
...
...
window.open(clickTag, `_blank`);\n
...
}\n
...
OrbitaBotPlugins.BotPlugin.init({\n
...
botId:'bot-v3',\n
...
width:
...
'300px',\n
...
height:
...
'600px',\n
...
});\n OrbitaChatBotV3.init({\n
...
...
projectId:
...
\" {{projectId}}\",\n
...
...
serverUrl:
...
\" {{req.headers.x-forwarded-proto}}\"+\"://\"+\" {{req.headers.host}}\",\n
...
isCustomUi:
...
true,\n
...
botContainerId: 'bot-v3',\n
...
botContentId: 'messages',\n
...
botInputMessageId:
...
'input',\n
...
botSendButtonId:
...
'orbita-send',\n
...
botMicId:
...
'chatMic',\n
...
botSpeakerId:
...
'un-mute',\n
...
botMenuId:
...
'menu-icon',\n
...
botIcon: 'chat-icon',\n botClose: 'menu',\n
...
botBannerIcon: 'banner-title'\n
...
});\n function afterResponse(responseData) { \n
...
...
const myData =
...
{...responseData};\n
...
latestResponse =
...
myData;\n\n
...
if (myData.directive && myData.directive.buttons){\n
...
...
...
let buttons = myData.directive.buttons;\n
...
...
...
$('.menu-slider ul').empty();\n
...
...
$.each(buttons,
...
function( key, button ){\n
...
...
...
...
$('.menu-slider
...
Following the above steps will create a new flow in the Experience Designer as shown below.
...
Changes to be done after importing the flow
After importing the “ChatV3-Typescript“ flow, you need to change the below settings.
Copy the id param from the URL of the current page. This is the current project’s ID.
Open the “template” node and paste the copied project ID at line 41 (default) as shown in the screenshot below.
Copy the URL of the enviroment
In the same “template” node, paste the copied URL to the Line 42 (default) as shown in the screenshot below.
Customizations
...
ul').append('<li onClick=\"OrbitaChatBotV3.hook(\\'send_message\\',\\''+button.value+'\\');$(\\'.menu-icon\\').trigger(\\'click\\');\">'+button.text+'</li>'); \n });\n }\n\n if (myData.session && myData.session.chatMode && myData.session.chatMode !== null){\n $('.chatbox').prepend(`<i id=\"chatLiveChatTrigger\" title=\"End session with agent\" onClick=\"OrbitaChatBotV3.hook('send_message', 'Please end my session');$(this).remove();\" class=\"fas fa-life-ring fa-times-circle lc_enabled\"/>`);\n }\n }\n OrbitaChatBotV3.registerEvent({eventName: \"afterResponse\", callbackFunction: afterResponse});\n \n $('.chat input').on('keypress', function (e) {\n if (e.which == 13) {\n if (latestResponse.session && latestResponse.session.chatMode && latestResponse.session.chatMode !== null){\n $('.chat input, .chat button').css('display', 'block');\n }\n return false;\n }\n });\n\n OrbitaChatBotV3.hook('connect');\n </script>\n</body>\n</html>", "output": "str", "x": 440, "y": 160, "wires": [["ca48379c.d812b8"]] }, { "id": "ca48379c.d812b8", "type": "http response", "z": "cd6c5936.243d78", "name": "", "statusCode": "", "headers": {}, "x": 570, "y": 160, "wires": [] }, { "id": "6d574e22.32d22", "type": "http in", "z": "cd6c5936.243d78", "name": "", "url": "/centerView", "method": "get", "upload": false, "swaggerDoc": "", "x": 140, "y": 160, "wires": [["b186eca9.c0b9e"]] }, { "id": "b186eca9.c0b9e", "type": "function", "z": "cd6c5936.243d78", "name": "", "func": "const util = global.get('orbitaUtil');\nmsg.projectId = util.getProjectId(node);\nreturn msg;", "outputs": 1, "noerr": 0, "x": 310, "y": 160, "wires": [["b7cf53f8.4464"]] }, { "id": "slots", "type": "slots", "z": "", "slots": [] } ]
Building a Custom Interface
(Rakesh?)