5
votes

I am developing chatbot application based on MS Bot Framework. And I need implement functionality of long-term history for chat conversations.

After reading tons of manuals, I found out two approaches how can I do this.

  1. Use approach that was described here. This approach uses DirectLine api-endpoint https://directline.botframework.com/v3/directline/conversations/{convId}/activities.

  2. Implement custom functionality, which will:

    • process all conversation activities
    • save them to storage(MongoDB),
    • provide a possibility to request activities for a specific conversation
    • and so on and so on

Variant №1 looks good, but I have some concerns about it. I have found nowhere details about specification DirectLine cache/buffer.

  • How long DirectLine stores content (activities that were sent through it) of conversation (conversationId)? What is expiration time for conversationId?
  • Can I expect, that I can get content of specific conversation at any time?
2
How long DirectLine stores content (activities that were sent through it) of conversation (conversationId)? Do you want to know how long Direct Line store conversation data in temporary cache?Fei Han
yeap, exactly ) Thankscol
I do not find official documentation or blog that explain about Direct Line service temporary cache yet, but in this github issue willportnoy said: DirectLine uses the same web service bot endpoint that other channels use. There is an intermediate "Direct Line" service. It stores conversation data for a short period of time (to enable queuing) in the cloud (for fault tolerance), for that short period of time. I think the "short period of time" is something less than a day, but it's subject to change over time.Fei Han

2 Answers

2
votes

in memory is temp, and will always be gone when you publish again. its best to use a database for conversation state and user sessions. and then use the watermark to get back and continue with the conversation.

Words from MS:

In-memory data storage is intended for testing only. This storage is volatile and temporary. The data is cleared each time the bot is restarted.

MS docs has lots of info on managing state data, this could expire of course at some point but Bot State Management incase that dies one day Bot state Search

provides the search link, with needed results.

Not seen a mongo one, but they have a table storage solution and cosmos db solution, both nosql

Also as a side note, even if MS are doing this on there channel for you, it will still only be temp storage, especially with the new GDPR rules, and also that MS just dont like saving the conversation data

1
votes

How long DirectLine stores content (activities that were sent through it) of conversation (conversationId)? What is expiration time for conversationId?

Messages are deleted after 24 hours

Can I expect, that I can get content of specific conversation at any time?

No, if you want the history of a conversation with a user you will need to save it and retrieve it based on user Id. A while back I wrote an example of storing conversation history it was for the purpose of displaying chat history in the webchat control. If uses a branch of the webchat repository which you can find being discussed here. You may or may not be able to reporpose pieces of the code for your use depending on what exactly you are trying to accomplish.

What exactly are you trying to accomplish with historical activities/conversations? I may have some other info for you.