Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Document Title: Orbita Chatbot V3 Solution

Creation date:

Author: ORBITA

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

  1. Never ending sesssion using V3 (without refreshing the bot)

  2. Customize the chabot UI.

  3. Ability of the Bot Admin to take charge of any chatbot conversation.

  4. New socket connection each time the Chatbot URL is triggered.

How do you use it?

To use the Chatbot V3’s capabilities with your existing chatbot.

  1. Login to Experience Manager and Select your project.

  2. Open Experience Designer.

  3. Import the below flow. Refer How do I export and import flows in Experience Designer

    [
        {
            "id": "f16f5c09.8c29",
            "type": "tab",
            "label": "ChatV3-Typescript",
            "disabled": false,
            "info": ""
        },
        {
            "id": "908f1007.e287a",
            "type": "alexa-flow-config reff",
            "z": "f16f5c09.8c29",
            "skillConfig": "70101b8e.d8b784",
            "x": 100,
            "y": 50,
            "wires": []
        },
        {
            "id": "9a0508d2.0dd988",
            "type": "orbita-bot-provider-v2",
            "z": "f16f5c09.8c29",
            "name": "",
            "botInParser": "var _ = global.get('lodash');\n// msg.payload.originalRequest.data = {\n// \"surveyID\":\"10000\"\n// }\n\nmsg.payload.originalRequest.data.surveyID=msg.req.query.surveyID;\n\n//to support the session ID from query Param\nmsg.payload.originalRequest.sessionId = 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 querySessionId = _.get(msg, 'req.query.sessionId', null);\n\nif (querySessionId) {\n _.set(msg, 'payload.originalRequest.data.sessionId', querySessionId);\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": 500,
            "y": 120,
            "wires": [
                [
                    "fc7f35ed.edd178",
                    "3336fa5.3079706"
                ]
            ]
        },
        {
            "id": "fc7f35ed.edd178",
            "type": "debug",
            "z": "f16f5c09.8c29",
            "name": "",
            "active": false,
            "console": false,
            "complete": "true",
            "x": 570,
            "y": 60,
            "wires": []
        },
        {
            "id": "67302003.2d2c5",
            "type": "inject",
            "z": "f16f5c09.8c29",
            "name": "",
            "topic": "",
            "payload": "{}",
            "payloadType": "json",
            "repeat": "",
            "crontab": "",
            "once": false,
            "onceDelay": 0.1,
            "x": 170,
            "y": 220,
            "wires": [
                [
                    "afdc2ad8.4f34d8"
                ]
            ]
        },
        {
            "id": "a2148e73.1597b",
            "type": "inject",
            "z": "f16f5c09.8c29",
            "name": "",
            "topic": "",
            "payload": "{\"text\":\"Hello you are recieving a push message from server!\"}",
            "payloadType": "json",
            "repeat": "",
            "crontab": "",
            "once": false,
            "onceDelay": 0.1,
            "x": 170,
            "y": 280,
            "wires": [
                [
                    "10cd57ac.c26968"
                ]
            ]
        },
        {
            "id": "10cd57ac.c26968",
            "type": "function",
            "z": "f16f5c09.8c29",
            "name": "Send Message to All",
            "func": "msg.socketIOEmit = \"emit\";\nreturn msg;",
            "outputs": 1,
            "noerr": 0,
            "x": 380,
            "y": 280,
            "wires": [
                [
                    "3008b64.af1714a"
                ]
            ]
        },
        {
            "id": "3008b64.af1714a",
            "type": "debug",
            "z": "f16f5c09.8c29",
            "name": "",
            "active": true,
            "console": "false",
            "complete": "false",
            "x": 730,
            "y": 320,
            "wires": []
        },
        {
            "id": "a23a9f64.4c59f",
            "type": "function",
            "z": "f16f5c09.8c29",
            "name": "Send Message to specific socket id",
            "func": "msg.socketIOId = \"oFLhOqsC2lIb4f08AAAI\";\nreturn msg;",
            "outputs": 1,
            "noerr": 0,
            "x": 420,
            "y": 340,
            "wires": [
                [
                    "3008b64.af1714a"
                ]
            ]
        },
        {
            "id": "7c333bba.96cad4",
            "type": "inject",
            "z": "f16f5c09.8c29",
            "name": "",
            "topic": "",
            "payload": "{\"text\":\"Hello you are lucky today!\"}",
            "payloadType": "json",
            "repeat": "",
            "crontab": "",
            "once": false,
            "onceDelay": 0.1,
            "x": 170,
            "y": 340,
            "wires": [
                [
                    "a23a9f64.4c59f"
                ]
            ]
        },
        {
            "id": "67292972.da9c38",
            "type": "http response",
            "z": "f16f5c09.8c29",
            "name": "",
            "statusCode": "",
            "headers": {},
            "x": 710,
            "y": 420,
            "wires": []
        },
        {
            "id": "6f75b0e9.6fe9b",
            "type": "template",
            "z": "f16f5c09.8c29",
            "name": "",
            "field": "payload",
            "fieldType": "msg",
            "format": "html",
            "syntax": "mustache",
            "template": "<!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": 560,
            "y": 420,
            "wires": [
                [
                    "67292972.da9c38"
                ]
            ]
        },
        {
            "id": "b2fd4d75.90a46",
            "type": "http in",
            "z": "f16f5c09.8c29",
            "name": "",
            "url": "/temp-bot",
            "method": "get",
            "upload": false,
            "swaggerDoc": "",
            "x": 110,
            "y": 420,
            "wires": [
                [
                    "aa28d8ef.966e58",
                    "7dc8add6.80b994"
                ]
            ]
        },
        {
            "id": "aa28d8ef.966e58",
            "type": "function",
            "z": "f16f5c09.8c29",
            "name": "payload config",
            "func": "var util = global.get('orbitaUtil');\nmsg.payload.sessionId = util.uuid(); \nmsg.payload.chooseFlow = msg.req.params.chooseFlow;\nmsg.payload.projectid = \"60dee13abf64170068df5ece\";\nreturn msg;",
            "outputs": 1,
            "noerr": 0,
            "x": 360,
            "y": 420,
            "wires": [
                [
                    "6f75b0e9.6fe9b"
                ]
            ]
        },
        {
            "id": "4bb487b.3a0b978",
            "type": "function",
            "z": "f16f5c09.8c29",
            "name": "",
            "func": "const _ = global.get('lodash');\n msg.payload.extPayload = { \"test\" : \"data\"};\nconst query = _.get(msg, 'req.query');\nif(query && query.campaignid) {\n    const extPayload = msg.payload.extPayload || {};\n    extPayload['query'] = query;\n    msg.payload.extPayload = extPayload;\n}\nreturn msg;",
            "outputs": 1,
            "noerr": 0,
            "x": 330,
            "y": 120,
            "wires": [
                [
                    "9a0508d2.0dd988"
                ]
            ]
        },
        {
            "id": "7dc8add6.80b994",
            "type": "debug",
            "z": "f16f5c09.8c29",
            "name": "Temp bot",
            "active": true,
            "console": "false",
            "complete": "payload",
            "x": 320,
            "y": 480,
            "wires": []
        },
        {
            "id": "c710afe2.b2bcf",
            "type": "bot-in",
            "z": "f16f5c09.8c29",
            "skillConfig": "70101b8e.d8b784",
            "name": "",
            "rules": [],
            "x": 170,
            "y": 120,
            "wires": [
                [
                    "4bb487b.3a0b978"
                ]
            ]
        },
        {
            "id": "3336fa5.3079706",
            "type": "bot-out",
            "z": "f16f5c09.8c29",
            "skillConfig": "70101b8e.d8b784",
            "name": "",
            "x": 720,
            "y": 120,
            "wires": []
        },
        {
            "id": "afdc2ad8.4f34d8",
            "type": "connected-bots",
            "z": "f16f5c09.8c29",
            "skillConfig": "70101b8e.d8b784",
            "name": "",
            "model": "select",
            "sockets": "",
            "x": 360,
            "y": 220,
            "wires": [
                [
                    "3008b64.af1714a"
                ]
            ]
        },
        {
            "id": "70101b8e.d8b784",
            "type": "alexa-skill-config",
            "skillname": "new",
            "projectId": "60dee13abf64170068df5ece",
            "intents": "[]",
            "skillstate": ""
        },
        {
            "id": "slots",
            "type": "slots",
            "z": "",
            "slots": []
        }
    ]

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.

  1. Copy the id param from the URL of the current page. This is the current project’s ID.

  2. Open the function node named “payload config“ and paste the copied project ID.

  3. Open the “template” node and paste the copied project ID at line 41 (default) as shown in the screenshot below.

  4. Copy the URL of the enviroment

  5. In the same “template” node, paste the copied URL to the Line 42 (default) as shown in the screenshot below.

Customizations

configure the chatbot to generate multiple sessions with different conversations without the need to create a new endpoint.

  • No labels