UserProfile state persistent between users in bot v4

↘锁芯ラ 提交于 2019-12-01 14:53:17

If you don't provide WebChat with a unique id for each conversation, it will reference the same data objects in storage. So to the resolve this issue, you should generate a random id for each user or conversation instance. See the code snippet below for an example.

const userID = Date.now() + Math.random().toString(36);

...

window.WebChat.renderWebChat({
directLine: window.WebChat.createDirectLine({ token }),
store,
userID
}, document.getElementById('webchat'));

Hope this helps!

Also check latest README.md of webchat WEBCHAT API reference It states

If userID is not specified, it will default to a random user ID

Might be more efficient.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!