Skip to content

Reset History/Session + Error: No value provided for input HTTP label: botName. #814

@mayakashi-winter

Description

@mayakashi-winter

Im trying to implement a reset history and whenever i try to add the code below
iframeLoader.api.startNewSession()

it will give me an errors:

Error: No value provided for input HTTP label: botName.
at Qo (lex-web-ui.min.js:142:95293)
at Jd (lex-web-ui.min.js:142:262714)
at async lex-web-ui.min.js:142:66732

lex-web-ui.min.js:142 TypeError: Cannot use 'in' operator to search for 'sessionAttributes' in undefined
at A.updateLexState (lex-web-ui.min.js:142:384217)
at Array. (4.1.0_dist_vuex.min.js:1:3120)
at A.dispatch (4.1.0_dist_vuex.min.js:1:12121)
at A.t.dispatch (4.1.0_dist_vuex.min.js:1:10772)
at lex-web-ui.min.js:142:381199

now i implement this as an iframe on my parent page and it works smoothly beisdes the fact that i can't reset the session and clear the Chat in UI.

I have the config json loaded from an URL. And i hid the clear chat in the OOB solution as we want to clear the chat and session only when the customer has logged out in our system in which we will trigger (for now we test it as button)

EDIT: Updated the code. I also included the loader options which i think might be useful for analysis

var loaderOptions = {
            baseUrl: 'https://xxxxxxx',
            shouldLoadConfigFromJsonFile: true,
            configUrl: 'https:/xxxxx/lex-web-ui-loader-config.json',
            shouldLoadMinDeps: true,
            iframeSrcPath: '/index.html#/?lexWebUiEmbed=true'
        };
var iframeLoader = new ChatBotUiLoader.IframeLoader(loaderOptions);
      iframeLoader.load()
        .then(function () {
            iframeLoader.api.setSessionAttribute("token", generateJWT());
            console.log('iframe loaded');

            document.getElementById('clear-chat-btn').addEventListener('click', function() {
                console.log("button clicked");
                iframeLoader.api.startNewSession()
                .then(function() {
                    console.log('Started new session');
                })
                .catch(function(err) {
                    console.error('Failed to start new session', err);
                });
            });

any help would be appreciated, i just need a way to clear history and reset session in which it includes the chat in the UI itself

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions