botchatwork在网聊中提到会话ID

我们如何在botframework webchat聊天中提到对话id ,而不是随机生成? 我们现在可以提及网webchatuserid usernameusername ,但是不能提供对话id

有关此主题的更多信息,请查看指南: 发送主动消息 。

为了能够向用户发送临时消息,机器人必须首先从当前对话中收集并保存关于该用户的信息。 消息的地址属性包括机器人稍后需要向用户发送临时消息的所有信息。

 bot.dialog('/', function(session, args) { var savedAddress = session.message.address; // (Save this information somewhere that it can be accessed later, such as in a database.) var message = 'Hello user, good to meet you! I now know your address and can send you notifications in the future.'; session.send(message); }); 

僵尸程序收集到用户信息后,可以随时向用户发送临时主动消息。 为此,它只需检索先前存储的用户数据,构build消息并发送。

 function sendProactiveMessage(address) { var msg = new builder.Message().address(address); msg.text('Hello, this is a notification'); msg.textLocale('en-US'); bot.send(msg); }