microsoft / BotFramework-Composer

Dialog creation and management for Microsoft Bot Framework Applications
https://docs.microsoft.com/en-us/composer/
MIT License
860 stars 366 forks source link

Is there a feature within Bot Framework Composer to auto-expire an MS Teams session? #9710

Closed torresbj closed 1 month ago

torresbj commented 4 months ago

Is your feature request related to a problem? Please describe.

I am building a chatbot using Bot Framework Composer on Javascript/nodeJS and I am searching for a feature to auto-expire the conversation after a specified time period (for example, 30 minutes). This is particularly useful as most Chatbot would have to end a conversation rather than keep it up.

Describe the solution you'd like

Functionality to set a specific variable for time period from the start of the conversation and end the conversation if there is no activity after a certain period. It would trigger an event (ie. SessionTimeout) and that would end the conversation automatically.

Describe alternatives you've considered

There are alternatives but not within the Bot Framework Composer

OEvgeny commented 4 months ago

This is not something Composer supports out of the box to my knowledge.

User experience wise I'd treat anything user sends into a terminated conversation as a missed opportunity to help the user.

It may work better to notify the user that the session ended, starting over the new session when the user incoming message is received. It'd be nice to have the part of the context from the previous conversation to be preserved in the new session. This is highly depends on the use-case though.

For bot framework there is this documentation suggesting how to process user interruptions. I think similar approach could be taken to process interruptions on the bot side (e.g. on time basis as mentioned above) by checking dialog variable values instead user messages.

torresbj commented 4 months ago

I completely agree with the terminated conversation point of view which is why all session expiration would still be communicated like "I haven't heard from you for xxx minutes, feel free to reach out if you still have any questions" or something like that.

I was just looking at it from a best practice point of view where the sessions are expired since the context might have changed. This can be one hour or one day.

For example, a regular user would probably not want to continue with the same context that he left off 2 weeks ago or the context/situation has already changed and the data is no longer accurate.

It's more of a functionality to auto-expire than processing interruptions which is something manageable within Bot Composer Framework. I was just wondering or hoping that this basic feature which is pretty much a best practice in bot development is also out of the box.

stevkan commented 1 month ago

@torresbj - I wanted to let you know that there are a couple packages in the 'Package Manager' section of Composer that might serve your needs. Both, essentially, provide the same functionality in that they add in a new trigger type that allows you to specify a value (in seconds) for how long a conversation should persist before it expires (presumably, with no activity). They are:

Be aware that I did experience some difficulties in installing these. The CLI command used in Composer kept failing even though the command was technically correct. This was true both in and out of Composer. However, if I installed either package into the project via Visual Studio, first, and then repeated the task via Composer (same package and same version), the package would install.

I then had the below options. I haven't had a chance to test either of these, so keep that in mind when using.

image

image

Lastly, in case you are unaware, Teams conversations don't ever actually expire. The same conversation ID is used throughout all conversations held between members of that conversation, regardless of where a user is in the flow of a conversation. So, you may need to be creative in your conversational flow in order to activate a trigger when using Teams as the client.

I'm going to close this as resolved since activity has died and a possible solution has been provided. As these are not Microsoft products, we do not offer support for them. If you have an issue using either library, please post on their respective sites when seeking help.