Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When using Question (backend), the answer of the user is not displayed #19

Open
joaquin03 opened this issue Oct 17, 2018 · 11 comments
Open

Comments

@joaquin03
Copy link

Hi and thank you for the library!

I don't now if im doing something wrong.

This is what is happening:
screen shot 2018-10-17 at 11 42 23 am
screen shot 2018-10-17 at 11 42 29 am

I think it will be nicer if the replay of the user is visible in the chat.

Thanks!

@Edd-G
Copy link

Edd-G commented Oct 22, 2018

Hi!
Confirm.

@jjcodes78
Copy link

+1

@christoph007
Copy link

This is indeed a problem. When the user writes a message, this message appears is the message area as a user message. But when the user clicks on a button, all the buttons disappear, and there is no user message generated at all. It would be nice to add the label of the button pressed as a user message.

@LiamRoels
Copy link

No updates on this yet?

@maqnouch
Copy link

No updates?

@bobkosse
Copy link

bobkosse commented Mar 30, 2021

@joaquin03 @Edd-G @jjsquady @christoph007 @LiamRoels @aqnouch

I made a little fix in 2 files:

chat\messages\action.tsx:
Added those 2 lines to the performAction method:

var event = new CustomEvent('buttonSelection', {'detail': { message: action.text}});
window.dispatchEvent(event);

chat\chat.tsx
Add an eventLIstener tot the componentDidMount method like this:

// Add event listener for button clicks
window.addEventListener("buttonSelection", (e) => {
            try {
                // @ts-ignore
                this.onlySay(e.detail.message);
            } catch (e) {
                //
            }
        });

Because I didn't want the backend called for this message I added a new onlySay method that does only the frontend work:

onlySay(text: string, showMessage = true) {
        const message: IMessage = {
            text,
            type: "text",
            from: "visitor"
        };

        if (showMessage) {
            this.writeToMessages(message);
        }
    }

I think there should be options that work better but in my case this was working very well.

Schermafbeelding 2021-03-30 om 15 29 07

Schermafbeelding 2021-03-30 om 15 30 17

@jjcodes78
Copy link

Thanks @bobkosse I ll try this fix. 😉

@bobkosse
Copy link

Thanks @bobkosse I ll try this fix. 😉

Let me know if it works for you!

@dbo90
Copy link

dbo90 commented Jun 15, 2021

+1 no updates on this?

@Novelz
Copy link

Novelz commented Jan 26, 2022

Thank you @bobkosse
Your solution kinda work in my setup, but now I have the clicked answer written 2 times, one as user (and that's ok) and one as bot. I can't wrap my head around it. Do you have any suggestion?

@EranGrin
Copy link

I created a new package that solves this and several other issues
https://www.npmjs.com/package/botman-extended-web-widget

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants