botframework-sdk icon indicating copy to clipboard operation
botframework-sdk copied to clipboard

DirectLine Conversation Ids get expired?

Open hpksp opened this issue 7 years ago • 6 comments

We store conversation ids (direct line) against our application users which will be later used to resume conversations. However, when trying to resume a conversation after keeping them inactive for several days, directline service returns HTTP 404 error. Please refer the issue where it's mentioned that conversation ids do not expire. Is this the expected behavior?

hpksp avatar Feb 11 '19 05:02 hpksp

Update: apparently conversation ids do now 'become unreachable after a few weeks of inactivity'.

https://github.com/Microsoft/BotFramework-DirectLineJS/issues/119#issuecomment-445066667

Conversation messages are only stored for 24 hours in DirectLine. Conversation metadata (such as conversation id and couple other housekeeping data) are removed after a period of inactivity (between 15 to 20 days).

EricDahlvang avatar Feb 11 '19 17:02 EricDahlvang

Thanks for the update @EricDahlvang. Well, if that's case, the only option we have is to re-create conversations. Need to figure out a way to expire the user/conversation/private conversation state automatically as well. I'm thinking of using Time to live feature as we are using CosmosDB for state persistence. Is there a recommended approach?

hpksp avatar Feb 12 '19 01:02 hpksp

I'm not aware of a recommended approach to expiring a conversation in Direct Line. Using time-to-live sounds like a great idea for the bot and storage side. Something else might be required for the client.

I'm closing this, as the question has been answered. Thank you for opening this issue. I was not aware of the protocol change with expiring conversation ids until today. (I've updated my previous comment)

EricDahlvang avatar Feb 12 '19 02:02 EricDahlvang

We will update the client accordingly. Many thanks @EricDahlvang.

hpksp avatar Feb 12 '19 02:02 hpksp

Then how can we handle the old conversation data of the user, if we need to show the transcript history of the user. Is there any recommended way of that ?

neetibirla avatar Mar 29 '19 05:03 neetibirla

@neetibirla If you use TranscriptLoggerMiddleware and a Transcript Store implementation, you can retrieve conversation history at any time and send it to the Direct Line service using the SendConversationHistory API. A Node.js example can be found in this closed pull request: https://github.com/Microsoft/BotBuilder-Samples/pull/1266

Mapping multiple conversations to a single user, and managing conversations with conversation history for a specific user is left to the developer.

EricDahlvang avatar Apr 01 '19 16:04 EricDahlvang