Proactive Interruptions

不问归期 提交于 2019-12-24 17:53:07

问题


I am using an Azure Function to send a Proactive message to the client. How do i "reset" a conversation when a Proactive message is sent.

Within the bot, a user might be prompted for something (ex. time of day). A proactive message may get sent to them before they respond. In this scenario, I would like to reset/cancel the previous dialog and start fresh.

I am already able to reset the dialog using CancelAllDialogsAsync which works fine for user-driven messages.

I am sending my proactive message using ConnectorClient, which bypasses the framework, and sends directly to the client, thus never hitting my middleware to reset the dialog.

How can I get the proactive message sent to the framework (i can send the response from the bot no problem)


回答1:


I would highly recommend you solve this by having your function send your bot a backchannel event under the context of the ConversationReference via the ConnectorClient. This way the bot maintains ownership for all the details about state and what should happen when this event occurs rather than that responsibility leaking to the function. The bot then watches for this custom event and responds to it however it sees fit.

If you need any more details let me know and I'll update my answer.



来源:https://stackoverflow.com/questions/54117793/proactive-interruptions

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