Forum Discussion
Teams bot conversation history confusion
Sayali-MSFT thank you but we've seen these links before. A few follow-up questions:
1) we need an example in javascript/typescript if you have one
2) how come if we remove all traces of doing anything with storage, we still see the conversation history? this piece hasn't been answered. Are you saying it stores it in cosmosdb autotmatically? we don't want to store in cosmos, we want to write a custom one but need to understand how it works if we don't specify anything as we're seeing history without any code as mentioned in the original post. Thanks.
soulglow -Here is one way, You can use the ConcurrentDictionary to add, retrieve, update, and remove items from a System.Collections.Concurrent.ConcurrentDictionary<TKey,TValue>. This collection class is a thread-safe implementation.
public ProactiveBot(ConcurrentDictionary<string, ConversationReference> conversationReferences, IConfiguration configuration)
{
_conversationReferences = conversationReferences;
_configuration = configuration;
}
private void AddConversationReference(Activity activity)
{
var conversationReference = activity.GetConversationReference();
_conversationReferences.AddOrUpdate(conversationReference.User.AadObjectId, conversationReference, (key, newValue) => conversationReference);
}
Reference sample -1. Microsoft-Teams-Samples/ProactiveBot.cs at 94b4bf9aea97eff41a8bf787cfb3974104745306 · OfficeDev/Microsoft-Teams-Samples (github.com)
2.Microsoft-Teams-Samples/proactiveBot.js at 9906633fe8c90a1c48f36f30f28ce00cb94c89ed · OfficeDev/Microsoft-Teams-Samples (github.com)
For the second query, We are checking with the engineering team and get back to you.
- soulglowNov 16, 2022Copper ContributorHi. So your examples are all using C#, we don't know it and as I mentioned we use typescript/javascript. We don't know how to apply them.
My main question is how the conversation history is stored. I don't understand the difference between your first reply which uses DocumentDbBotDataStore and your second example which uses a dictionary. What's the connection between these 2 examples? Again, we're not C# developers.
May be you can describe:
1) if we don't specify any memory storage or documentdb storage, how come conversations never disappear?
2) if we had to write a custom one, what would we need to do in typescript? can you explain step by step?- Sayali-MSFTNov 17, 2022
Microsoft
soulglow - We are checking with the engineering team and get back to you.- ChetanSharma-msftFeb 08, 2023
Microsoft
soulglow - Could you please refer this documentation and let us know if it helps you in any ways:
Notification bot in Teams - Teams | Microsoft Learn
Please feel free to ask further questions, if you have any.