web-widget icon indicating copy to clipboard operation
web-widget copied to clipboard

button click answer does not show button elements in reply

Open danbergan opened this issue 6 years ago • 2 comments

When a user clicks a button in response to a question, a reply containing ElementButtons will not be shown (any text in the ButtonTemplate will be shown). Typing, rather than clicking, will show the ElementButton.

Further, two successive button click responses by a user will then cause a javascript error and no part of the ButtonTemplate will be shown in the reply. (see comments in attached files.)

A simple proof of the bug in the attached files. botman.php.txt Conversation.php.txt anotherConversation.php.txt

danbergan avatar Apr 16 '18 18:04 danbergan

It looks like if a user clicks a button in a question, the msg.buttons array is not passed to the message handler:

performAction(action: IAction) { botman.callAPI(action.value, true, null, (msg: IMessage) => { this.state.attachmentsVisible = false; this.props.messageHandler({ text: msg.text, type: msg.type, timeout: msg.timeout, actions: msg.actions, attachment: msg.attachment, additionalParameters: msg.additionalParameters, from: 'chatbot' }); }, null); } I added: buttons: msg.buttons,

and, it fixed my bug. I'll try to do a pull request soon (but, I'm a bit of newbie with git, so I'll see if I can figure it out!)

danbergan avatar Apr 24 '18 18:04 danbergan

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

EranGrin avatar Apr 22 '24 19:04 EranGrin