在 Azure Portal WebChat 控制台中测试时如何找到 bot 的 conversationId?

How to find bot's conversationId when testing in Azure Portal WebChat console?

我在 Azure 中构建了一个机器人服务。目前,我也在 Azure 门户的测试网络聊天中进行测试。

我需要知道的是如何在此对话中(或通过 botbuilder sdk)找到对话 ID。

我有一个单独的脚本,它想通过直线将消息发送到 Azure 门户中这个已经打开的对话,但它需要对话 ID。

我的机器人代码中没有任何地方指定开始对话 - 它通过 builder.UniversalBot(连接器)进行监听。

我知道如何通过直线与这个机器人开始对话。但我想在 Azure 门户的网络聊天中开始对话,找到对话 ID,然后在另一个脚本中使用它,我必须向同一个对话发送 post 消息。

据推测,当我在网络聊天中通过消息开始对话时,有一个对话开始了?

不胜感激!

您可以在 Chrome 的开发者工具的“网络”选项卡中找到对话 ID:

另一种选择是只让机器人显示对话 ID:

bot.dialog('/', function (session) {
    if(session.message.text == 'get conversationid')
        session.send('conversation.id: ' + session.message.address.conversation.id);
    else
        session.send('You said: ' + session.message.text);

});