Some users have observed that the Kore chatbot on MS Teams does not respond or identify intent if the user copy-pastes text from an external source into the MS team’s chat session. However, if that same text is copied from notepad (on PC) the bot responds fine.
When users copy-paste the text in MS Teams, different styles like header/colored text, etc. are accepted and the values are being sent as HTML to the platform. The Kore platform is receiving some invisible characters like \n,\r.
The below snippet should resolve the copy-paste issue in MS Teams. This code should be placed at a logical place inside the on_user_message event of Botkit.
data.message = data.message.replace(/[\r\n]/g, "");
Thanks for the solution @manasa.jangiti
Note - As mentioned in the problem statement, if a user simply types/pastes plain text this issue can also be avoided.
We have checked the code with the development team, that Kore.ai platform only ‘removes’ < or > if any and it does not replace with \n\r. \n\r comes to Kore.ai from the channel. So if a user is not using BotKit, it may not be possible to handle these because it is beyond Kore.ai’s control.