Proactive Interruptions

217 Views Asked by At

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

There are 1 best solutions below

4
On

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.