Open joaquin03 opened 5 years ago
Hi! Confirm.
+1
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.
No updates on this yet?
No updates?
@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.
Thanks @bobkosse I ll try this fix. 😉
Thanks @bobkosse I ll try this fix. 😉
Let me know if it works for you!
+1 no updates on this?
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?
I created a new package that solves this and several other issues https://www.npmjs.com/package/botman-extended-web-widget
Hi and thank you for the library!
I don't now if im doing something wrong.
This is what is happening:
I think it will be nicer if the replay of the user is visible in the chat.
Thanks!