你如何结束使用DirectLine 3.0的Bot Framework中的对话?

时间:2018-03-01 07:59:16

标签: c# botframework direct-line-botframework

我能找到的唯一文档是关于活动endConversation(这是使用DirectLine 3.0)。

我发送endConversation类型的活动后该怎么办?

通过聊天关闭窗口无法正常结束对话,我需要以编程方式执行此操作。

我结束对话的代码目前只是将事件发送到框​​架:

botConnection.postActivity({
    type: endConversation,
    from: { id: 'Bot' },
    name: 'endActivity',
    value: "The user has closed the session. You can now close this conversation.",
}).subscribe(function (id) { console.log('Command sent'); });

1 个答案:

答案 0 :(得分:1)

正如documentation所述,将您的帖子请求发送到https://directline.botframework.com/v3/directline/conversations/YOUR_CONVERSATION/activities

使用您在问题中提到的正文,用户和机器人都不能发送任何其他消息。完成请求后,您应该获得200响应和活动ID,这就是您知道请求成功的方式。

有一个feature request在DirectLine中有一个与会话结束相关联的活动类型,但我还没想到还在制作中。当我得到更多信息时,我会更新这个答案。

此致 旧金山